Skip to content

Commit 2ea6ab1

Browse files
Improve the CI runtime (#4056)
1 parent acfd1ee commit 2ea6ab1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+191
-269
lines changed

.github/workflows/main.yml

+89-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
tags-ignore: [dev]
66
pull_request:
77
branches: [main]
8+
workflow_dispatch:
89
defaults:
910
run:
1011
shell: bash
@@ -53,7 +54,6 @@ jobs:
5354
- run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings
5455
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings
5556
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings
56-
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings
5757
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings
5858
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings
5959
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings
@@ -66,11 +66,30 @@ jobs:
6666
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-interpreter -- -D warnings
6767
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-webidl -- -D warnings
6868
- run: cargo clippy --no-deps --all-features -p webidl-tests -- -D warnings
69+
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings
70+
71+
# Run `cargo clippy` over web-sys and js-sys crates
72+
clippy_web_sys:
73+
name: Clippy (web-sys)
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v4
77+
- run: rustup update --no-self-update stable && rustup default stable
78+
- run: rustup target add wasm32-unknown-unknown
79+
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings
6980
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings
81+
82+
# Run `cargo clippy` over the project
83+
clippy_project:
84+
name: Clippy (project)
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v4
88+
- run: rustup update --no-self-update stable && rustup default stable
89+
- run: rustup target add wasm32-unknown-unknown
7090
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -- -D warnings
7191
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings
7292
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown --tests -- -D warnings
73-
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings
7493
- run: for i in examples/*/; do cd "$i"; cargo +stable clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings || exit 1; cd ../..; done
7594

7695
test_wasm_bindgen:
@@ -87,12 +106,52 @@ jobs:
87106
node-version: '20'
88107
- uses: ./.github/actions/setup-geckodriver
89108
- run: cargo test --target wasm32-unknown-unknown
109+
- run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures
110+
111+
test_wasm_bindgen_features:
112+
name: "Run wasm-bindgen crate tests with different features"
113+
runs-on: ubuntu-latest
114+
env:
115+
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
116+
steps:
117+
- uses: actions/checkout@v4
118+
- run: rustup update --no-self-update stable && rustup default stable
119+
- run: rustup target add wasm32-unknown-unknown
120+
- uses: actions/setup-node@v4
121+
with:
122+
node-version: '20'
123+
- uses: ./.github/actions/setup-geckodriver
90124
- run: cargo test --target wasm32-unknown-unknown --features serde-serialize
91125
- run: cargo test --target wasm32-unknown-unknown --features enable-interning
92-
- run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures
126+
127+
test_wasm_bindgen_wasm:
128+
name: "Run wasm-bindgen wasm test"
129+
runs-on: ubuntu-latest
130+
env:
131+
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
132+
steps:
133+
- uses: actions/checkout@v4
134+
- run: rustup update --no-self-update stable && rustup default stable
135+
- run: rustup target add wasm32-unknown-unknown
136+
- uses: actions/setup-node@v4
137+
with:
138+
node-version: '20'
93139
- run: cargo test --target wasm32-unknown-unknown --test wasm
94140
env:
95141
WASM_BINDGEN_NO_DEBUG: 1
142+
143+
test_wasm_bindgen_envs:
144+
name: "Run wasm-bindgen crate tests with various environment variables"
145+
runs-on: ubuntu-latest
146+
env:
147+
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
148+
steps:
149+
- uses: actions/checkout@v4
150+
- run: rustup update --no-self-update stable && rustup default stable
151+
- run: rustup target add wasm32-unknown-unknown
152+
- uses: actions/setup-node@v4
153+
with:
154+
node-version: '20'
96155
- run: cargo test --target wasm32-unknown-unknown
97156
env:
98157
WASM_BINDGEN_EXTERNREF: 1
@@ -171,7 +230,31 @@ jobs:
171230
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node
172231
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element
173232
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window
233+
234+
test_web_sys_all_features:
235+
name: "Run web-sys crate tests with all features"
236+
runs-on: ubuntu-latest
237+
steps:
238+
- uses: actions/checkout@v4
239+
- run: rustup update --no-self-update stable && rustup default stable
240+
- run: rustup target add wasm32-unknown-unknown
241+
- uses: actions/setup-node@v4
242+
with:
243+
node-version: '20'
244+
- uses: ./.github/actions/setup-geckodriver
174245
- run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
246+
247+
test_web_sys_all_features_unstable:
248+
name: "Run web-sys crate tests with all features and unstable APIs"
249+
runs-on: ubuntu-latest
250+
steps:
251+
- uses: actions/checkout@v4
252+
- run: rustup update --no-self-update stable && rustup default stable
253+
- run: rustup target add wasm32-unknown-unknown
254+
- uses: actions/setup-node@v4
255+
with:
256+
node-version: '20'
257+
- uses: ./.github/actions/setup-geckodriver
175258
- run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
176259
env:
177260
RUSTFLAGS: --cfg=web_sys_unstable_apis
@@ -448,7 +531,7 @@ jobs:
448531
- uses: actions/checkout@v4
449532
- run: rustup update --no-self-update 1.57 && rustup default 1.57
450533
- run: cargo build
451-
534+
452535
msrv-cli:
453536
name: Check MSRV for CLI tools
454537
runs-on: ubuntu-latest
@@ -459,12 +542,13 @@ jobs:
459542
- uses: actions/checkout@v4
460543
- run: rustup update --no-self-update 1.76 && rustup default 1.76
461544
- run: cargo build
462-
545+
463546

464547
deploy:
465548
permissions:
466549
contents: write # to push changes in repo (jamesives/github-pages-deploy-action)
467550

551+
if: github.repository == 'rustwasm/wasm-bindgen'
468552
needs:
469553
- doc_api
470554
- doc_book

_package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"css-loader": "^6.8.1",
9-
"html-webpack-plugin": "^5.3.2",
10-
"mini-css-extract-plugin": "^2.7.6",
11-
"text-encoding": "^0.7.0",
12-
"webpack": "^5.49.0",
13-
"webpack-cli": "^4.7.2",
14-
"webpack-dev-server": "^3.11.2"
8+
"css-loader": "^7.1.2",
9+
"html-webpack-plugin": "^5.6.0",
10+
"mini-css-extract-plugin": "^2.9.0",
11+
"webpack": "^5.93.0",
12+
"webpack-cli": "^5.1.4",
13+
"webpack-dev-server": "5.0.4"
1514
}
1615
}

crates/js-sys/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2835,7 +2835,7 @@ macro_rules! number_try_from {
28352835
#[inline]
28362836
fn try_from(x: $x) -> Result<Number, Self::Error> {
28372837
let x_f64 = x as f64;
2838-
if x_f64 >= Number::MIN_SAFE_INTEGER && x_f64 <= Number::MAX_SAFE_INTEGER {
2838+
if (Number::MIN_SAFE_INTEGER..=Number::MAX_SAFE_INTEGER).contains(&x_f64) {
28392839
Ok(Number::from(x_f64))
28402840
} else {
28412841
Err(TryFromIntError(()))

examples/add/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

examples/add/webpack.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ module.exports = {
1414
new WasmPackPlugin({
1515
crateDirectory: path.resolve(__dirname, ".")
1616
}),
17-
// Have this example work in Edge which doesn't ship `TextEncoder` or
18-
// `TextDecoder` at this time.
19-
new webpack.ProvidePlugin({
20-
TextDecoder: ['text-encoding', 'TextDecoder'],
21-
TextEncoder: ['text-encoding', 'TextEncoder']
22-
})
2317
],
2418
mode: 'development',
2519
experiments: {

examples/canvas/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

examples/canvas/webpack.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ module.exports = {
1616
new WasmPackPlugin({
1717
crateDirectory: path.resolve(__dirname, ".")
1818
}),
19-
// Have this example work in Edge which doesn't ship `TextEncoder` or
20-
// `TextDecoder` at this time.
21-
new webpack.ProvidePlugin({
22-
TextDecoder: ['text-encoding', 'TextDecoder'],
23-
TextEncoder: ['text-encoding', 'TextEncoder']
24-
})
2519
],
2620
mode: 'development',
2721
experiments: {

examples/char/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

examples/char/webpack.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ module.exports = {
1616
new WasmPackPlugin({
1717
crateDirectory: path.resolve(__dirname, ".")
1818
}),
19-
// Have this example work in Edge which doesn't ship `TextEncoder` or
20-
// `TextDecoder` at this time.
21-
new webpack.ProvidePlugin({
22-
TextDecoder: ['text-encoding', 'TextDecoder'],
23-
TextEncoder: ['text-encoding', 'TextEncoder']
24-
})
2519
],
2620
mode: 'development',
2721
experiments: {

examples/closures/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

examples/closures/webpack.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ module.exports = {
1616
new WasmPackPlugin({
1717
crateDirectory: path.resolve(__dirname, ".")
1818
}),
19-
// Have this example work in Edge which doesn't ship `TextEncoder` or
20-
// `TextDecoder` at this time.
21-
new webpack.ProvidePlugin({
22-
TextDecoder: ['text-encoding', 'TextDecoder'],
23-
TextEncoder: ['text-encoding', 'TextEncoder']
24-
})
2519
],
2620
mode: 'development',
2721
experiments: {

examples/console_log/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

examples/console_log/webpack.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ module.exports = {
1414
new WasmPackPlugin({
1515
crateDirectory: path.resolve(__dirname, ".")
1616
}),
17-
// Have this example work in Edge which doesn't ship `TextEncoder` or
18-
// `TextDecoder` at this time.
19-
new webpack.ProvidePlugin({
20-
TextDecoder: ['text-encoding', 'TextDecoder'],
21-
TextEncoder: ['text-encoding', 'TextEncoder']
22-
})
2317
],
2418
mode: 'development',
2519
experiments: {

examples/dom/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

examples/dom/webpack.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ module.exports = {
1616
new WasmPackPlugin({
1717
crateDirectory: path.resolve(__dirname, ".")
1818
}),
19-
// Have this example work in Edge which doesn't ship `TextEncoder` or
20-
// `TextDecoder` at this time.
21-
new webpack.ProvidePlugin({
22-
TextDecoder: ['text-encoding', 'TextDecoder'],
23-
TextEncoder: ['text-encoding', 'TextEncoder']
24-
})
2519
],
2620
mode: 'development',
2721
experiments: {

examples/duck-typed-interfaces/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

examples/duck-typed-interfaces/webpack.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ module.exports = {
1616
new WasmPackPlugin({
1717
crateDirectory: path.resolve(__dirname, ".")
1818
}),
19-
// Have this example work in Edge which doesn't ship `TextEncoder` or
20-
// `TextDecoder` at this time.
21-
new webpack.ProvidePlugin({
22-
TextDecoder: ['text-encoding', 'TextDecoder'],
23-
TextEncoder: ['text-encoding', 'TextEncoder']
24-
})
2519
],
2620
mode: 'development',
2721
experiments: {

examples/fetch/package.json

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
},
66
"devDependencies": {
77
"@wasm-tool/wasm-pack-plugin": "1.5.0",
8-
"html-webpack-plugin": "^5.3.2",
9-
"text-encoding": "^0.7.0",
10-
"webpack": "^5.49.0",
11-
"webpack-cli": "^4.7.2",
12-
"webpack-dev-server": "^4.15.1"
8+
"html-webpack-plugin": "^5.6.0",
9+
"webpack": "^5.93.0",
10+
"webpack-cli": "^5.1.4",
11+
"webpack-dev-server": "^5.0.4"
1312
}
1413
}

0 commit comments

Comments
 (0)