Repository navigation
139 lines (134 loc) · 5.13 KB
/
Copy pathjavascript.yml
File metadata and controls
139 lines (134 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Build and Test JavaScript
on:
workflow_call:
pull_request:
paths:
- payjoin-ffi/**
# The jobs run inside the flake's dev shell, so changes to the flake
# change this workflow's environment.
- flake.nix
- flake.lock
permissions:
contents: read
jobs:
# Pull requests run only the Linux build and test job. The other jobs
# cover macOS, Windows and packaging, and run on bindings releases and
# the daily run.
build-js-and-test:
name: "Build and test javascript"
runs-on: ubuntu-26.04
env:
RUSTUP_TOOLCHAIN: 1.85.0
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: 1.85.0
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
shared-key: msrv-workspace
- name: Set up nix
uses: $/.github/actions/setup-nix
- name: "Build and test"
run: nix develop .#javascript -c ./payjoin-ffi/javascript/contrib/test.sh
build-js-and-test-macos:
name: "Build and test javascript (macos)"
if: github.event_name != 'pull_request'
runs-on: macos-latest
env:
RUSTUP_TOOLCHAIN: 1.85.0
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: 1.85.0
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
shared-key: msrv-workspace
- name: Set up nix
uses: $/.github/actions/setup-nix
- name: "Build and test"
run: nix develop .#javascript -c ./payjoin-ffi/javascript/contrib/test.sh
pack-npm:
# The package ships only dist/ (wasm + compiled TypeScript), which is
# platform-independent, so one pack on Linux is the entire release build.
name: "Pack npm package"
if: github.event_name != 'pull_request'
runs-on: ubuntu-26.04
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Set up nix
uses: $/.github/actions/setup-nix
- name: Build and pack
run: nix develop .#javascript -c ./payjoin-ffi/javascript/contrib/pack.sh
- name: Upload npm package
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: payjoin-javascript-npm-package
path: payjoin-ffi/javascript/artifacts/*.tgz
if-no-files-found: error
smoke-npm:
name: "Smoke test npm package"
if: github.event_name != 'pull_request'
runs-on: ${{ matrix.os }}
needs: pack-npm
strategy:
matrix:
os: [ubuntu-26.04, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: Download npm package
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: payjoin-javascript-npm-package
path: payjoin-ffi/javascript/smoke/pkg
- name: Install Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
package-manager-cache: false
- name: Install and exercise the packed package
shell: bash
run: |
set -euo pipefail
cd payjoin-ffi/javascript/smoke
# The lockfile pins a stable tarball path so the artifact's
# version-named file must be renamed to match it.
shopt -s nullglob
tarballs=(pkg/payjoin-*.tgz)
if [ "${#tarballs[@]}" -ne 1 ]; then
echo "::error::expected exactly one .tgz in pkg/, found ${#tarballs[@]}: ${tarballs[*]:-none}"
exit 1
fi
mv "${tarballs[0]}" pkg/payjoin.tgz
# Installs payjoin and its dependencies from the committed
# lockfile, so nothing is ever installed ad-hoc.
npm ci
node --input-type=module -e '
import { payjoin, uniffiInitAsync } from "payjoin";
await uniffiInitAsync();
payjoin.Url.parse("https://example.com");
console.log("smoke ok");
'