88 type : boolean
99 default : false
1010
11+ env :
12+ RUST_TOOLCHAIN : nightly-2025-10-23
13+ NODE_VERSION : 20
14+ NPM_VERSION : 11.5.1
15+ WASM_PACK_VERSION : 0.13.1
16+ WASM_OPT_VERSION : 0.116.1
17+
1118jobs :
12- run :
13- name : " Test "
19+ build :
20+ name : " Build "
1421 runs-on : ubuntu-latest
15-
1622 steps :
1723 - uses : actions/checkout@v4
1824 with :
@@ -21,28 +27,27 @@ jobs:
2127 - name : Install Rust
2228 uses : dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
2329 with :
24- toolchain : nightly-2025-10-23
30+ toolchain : ${{ env.RUST_TOOLCHAIN }}
31+ components : rustfmt, clippy
2532
2633 - name : Cache Rust dependencies
2734 uses : Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
2835 with :
29- workspaces : " packages/wasm-utxo"
36+ workspaces : |
37+ packages/wasm-utxo
38+ packages/wasm-bip32
3039 cache-on-failure : true
3140
32- - name : Setup node 20
41+ - name : Setup Node
3342 uses : actions/setup-node@v4
3443 with :
35- node-version : 20
36-
37- - name : Ensure npm 11.5.1
38- run : |
39- npm install -g npm@11.5.1
44+ node-version : ${{ env.NODE_VERSION }}
4045
41- - name : Install wasm tools
46+ - name : Install npm and wasm tools
4247 run : |
43- rustup component add rustfmt
44- cargo install wasm-pack --version 0.13.1
45- cargo install wasm-opt --version 0.116.1
48+ npm install -g npm@${{ env.NPM_VERSION }}
49+ cargo install wasm-pack --version ${{ env.WASM_PACK_VERSION }}
50+ cargo install wasm-opt --version ${{ env.WASM_OPT_VERSION }}
4651 cargo install cargo-deny --locked
4752
4853 - name : Build Info
@@ -53,14 +58,10 @@ jobs:
5358 echo "wasm-pack $(wasm-pack --version)"
5459 echo "wasm-opt $(wasm-opt --version)"
5560 echo "cargo-deny $(cargo deny --version)"
56- git --version
57- echo "base ref $GITHUB_BASE_REF"
58- echo "head ref $GITHUB_HEAD_REF"
5961
6062 - name : Fetch Base Ref
6163 if : github.event_name == 'pull_request'
62- run : |
63- git fetch origin $GITHUB_BASE_REF
64+ run : git fetch origin $GITHUB_BASE_REF
6465
6566 - name : Install Packages
6667 run : npm ci --workspaces --include-workspace-root
@@ -69,32 +70,129 @@ jobs:
6970 run : cargo deny check
7071 working-directory : packages/wasm-utxo
7172
72- - name : build packages
73+ - name : Build packages
7374 run : npm --workspaces run build
7475
7576 - name : Check Source Code Formatting
7677 run : npm run check-fmt
7778
78- - name : wasm-utxo / Lint
79+ - name : Upload build artifacts
80+ uses : actions/upload-artifact@v4
81+ with :
82+ name : build-output
83+ path : |
84+ packages/wasm-utxo/dist/
85+ packages/wasm-utxo/js/wasm/
86+ packages/wasm-bip32/dist/
87+ packages/wasm-bip32/js/wasm/
88+ retention-days : 1
89+
90+ test :
91+ name : " Test ${{ matrix.package }}"
92+ needs : build
93+ runs-on : ubuntu-latest
94+ strategy :
95+ fail-fast : false
96+ matrix :
97+ package : [wasm-bip32, wasm-utxo]
98+ include :
99+ - package : wasm-utxo
100+ needs-wasm-pack : true
101+ has-wasm-pack-tests : true
102+ - package : wasm-bip32
103+ needs-wasm-pack : false
104+ has-wasm-pack-tests : false
105+ steps :
106+ - uses : actions/checkout@v4
107+ with :
108+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
109+
110+ - name : Install Rust
111+ uses : dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
112+ with :
113+ toolchain : ${{ env.RUST_TOOLCHAIN }}
114+ components : rustfmt, clippy
115+
116+ - name : Cache Rust dependencies
117+ uses : Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
118+ with :
119+ workspaces : packages/${{ matrix.package }}
120+ cache-on-failure : true
121+
122+ - name : Setup Node
123+ uses : actions/setup-node@v4
124+ with :
125+ node-version : ${{ env.NODE_VERSION }}
126+
127+ - name : Install npm
128+ run : npm install -g npm@${{ env.NPM_VERSION }}
129+
130+ - name : Install wasm-pack
131+ if : matrix.needs-wasm-pack
132+ run : cargo install wasm-pack --version ${{ env.WASM_PACK_VERSION }}
133+
134+ - name : Install Packages
135+ run : npm ci --workspaces --include-workspace-root
136+
137+ - name : Download build artifacts
138+ uses : actions/download-artifact@v4
139+ with :
140+ name : build-output
141+ path : packages/
142+
143+ - name : Lint
79144 run : npm run lint
80- working-directory : packages/wasm-utxo
145+ working-directory : packages/${{ matrix.package }}
81146
82- - name : wasm-utxo / cargo test
147+ - name : Cargo Test
83148 run : cargo test --workspace
84- working-directory : packages/wasm-utxo
149+ working-directory : packages/${{ matrix.package }}
85150
86- - name : wasm-utxo / Wasm-Pack Test (Node)
151+ - name : Wasm-Pack Test (Node)
152+ if : matrix.has-wasm-pack-tests
87153 run : npm run test:wasm-pack-node
88- working-directory : packages/wasm-utxo
154+ working-directory : packages/${{ matrix.package }}
89155
90- - name : wasm-utxo / Wasm-Pack Test (Chrome)
156+ - name : Wasm-Pack Test (Chrome)
157+ if : matrix.has-wasm-pack-tests
91158 run : npm run test:wasm-pack-chrome
92- working-directory : packages/wasm-utxo
159+ working-directory : packages/${{ matrix.package }}
93160
94161 - name : Unit Test
95- run : npm --workspaces test
162+ run : npm test
163+ working-directory : packages/${{ matrix.package }}
96164
97- - name : Upload build artifacts
165+ finalize :
166+ name : " Finalize"
167+ needs : test
168+ runs-on : ubuntu-latest
169+ steps :
170+ - uses : actions/checkout@v4
171+ with :
172+ ref : ${{ github.event.pull_request.head.sha || github.sha }}
173+
174+ - name : Setup Node
175+ uses : actions/setup-node@v4
176+ with :
177+ node-version : ${{ env.NODE_VERSION }}
178+
179+ - name : Install npm
180+ run : npm install -g npm@${{ env.NPM_VERSION }}
181+
182+ - name : Install Packages
183+ run : npm ci --workspaces --include-workspace-root
184+
185+ - name : Download build artifacts
186+ uses : actions/download-artifact@v4
187+ with :
188+ name : build-output
189+ path : packages/
190+
191+ - name : webui / Unit Test
192+ run : npm test
193+ working-directory : packages/webui
194+
195+ - name : Upload final build artifacts
98196 if : inputs.upload-artifacts
99197 uses : actions/upload-artifact@v4
100198 with :
@@ -104,3 +202,11 @@ jobs:
104202 packages/wasm-utxo/dist/
105203 retention-days : 1
106204
205+ # This job provides a stable "test / Test" status check for branch protection.
206+ # It runs after all other jobs complete successfully.
207+ gate :
208+ name : " Test"
209+ needs : [build, test, finalize]
210+ runs-on : ubuntu-latest
211+ steps :
212+ - run : echo "All checks passed"
0 commit comments