From ece81e52233e74dc4e9c3598321272879b527d01 Mon Sep 17 00:00:00 2001 From: Systemcluster Date: Thu, 8 Aug 2024 14:28:25 +0200 Subject: [PATCH] Deduplicate some CI jobs --- .github/workflows/main.yml | 197 +++++++++++-------------------------- 1 file changed, 60 insertions(+), 137 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8499178ed717..5cd5a69b9568 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -93,6 +93,14 @@ jobs: - 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: + strategy: + matrix: + runs: + - | + cargo test --target wasm32-unknown-unknown + cargo test --target wasm32-unknown-unknown -p wasm-bindgen-futures + - cargo test --target wasm32-unknown-unknown --features serde-serialize + - cargo test --target wasm32-unknown-unknown --features enable-interning name: "Run wasm-bindgen crate tests (unix)" runs-on: ubuntu-latest env: @@ -105,38 +113,7 @@ jobs: with: 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_feature_serde: - name: "Run wasm-bindgen crate tests with serde-serialize feature" - 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 - - test_wasm_bindgen_feature_interning: - name: "Run wasm-bindgen crate tests with enable-interning feature" - 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 enable-interning + - run: ${{ matrix.runs }} test_wasm_bindgen_wasm: name: "Run wasm-bindgen wasm test" @@ -154,11 +131,22 @@ jobs: env: WASM_BINDGEN_NO_DEBUG: 1 - test_wasm_bindgen_externref: - name: "Run wasm-bindgen crate tests with various environment variables" + test_wasm_bindgen_features: + strategy: + matrix: + envs: + - name: "externref" + env: + WASM_BINDGEN_EXTERNREF: 1 + - name: "multi-value" + env: + WASM_BINDGEN_MULTI_VALUE: 1 + name: "Run wasm-bindgen crate tests with ${{ matrix.envs.name }} feature" runs-on: ubuntu-latest env: WASM_BINDGEN_SPLIT_LINKED_MODULES: 1 + WASM_BINDGEN_EXTERNREF: ${{ matrix.envs.WASM_BINDGEN_EXTERNREF }} + WASM_BINDGEN_MULTI_VALUE: ${{ matrix.envs.WASM_BINDGEN_MULTI_VALUE }} steps: - uses: actions/checkout@v4 - run: rustup update --no-self-update stable && rustup default stable @@ -167,24 +155,6 @@ jobs: with: node-version: '20' - run: cargo test --target wasm32-unknown-unknown - env: - WASM_BINDGEN_EXTERNREF: 1 - - test_wasm_bindgen_multi_value: - 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_MULTI_VALUE: 1 test_threads: name: "Run wasm-bindgen crate tests with multithreading" @@ -242,8 +212,44 @@ jobs: - run: cargo test -p wasm-bindgen-futures - run: cargo test -p wasm-bindgen-shared - test_web_sys: - name: "Run web-sys crate tests" + test_node: + strategy: + matrix: + runs: + - name: "web-sys" + run: | + run: cargo build --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown + 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 + - name: "js-sys (all features)" + run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features + - name: "js-sys (unstable, all features)" + run: cargo test --manifest-path crates/web-sys/Cargo.toml --target wasm32-unknown-unknown --all-features + env: + RUSTFLAGS: --cfg=web_sys_unstable_apis + - name: "js-sys" + run: cargo test -p js-sys --target wasm32-unknown-unknown + - name: "js-sys (unstable)" + run: cargo test -p js-sys --target wasm32-unknown-unknown + env: + RUSTFLAGS: --cfg=js_sys_unstable_apis + - name: "wasm-bindgen-webidl" + run: cargo test -p wasm-bindgen-webidl + - name: "webidl-tests" + run: cargo test -p wasm-bindgen-webidl --target wasm32-unknown-unknown + env: + WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 + - name: "webidl-tests (unstable)" + run: cargo test -p wasm-bindgen-webidl --target wasm32-unknown-unknown + env: + RUSTFLAGS: --cfg=web_sys_unstable_apis + - name: "typescript-tests" + run: cd crates/typescript-tests && ./run.sh + name: "Run ${{ matrix.runs.name }} tests" + env: + RUSTFLAGS: ${{ matrix.runs.env.RUSTFLAGS }} + WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: ${{ matrix.runs.env.WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -258,89 +264,6 @@ jobs: - 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 - - check_web_sys: - name: "Verify that web-sys is compiled correctly" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - run: rustup update --no-self-update stable && rustup default stable - - run: cd crates/web-sys && cargo run --release --package wasm-bindgen-webidl -- webidls src/features ./Cargo.toml - - run: git diff --exit-code - - test_js_sys: - name: "Run js-sys crate tests" - 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 -p js-sys --target wasm32-unknown-unknown - - run: cargo test -p js-sys --target wasm32-unknown-unknown - env: - RUSTFLAGS: --cfg=js_sys_unstable_apis - - test_webidl: - name: "Run wasm-bindgen-webidl crate tests" - 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' - - run: cargo test -p wasm-bindgen-webidl - - run: cargo test -p webidl-tests --target wasm32-unknown-unknown - env: - WBINDGEN_I_PROMISE_JS_SYNTAX_WORKS_IN_NODE: 1 - - run: cargo test -p webidl-tests --target wasm32-unknown-unknown - env: - RUSTFLAGS: --cfg=web_sys_unstable_apis - - test_typescript_output: - name: "Test TypeScript output of wasm-bindgen" - 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' - - run: cd crates/typescript-tests && ./run.sh - test_deno: name: "Build and test the deno example" runs-on: ubuntu-latest