Skip to content

Commit

Permalink
Improve the CI runtime (#4056)
Browse files Browse the repository at this point in the history
  • Loading branch information
Systemcluster committed Aug 6, 2024
1 parent acfd1ee commit 2ea6ab1
Show file tree
Hide file tree
Showing 49 changed files with 191 additions and 269 deletions.
94 changes: 89 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
tags-ignore: [dev]
pull_request:
branches: [main]
workflow_dispatch:
defaults:
run:
shell: bash
Expand Down Expand Up @@ -53,7 +54,6 @@ jobs:
- run: cargo clippy --no-deps --all-features -p example-tests -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-externref-xform -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-futures -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-macro-support -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-multi-value-xform -- -D warnings
Expand All @@ -66,11 +66,30 @@ jobs:
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-wasm-interpreter -- -D warnings
- run: cargo clippy --no-deps --all-features -p wasm-bindgen-webidl -- -D warnings
- run: cargo clippy --no-deps --all-features -p webidl-tests -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings

# Run `cargo clippy` over web-sys and js-sys crates
clippy_web_sys:
name: Clippy (web-sys)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p js-sys -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p web-sys -- -D warnings

# Run `cargo clippy` over the project
clippy_project:
name: Clippy (project)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- run: cargo clippy --no-deps --no-default-features --target wasm32-unknown-unknown -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown --tests -- -D warnings
- run: cargo clippy --no-deps --all-features --target wasm32-unknown-unknown -p wasm-bindgen-benchmark -- -D warnings
- 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

test_wasm_bindgen:
Expand All @@ -87,12 +106,52 @@ jobs:
node-version: '20'
- uses: ./.github/actions/setup-geckodriver
- run: cargo test --target wasm32-unknown-unknown
- run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures

test_wasm_bindgen_features:
name: "Run wasm-bindgen crate tests with different features"
runs-on: ubuntu-latest
env:
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: ./.github/actions/setup-geckodriver
- run: cargo test --target wasm32-unknown-unknown --features serde-serialize
- run: cargo test --target wasm32-unknown-unknown --features enable-interning
- run: cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures

test_wasm_bindgen_wasm:
name: "Run wasm-bindgen wasm test"
runs-on: ubuntu-latest
env:
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: cargo test --target wasm32-unknown-unknown --test wasm
env:
WASM_BINDGEN_NO_DEBUG: 1

test_wasm_bindgen_envs:
name: "Run wasm-bindgen crate tests with various environment variables"
runs-on: ubuntu-latest
env:
WASM_BINDGEN_SPLIT_LINKED_MODULES: 1
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: cargo test --target wasm32-unknown-unknown
env:
WASM_BINDGEN_EXTERNREF: 1
Expand Down Expand Up @@ -171,7 +230,31 @@ jobs:
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Node
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Element
- run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --features Window

test_web_sys_all_features:
name: "Run web-sys crate tests with all features"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: ./.github/actions/setup-geckodriver
- run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features

test_web_sys_all_features_unstable:
name: "Run web-sys crate tests with all features and unstable APIs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup update --no-self-update stable && rustup default stable
- run: rustup target add wasm32-unknown-unknown
- uses: actions/setup-node@v4
with:
node-version: '20'
- uses: ./.github/actions/setup-geckodriver
- run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features
env:
RUSTFLAGS: --cfg=web_sys_unstable_apis
Expand Down Expand Up @@ -448,7 +531,7 @@ jobs:
- uses: actions/checkout@v4
- run: rustup update --no-self-update 1.57 && rustup default 1.57
- run: cargo build

msrv-cli:
name: Check MSRV for CLI tools
runs-on: ubuntu-latest
Expand All @@ -459,12 +542,13 @@ jobs:
- uses: actions/checkout@v4
- run: rustup update --no-self-update 1.76 && rustup default 1.76
- run: cargo build


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

if: github.repository == 'rustwasm/wasm-bindgen'
needs:
- doc_api
- doc_book
Expand Down
13 changes: 6 additions & 7 deletions _package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"css-loader": "^6.8.1",
"html-webpack-plugin": "^5.3.2",
"mini-css-extract-plugin": "^2.7.6",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2"
"css-loader": "^7.1.2",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.9.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "5.0.4"
}
}
2 changes: 1 addition & 1 deletion crates/js-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2835,7 +2835,7 @@ macro_rules! number_try_from {
#[inline]
fn try_from(x: $x) -> Result<Number, Self::Error> {
let x_f64 = x as f64;
if x_f64 >= Number::MIN_SAFE_INTEGER && x_f64 <= Number::MAX_SAFE_INTEGER {
if (Number::MIN_SAFE_INTEGER..=Number::MAX_SAFE_INTEGER).contains(&x_f64) {
Ok(Number::from(x_f64))
} else {
Err(TryFromIntError(()))
Expand Down
9 changes: 4 additions & 5 deletions examples/add/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions examples/add/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".")
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time.
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
],
mode: 'development',
experiments: {
Expand Down
9 changes: 4 additions & 5 deletions examples/canvas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions examples/canvas/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".")
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time.
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
],
mode: 'development',
experiments: {
Expand Down
9 changes: 4 additions & 5 deletions examples/char/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions examples/char/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".")
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time.
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
],
mode: 'development',
experiments: {
Expand Down
9 changes: 4 additions & 5 deletions examples/closures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions examples/closures/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".")
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time.
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
],
mode: 'development',
experiments: {
Expand Down
9 changes: 4 additions & 5 deletions examples/console_log/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions examples/console_log/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".")
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time.
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
],
mode: 'development',
experiments: {
Expand Down
9 changes: 4 additions & 5 deletions examples/dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions examples/dom/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".")
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time.
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
],
mode: 'development',
experiments: {
Expand Down
9 changes: 4 additions & 5 deletions examples/duck-typed-interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
6 changes: 0 additions & 6 deletions examples/duck-typed-interfaces/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ module.exports = {
new WasmPackPlugin({
crateDirectory: path.resolve(__dirname, ".")
}),
// Have this example work in Edge which doesn't ship `TextEncoder` or
// `TextDecoder` at this time.
new webpack.ProvidePlugin({
TextDecoder: ['text-encoding', 'TextDecoder'],
TextEncoder: ['text-encoding', 'TextEncoder']
})
],
mode: 'development',
experiments: {
Expand Down
9 changes: 4 additions & 5 deletions examples/fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
},
"devDependencies": {
"@wasm-tool/wasm-pack-plugin": "1.5.0",
"html-webpack-plugin": "^5.3.2",
"text-encoding": "^0.7.0",
"webpack": "^5.49.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^4.15.1"
"html-webpack-plugin": "^5.6.0",
"webpack": "^5.93.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
Loading

0 comments on commit 2ea6ab1

Please sign in to comment.