Skip to content

Commit aeeec14

Browse files
committed
Improve CI: readable job names, codec matrix for all jobs, fix duplicate runs
- Use matrix include with named codec variants (postcard/pot) for readable job names instead of raw cargo flags - Add codec matrix to integration tests via npm scripts (test:pot) - Set workspace dep to default-features = false so test crate can switch codecs independently - Only trigger on push to main + all PRs (avoids duplicate runs)
1 parent 7ff4321 commit aeeec14

5 files changed

Lines changed: 37 additions & 7 deletions

File tree

.github/workflows/test.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
47

58
jobs:
69
rustfmt:
@@ -17,7 +20,12 @@ jobs:
1720
runs-on: ubuntu-latest
1821
strategy:
1922
matrix:
20-
features: ["--all-features", "--no-default-features --features iter-ext,codec-pot"]
23+
include:
24+
- codec: postcard
25+
features: "--all-features"
26+
- codec: pot
27+
features: "--no-default-features --features iter-ext,codec-pot"
28+
name: clippy (${{ matrix.codec }})
2129

2230
steps:
2331
- uses: actions/checkout@v4
@@ -31,7 +39,12 @@ jobs:
3139
runs-on: ubuntu-latest
3240
strategy:
3341
matrix:
34-
features: ["--all-features", "--no-default-features --features iter-ext,macros,codec-pot"]
42+
include:
43+
- codec: postcard
44+
features: "--all-features"
45+
- codec: pot
46+
features: "--no-default-features --features iter-ext,macros,codec-pot"
47+
name: doc-test (${{ matrix.codec }})
3548

3649
steps:
3750
- uses: actions/checkout@v4
@@ -42,6 +55,14 @@ jobs:
4255

4356
test:
4457
runs-on: ubuntu-latest
58+
strategy:
59+
matrix:
60+
include:
61+
- codec: postcard
62+
script: "npm test"
63+
- codec: pot
64+
script: "npm run test:pot"
65+
name: test (${{ matrix.codec }})
4566

4667
steps:
4768
- uses: actions/checkout@v4
@@ -52,4 +73,4 @@ jobs:
5273
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
5374
- name: Run tests
5475
working-directory: ./test
55-
run: npm test
76+
run: ${{ matrix.script }}

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ readme = "README.md"
1111
keywords = ["webworker", "parallelism", "wasm"]
1212

1313
[workspace.dependencies]
14-
wasmworker = { version = "0.3", path = ".", features = ["iter-ext", "macros"] }
14+
wasmworker = { version = "0.3", path = ".", default-features = false, features = ["iter-ext", "macros"] }
1515
wasmworker-proc-macro = { version = "0.3", path = "proc-macro" }
1616

1717
[package]

demo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ serde = { version = "1.0", features = ["derive"] }
2525
tokio = { version = "1.43", features = ["sync"] }
2626
wasm-bindgen = "0.2"
2727
wasm-bindgen-futures = "0.4"
28-
wasmworker = { workspace = true }
28+
wasmworker = { workspace = true, features = ["codec-postcard"] }
2929

3030
[dependencies.web-sys]
3131
features = [

test/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ js-sys = "0.3"
2323
wasm-bindgen-futures = "0.4"
2424
web-sys = { version = "0.3", features = ["MessagePort", "Window"] }
2525
wasmworker = { workspace = true }
26+
27+
[features]
28+
default = ["codec-postcard"]
29+
codec-postcard = ["wasmworker/codec-postcard"]
30+
codec-pot = ["wasmworker/codec-pot"]

test/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
"scripts": {
44
"postinstall": "playwright install chromium firefox",
55
"build:web": "wasm-pack build --target web --out-name test --out-dir out/web/pkg && shx cp index.* out/web",
6+
"build:web:pot": "wasm-pack build --target web --out-name test --out-dir out/web/pkg -- --no-default-features --features codec-pot && shx cp index.* out/web",
67
"build:vite": "wasm-pack build --target web --out-name test --out-dir vite-app/pkg && cd vite-app && npx vite build --outDir ../out/vite",
8+
"build:vite:pot": "wasm-pack build --target web --out-name test --out-dir vite-app/pkg -- --no-default-features --features codec-pot && cd vite-app && npx vite build --outDir ../out/vite",
79
"pretest": "npm run build:web && npm run build:vite",
8-
"test": "playwright test"
10+
"test": "playwright test",
11+
"pretest:pot": "npm run build:web:pot && npm run build:vite:pot",
12+
"test:pot": "playwright test"
913
},
1014
"devDependencies": {
1115
"@playwright/test": "^1.49.0",

0 commit comments

Comments
 (0)