perf(loader): dispatch parallel loaders from Rust #43235
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 | |
| on: | |
| merge_group: | |
| types: [checks_requested] | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
| required: false | |
| default: false | |
| pull_request: | |
| types: [opened, synchronize] | |
| push: | |
| branches: | |
| - main | |
| - v1.x | |
| paths-ignore: | |
| - '**/*.md' | |
| - 'website/**' | |
| tags-ignore: | |
| - '**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: ${{ github.ref_name != 'main' && github.ref_name != 'v1.x' }} | |
| permissions: | |
| # Allow commenting on issues for `reusable-build.yml` | |
| issues: write | |
| # Allow commenting on pull requests for `size-limit.yml` | |
| pull-requests: write | |
| jobs: | |
| check-changed: | |
| runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4 | |
| id: filter | |
| with: | |
| predicate-quantifier: 'every' | |
| filters: | | |
| code_changed: | |
| - "!**/*.md" | |
| - "!**/*.mdx" | |
| - "!website/**" | |
| document_changed: | |
| - "website/**" | |
| build-linux: | |
| name: Build Linux | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build-build.yml | |
| with: | |
| target: x86_64-unknown-linux-gnu | |
| profile: 'ci' | |
| runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} | |
| test-linux: | |
| name: Test Linux | |
| needs: [check-changed, build-linux] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build-test.yml | |
| with: | |
| target: x86_64-unknown-linux-gnu | |
| runner: '"ubuntu-22.04"' | |
| bench-rust: | |
| name: Rust Bench | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/bench-rust.yml | |
| with: | |
| target: x86_64-unknown-linux-gnu | |
| runner: '"ubuntu-22.04"' | |
| bench-rust-walltime: | |
| name: Rust Bench Walltime | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')) }} | |
| uses: ./.github/workflows/bench-rust.yml | |
| with: | |
| target: x86_64-unknown-linux-gnu | |
| measurement: walltime | |
| bench_target: walltime | |
| runner: '"physical-1-exclusive"' | |
| test-windows: | |
| name: Test Windows | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build.yml | |
| with: | |
| target: x86_64-pc-windows-msvc | |
| profile: 'ci' | |
| runner: ${{ vars.WINDOWS_SELF_HOSTED_RUNNER_LABELS || '"windows-latest"' }} | |
| test-runner: '"windows-latest"' | |
| test: true | |
| test-mac: | |
| name: Test Mac ARM64 | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build.yml | |
| with: | |
| target: aarch64-apple-darwin | |
| profile: 'ci' | |
| runner: ${{ vars.MAC_SELF_HOSTED_RUNNER_LABELS || '"macos-latest"' }} | |
| test-runner: ${{ '"macos-latest"' }} | |
| test: true | |
| build-wasm: | |
| name: Build WASM | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build-build.yml | |
| with: | |
| target: wasm32-wasip1-threads | |
| profile: 'ci' | |
| runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} | |
| test-wasm: | |
| name: Test WASM | |
| needs: [check-changed, build-wasm] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build-test.yml | |
| with: | |
| target: wasm32-wasip1-threads | |
| runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} | |
| build-riscv64: | |
| name: Build riscv64 | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build-build.yml | |
| with: | |
| target: riscv64gc-unknown-linux-gnu | |
| profile: 'ci' | |
| runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} | |
| build-ppc64: | |
| name: Build ppc64 | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build-build.yml | |
| with: | |
| target: powerpc64le-unknown-linux-gnu | |
| profile: 'ci' | |
| runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} | |
| build-s390x: | |
| name: Build s390x | |
| needs: [check-changed] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' }} | |
| uses: ./.github/workflows/reusable-build-build.yml | |
| with: | |
| target: s390x-unknown-linux-gnu | |
| profile: 'ci' | |
| runner: ${{ vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"' }} | |
| # TODO: Enable this job after Rspack portable cache is implemented. | |
| check-cache: | |
| name: Check Cache Portable | |
| needs: [test-linux, test-windows] | |
| if: ${{ false }} | |
| runs-on: ${{ fromJSON(vars.LINUX_SELF_HOSTED_RUNNER_LABELS || '"ubuntu-22.04"') }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Install Rust Toolchain | |
| uses: ./.github/actions/rustup | |
| with: | |
| key: test_cache | |
| save-if: true | |
| - name: Download linux cache | |
| uses: ./.github/actions/artifact/download | |
| with: | |
| name: testCase-persistentCache-linux | |
| path: ./cache-linux | |
| force-use-github-only: true | |
| - name: Download windows cache | |
| uses: ./.github/actions/artifact/download | |
| with: | |
| name: testCase-persistentCache-windows | |
| path: ./cache-windows | |
| force-use-github-only: true | |
| - name: Run compare kit | |
| run: cargo run -p rspack_tools -- compare ./cache-linux ./cache-windows | |
| 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: Test Required Check | |
| needs: | |
| [ | |
| build-linux, | |
| test-linux, | |
| test-windows, | |
| test-mac, | |
| build-wasm, | |
| build-riscv64, | |
| build-ppc64, | |
| build-s390x, | |
| test-wasm, | |
| check-changed, | |
| check-cache, | |
| ] | |
| if: ${{ always() && !cancelled() }} | |
| runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"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,success,success,success,success,success,success,success,skipped' }} | |
| run: echo "Test Failed" && exit 1 | |
| - name: No check to Run test | |
| run: echo "Success" | |
| size-limit: | |
| name: Binary Size Limit | |
| needs: [check-changed, build-linux] | |
| # On a PR this only comments (it is deliberately not part of Test Required Check). | |
| # On a trunk push it gates: exceeding the threshold fails the job, and with it the run. | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' && (github.event_name == 'pull_request' || (github.event_name == 'push' && github.repository == 'web-infra-dev/rspack')) }} | |
| uses: ./.github/workflows/size-limit.yml | |
| ecosystem_ci_per_commit: | |
| name: Run ecosystem CI per commit | |
| needs: [check-changed, build-linux] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| permissions: | |
| contents: write | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' && github.event_name == 'push' }} | |
| steps: | |
| - name: Trigger Ecosystem CI | |
| uses: rstackjs/rstack-ecosystem-ci/.github/actions/ecosystem_ci_per_commit@ecca2c865c3830f56824fe7a3c6513bac77f5c8f # v0.3.4 | |
| with: | |
| github-token: ${{ secrets.REPO_RSTACK_ECO_CI_GITHUB_TOKEN }} | |
| ecosystem-owner: web-infra-dev | |
| ecosystem-repo: rspack | |
| workflow-file: rspack-ecosystem-ci-from-commit.yml | |
| client-payload: '{"commitSHA":"${{ github.sha }}","updateComment":true,"repo":"web-infra-dev/rspack","suite":"-","suiteRefType":"precoded","suiteRef":"precoded","sourceRunId":"${{ github.run_id }}","sourceRepo":"web-infra-dev/rspack"}' | |
| upload-binary-size: | |
| name: Upload Binary Size | |
| needs: [check-changed, build-linux] | |
| if: ${{ needs.check-changed.outputs.code_changed == 'true' && github.event_name == 'push' && github.repository == 'web-infra-dev/rspack' }} | |
| runs-on: ${{ fromJSON(vars.CI_LINUX_MINI_RUNNER || '"ubuntu-latest"') }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - name: Download binding artifact | |
| uses: ./.github/actions/artifact/download | |
| with: | |
| name: bindings-x86_64-unknown-linux-gnu | |
| path: crates/node_binding/ | |
| # Must mirror size-limit.yml: the uploaded size is the baseline PRs compare against. | |
| - name: Strip binary | |
| run: strip crates/node_binding/rspack.linux-x64-gnu.node | |
| # github-script rather than `run: node`: this runner has no Node installed. | |
| - name: Upload binary size | |
| uses: actions/github-script@450193c5abd4cdb17ba9f3ffcfe8f635c4bb6c2a | |
| env: | |
| PERF_DATA_TOKEN: ${{ secrets.PERF_DATA_TOKEN }} | |
| with: | |
| script: | | |
| const upload = require('./.github/actions/binary-limit/upload-binary-size.js'); | |
| upload({ sha: context.sha, token: process.env.PERF_DATA_TOKEN }); | |
| # TODO: enable it after self hosted runners are ready | |
| # pkg-preview: | |
| # name: Pkg Preview | |
| # needs: | |
| # - test-linux | |
| # - test-windows | |
| # - cargo-deny | |
| # - lint | |
| # - rust_check | |
| # - rust_test | |
| # # after merged to main branch | |
| # if: ${{ !failure() && github.event_name == 'push' }} | |
| # uses: ./.github/workflows/preview-commit.yml |