Skip to content

Commit 3068e3b

Browse files
ci: parallelize wasm-bip32 and wasm-utxo test jobs
- Split single job into parallel test jobs for each package - Build job runs first, uploads artifacts - test-wasm-bip32 and test-wasm-utxo run in parallel after build - test-integration runs after both test jobs complete
1 parent 783e11f commit 3068e3b

1 file changed

Lines changed: 147 additions & 13 deletions

File tree

.github/workflows/build-and-test.yaml

Lines changed: 147 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ on:
99
default: false
1010

1111
jobs:
12-
run:
13-
name: "Test"
12+
# Shared build job - builds all packages first
13+
build:
14+
name: "Build"
1415
runs-on: ubuntu-latest
15-
1616
steps:
1717
- uses: actions/checkout@v4
1818
with:
@@ -26,7 +26,9 @@ jobs:
2626
- name: Cache Rust dependencies
2727
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
2828
with:
29-
workspaces: "packages/wasm-utxo"
29+
workspaces: |
30+
packages/wasm-utxo
31+
packages/wasm-bip32
3032
cache-on-failure: true
3133

3234
- name: Setup node 20
@@ -35,8 +37,7 @@ jobs:
3537
node-version: 20
3638

3739
- name: Ensure npm 11.5.1
38-
run: |
39-
npm install -g npm@11.5.1
40+
run: npm install -g npm@11.5.1
4041

4142
- name: Install wasm tools
4243
run: |
@@ -59,8 +60,7 @@ jobs:
5960
6061
- name: Fetch Base Ref
6162
if: github.event_name == 'pull_request'
62-
run: |
63-
git fetch origin $GITHUB_BASE_REF
63+
run: git fetch origin $GITHUB_BASE_REF
6464

6565
- name: Install Packages
6666
run: npm ci --workspaces --include-workspace-root
@@ -69,12 +69,115 @@ jobs:
6969
run: cargo deny check
7070
working-directory: packages/wasm-utxo
7171

72-
- name: build packages
72+
- name: Build packages
7373
run: npm --workspaces run build
7474

7575
- name: Check Source Code Formatting
7676
run: npm run check-fmt
7777

78+
- name: Upload build artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: build-output
82+
path: |
83+
packages/wasm-utxo/dist/
84+
packages/wasm-utxo/js/wasm/
85+
packages/wasm-bip32/dist/
86+
packages/wasm-bip32/js/wasm/
87+
retention-days: 1
88+
89+
# Test wasm-bip32 (runs in parallel with test-wasm-utxo)
90+
test-wasm-bip32:
91+
name: "Test wasm-bip32"
92+
needs: build
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v4
96+
with:
97+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
98+
99+
- name: Install Rust
100+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
101+
with:
102+
toolchain: nightly-2025-10-23
103+
104+
- name: Cache Rust dependencies
105+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
106+
with:
107+
workspaces: packages/wasm-bip32
108+
cache-on-failure: true
109+
110+
- name: Setup node 20
111+
uses: actions/setup-node@v4
112+
with:
113+
node-version: 20
114+
115+
- name: Ensure npm 11.5.1
116+
run: npm install -g npm@11.5.1
117+
118+
- name: Install Packages
119+
run: npm ci --workspaces --include-workspace-root
120+
121+
- name: Download build artifacts
122+
uses: actions/download-artifact@v4
123+
with:
124+
name: build-output
125+
path: packages/
126+
127+
- name: wasm-bip32 / Lint
128+
run: npm run lint
129+
working-directory: packages/wasm-bip32
130+
131+
- name: wasm-bip32 / cargo test
132+
run: cargo test --workspace
133+
working-directory: packages/wasm-bip32
134+
135+
- name: wasm-bip32 / Unit Test
136+
run: npm test
137+
working-directory: packages/wasm-bip32
138+
139+
# Test wasm-utxo (runs in parallel with test-wasm-bip32)
140+
test-wasm-utxo:
141+
name: "Test wasm-utxo"
142+
needs: build
143+
runs-on: ubuntu-latest
144+
steps:
145+
- uses: actions/checkout@v4
146+
with:
147+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
148+
149+
- name: Install Rust
150+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
151+
with:
152+
toolchain: nightly-2025-10-23
153+
154+
- name: Cache Rust dependencies
155+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # v2.8.1
156+
with:
157+
workspaces: packages/wasm-utxo
158+
cache-on-failure: true
159+
160+
- name: Setup node 20
161+
uses: actions/setup-node@v4
162+
with:
163+
node-version: 20
164+
165+
- name: Ensure npm 11.5.1
166+
run: npm install -g npm@11.5.1
167+
168+
- name: Install wasm tools
169+
run: |
170+
cargo install wasm-pack --version 0.13.1
171+
172+
- name: Install Packages
173+
run: npm ci --workspaces --include-workspace-root
174+
175+
- name: Download build artifacts
176+
uses: actions/download-artifact@v4
177+
with:
178+
name: build-output
179+
path: packages/
180+
78181
- name: wasm-utxo / Lint
79182
run: npm run lint
80183
working-directory: packages/wasm-utxo
@@ -91,10 +194,42 @@ jobs:
91194
run: npm run test:wasm-pack-chrome
92195
working-directory: packages/wasm-utxo
93196

94-
- name: Unit Test
95-
run: npm --workspaces test
197+
- name: wasm-utxo / Unit Test
198+
run: npm test
199+
working-directory: packages/wasm-utxo
96200

97-
- name: Upload build artifacts
201+
# Final tests that run after both packages are tested
202+
test-integration:
203+
name: "Integration Tests"
204+
needs: [test-wasm-bip32, test-wasm-utxo]
205+
runs-on: ubuntu-latest
206+
steps:
207+
- uses: actions/checkout@v4
208+
with:
209+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
210+
211+
- name: Setup node 20
212+
uses: actions/setup-node@v4
213+
with:
214+
node-version: 20
215+
216+
- name: Ensure npm 11.5.1
217+
run: npm install -g npm@11.5.1
218+
219+
- name: Install Packages
220+
run: npm ci --workspaces --include-workspace-root
221+
222+
- name: Download build artifacts
223+
uses: actions/download-artifact@v4
224+
with:
225+
name: build-output
226+
path: packages/
227+
228+
- name: webui / Unit Test
229+
run: npm test
230+
working-directory: packages/webui
231+
232+
- name: Upload final build artifacts
98233
if: inputs.upload-artifacts
99234
uses: actions/upload-artifact@v4
100235
with:
@@ -103,4 +238,3 @@ jobs:
103238
packages/wasm-utxo/pkg/
104239
packages/wasm-utxo/dist/
105240
retention-days: 1
106-

0 commit comments

Comments
 (0)