chore(ci): use windows self hosted #1486
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI-Rust | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| merge_group: | |
| types: [checks_requested] | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - ".github/workflows/**" | |
| - "crates/**" | |
| - "Cargo.lock" | |
| - "Cargo.toml" | |
| - "rust-toolchain.toml" | |
| tags-ignore: | |
| - "**" | |
| jobs: | |
| check-changed: | |
| runs-on: ubuntu-latest | |
| name: Check Source Changed | |
| outputs: | |
| code_changed: ${{ steps.filter.outputs.code_changed == 'true' }} | |
| document_changed: ${{ steps.filter.outputs.document_changed == 'true' }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3 | |
| id: filter | |
| with: | |
| predicate-quantifier: "every" | |
| filters: | | |
| code_changed: | |
| - "!**/*.md" | |
| - "!**/*.mdx" | |
| - "!website/**" | |
| document_changed: | |
| - "website/**" | |
| rust_check: | |
| name: Rust check | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Install Rust Toolchain | |
| uses: ./.github/actions/rustup | |
| with: | |
| save-if: true | |
| key: check | |
| - name: Run Cargo Check | |
| run: cargo check --workspace --all-targets --locked # Not using --release because it uses too much cache, and is also slow. | |
| - name: Run Clippy | |
| uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1 | |
| with: | |
| command: clippy | |
| args: --workspace --all-targets --tests -- -D warnings | |
| - name: Run rustfmt | |
| uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1 | |
| with: | |
| command: fmt | |
| args: --all -- --check | |
| - name: Install tapo | |
| run: cargo install taplo-cli --locked | |
| - name: Run toml format check | |
| run: taplo format --check '.cargo/*.toml' './crates/**/Cargo.toml' './Cargo.toml' | |
| rust_unused_dependencies: | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| name: Check Rust Dependencies | |
| runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - uses: ./.github/actions/rustup | |
| with: | |
| key: check | |
| - name: Install cargo-deny | |
| uses: taiki-e/install-action@1cefd1553b1693f47889dc747f7d230904296a3b # v2 | |
| with: | |
| tool: [email protected] | |
| - name: Check licenses | |
| run: cargo deny check license bans | |
| - uses: cargo-bins/cargo-binstall@e8c9cc3599f6c4063d143083205f98ca25d91677 # v1.12.6 | |
| - run: cargo binstall --no-confirm [email protected] --force | |
| - run: cargo shear | |
| rust_test: | |
| name: Rust test | |
| runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }} | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Install Rust Toolchain | |
| uses: ./.github/actions/rustup | |
| with: | |
| save-if: true | |
| key: test | |
| # Compile test without debug info for reducing the CI cache size | |
| - name: Change profile.test | |
| shell: bash | |
| run: | | |
| echo '[profile.test]' >> Cargo.toml | |
| echo 'debug = false' >> Cargo.toml | |
| - name: Run rspack test | |
| run: cargo test --workspace --exclude rspack_node -- --nocapture | |
| rust_test_miri: | |
| name: Rust test miri | |
| # TODO: enable it after self hosted runners are ready | |
| # if: needs.rust_changes.outputs.changed == 'true' && github.ref_name == 'main' && github.repository_owner == 'web-infra-dev' | |
| if: false | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Install Rust Toolchain | |
| uses: ./.github/actions/rustup | |
| with: | |
| save-if: ${{ github.ref_name == 'main' }} | |
| key: check | |
| # Compile test without debug info for reducing the CI cache size | |
| - name: Change profile.test | |
| shell: bash | |
| run: | | |
| echo '[profile.test]' >> Cargo.toml | |
| echo 'debug = false' >> Cargo.toml | |
| - name: Run test | |
| env: | |
| MIRIFLAGS: -Zmiri-tree-borrows -Zmiri-disable-isolation | |
| # reason for excluding https://github.com/napi-rs/napi-rs/issues/2200 | |
| run: cargo miri test --workspace --exclude rspack_node -- --nocapture | |
| test_required_check: | |
| # this job will be used for GitHub actions to determine required job success or not; | |
| # When code changed, it will check if any of the test jobs failed. | |
| # When *only* doc changed, it will run as success directly | |
| name: Rust Test Required Check | |
| needs: [rust_test, rust_check, check-changed] | |
| if: ${{ always() && !cancelled() }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Log | |
| run: echo ${{ join(needs.*.result, ',') }} | |
| - name: Test check | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' && join(needs.*.result, ',')!='success,success,success' }} | |
| run: echo "Tess Failed" && exit 1 | |
| - name: No check to Run test | |
| run: echo "Success" |