rspack-ecosystem-ci-from-commit #15
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
| # integration tests for rspack ecosystem - run from pr comments | |
| name: rspack-ecosystem-ci-from-commit | |
| env: | |
| # 7 GiB by default on GitHub, setting to 6 GiB | |
| # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources | |
| NODE_OPTIONS: --max-old-space-size=6144 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| commitSHA: | |
| description: "commit sha" | |
| required: true | |
| type: string | |
| updateComment: | |
| description: "whether to update the PR comment" | |
| required: false | |
| type: boolean | |
| default: false | |
| repo: | |
| description: "rspack repository to use" | |
| required: true | |
| type: string | |
| default: "web-infra-dev/rspack" | |
| suite: | |
| description: "testsuite to run. runs all test suites when `-`." | |
| required: false | |
| type: choice | |
| options: | |
| - "-" | |
| - _selftest | |
| - modernjs | |
| - rspress | |
| - rslib | |
| - rstest | |
| - rsbuild | |
| - rsdoctor | |
| - examples | |
| - devserver | |
| - plugin | |
| - lynx-stack | |
| - rsbuild-rsc-plugin | |
| suiteRefType: | |
| description: "type of suite ref to use" | |
| required: true | |
| type: choice | |
| options: | |
| - precoded | |
| - branch | |
| - tag | |
| - commit | |
| default: "precoded" | |
| suiteRef: | |
| description: "suite ref to use" | |
| required: true | |
| type: string | |
| default: "precoded" | |
| sourceRunId: | |
| description: "workflow run ID from rspack CI that produced the binding artifact" | |
| required: false | |
| type: string | |
| default: "" | |
| sourceRepo: | |
| description: "rspack repository that produced the binding artifact" | |
| required: false | |
| type: string | |
| default: "web-infra-dev/rspack" | |
| jobs: | |
| get-runner-labels: | |
| name: Get Runner Labels | |
| uses: ./.github/workflows/get-runner-labels.yml | |
| prepare-binding: | |
| name: Prepare Rspack Binding | |
| needs: get-runner-labels | |
| runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Path A: download pre-built binding from rspack CI | |
| - name: Download binding from rspack CI | |
| if: inputs.sourceRunId != '' | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: bindings-x86_64-unknown-linux-gnu | |
| path: workspace/rspack-binding | |
| repository: ${{ inputs.sourceRepo }} | |
| run-id: ${{ inputs.sourceRunId }} | |
| github-token: ${{ secrets.RSPACK_REPO_ACTIONS_READ_ONLY }} | |
| - name: Upload normalized binding artifact | |
| if: inputs.sourceRunId != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binding-linux-x64-gnu | |
| path: workspace/rspack-binding/*.node | |
| # Path B: build binding from scratch (manual dispatch) | |
| - name: Build binding from scratch | |
| if: inputs.sourceRunId == '' | |
| uses: ./.github/actions/prepare-rspack-binding | |
| with: | |
| repository: ${{ inputs.repo }} | |
| ref: ${{ inputs.commitSHA }} | |
| execute-selected-suite: | |
| runs-on: ubuntu-latest | |
| needs: [get-runner-labels, prepare-binding] | |
| name: execute-all (${{ inputs.suite }}) | |
| if: "inputs.suite != '-'" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/build-rspack | |
| with: | |
| repository: ${{ inputs.repo }} | |
| ref: ${{ inputs.commitSHA }} | |
| - name: Setup Rust | |
| if: inputs.suite == 'lynx-stack' | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| - run: pnpm i --frozen-lockfile | |
| - name: Expose GitHub Runtime | |
| uses: crazy-max/ghaction-github-runtime@v3 | |
| # Verdaccio is required for rspack-stack testing. | |
| # pnpm has a known bug (pnpm/pnpm#9270) where file: protocol overrides | |
| # for packages with native optionalDependencies cause version mismatch | |
| # or silent registry fallback. Publishing to a local registry avoids this. | |
| - name: Setup Verdaccio | |
| if: inputs.suite != '_selftest' | |
| run: | | |
| pnpm verdaccio --config verdaccio.yaml & | |
| printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc | |
| sleep 3 | |
| - name: Publish rspack packages to Verdaccio | |
| if: inputs.suite != '_selftest' | |
| working-directory: workspace/rspack | |
| run: | | |
| pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/test-tools..." \ | |
| exec sh -c 'jq "del(.publishConfig.provenance)" package.json > package.json.tmp && mv package.json.tmp package.json' | |
| pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/test-tools..." \ | |
| publish --no-git-checks --provenance=false --access public --registry=http://localhost:4873 | |
| - name: Run suite (with Verdaccio) | |
| if: inputs.suite != '_selftest' | |
| run: >- | |
| NPM_CONFIG_REGISTRY=http://localhost:4873 | |
| pnpm tsx ecosystem-ci.ts | |
| run-suites | |
| --stack rspack | |
| --release "$(node -p "require('./workspace/rspack/packages/rspack/package.json').version")" | |
| --suite-${{ inputs.suiteRefType }} ${{ inputs.suiteRef }} | |
| ${{ inputs.suite }} | |
| - name: Run suite (selftest) | |
| if: inputs.suite == '_selftest' | |
| run: >- | |
| pnpm tsx ecosystem-ci.ts | |
| run-suites | |
| --stack rspack | |
| --suite-${{ inputs.suiteRefType }} ${{ inputs.suiteRef }} | |
| ${{ inputs.suite }} | |
| execute-all: | |
| needs: [get-runner-labels, prepare-binding] | |
| if: "inputs.suite == '-'" | |
| strategy: | |
| matrix: | |
| include: | |
| - suite: modernjs | |
| os: ubuntu-latest | |
| - suite: _selftest | |
| os: ubuntu-latest | |
| - suite: rsdoctor | |
| os: ubuntu-latest | |
| - suite: rspress | |
| os: ubuntu-latest | |
| - suite: rslib | |
| os: ubuntu-latest | |
| - suite: rstest | |
| os: ubuntu-latest | |
| - suite: rsbuild | |
| os: ubuntu-latest | |
| - suite: examples | |
| os: ubuntu-latest | |
| - suite: devserver | |
| os: ubuntu-latest | |
| - suite: plugin | |
| os: ubuntu-latest | |
| - suite: lynx-stack | |
| os: ubuntu-latest | |
| - suite: rsbuild-rsc-plugin | |
| os: ubuntu-latest | |
| fail-fast: false | |
| runs-on: ${{ matrix.os }} | |
| name: execute-all (${{ matrix.suite }}) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: moonrepo/setup-rust@v1 | |
| - uses: ./.github/actions/build-rspack | |
| with: | |
| repository: ${{ inputs.repo }} | |
| ref: ${{ inputs.commitSHA }} | |
| - run: pnpm i --frozen-lockfile | |
| - name: Expose GitHub Runtime | |
| uses: crazy-max/ghaction-github-runtime@v3 | |
| - name: Setup Verdaccio | |
| if: matrix.suite != '_selftest' | |
| run: | | |
| pnpm verdaccio --config verdaccio.yaml & | |
| printf '\n//localhost:4873/:_authToken="this-is-a-fake-token"\n' >> ~/.npmrc | |
| sleep 3 | |
| - name: Publish rspack packages to Verdaccio | |
| if: matrix.suite != '_selftest' | |
| working-directory: workspace/rspack | |
| run: | | |
| pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/test-tools..." \ | |
| exec sh -c 'jq "del(.publishConfig.provenance)" package.json > package.json.tmp && mv package.json.tmp package.json' | |
| pnpm -r --filter "@rspack/binding*..." --filter "@rspack/core..." --filter "@rspack/test-tools..." \ | |
| publish --no-git-checks --provenance=false --access public --registry=http://localhost:4873 | |
| - name: Run suite (with Verdaccio) | |
| if: matrix.suite != '_selftest' | |
| run: >- | |
| NPM_CONFIG_REGISTRY=http://localhost:4873 | |
| pnpm tsx ecosystem-ci.ts | |
| run-suites | |
| --stack rspack | |
| --release "$(node -p "require('./workspace/rspack/packages/rspack/package.json').version")" | |
| --suite-${{ inputs.suiteRefType }} ${{ inputs.suiteRef }} | |
| ${{ matrix.suite }} | |
| - name: Run suite (selftest) | |
| if: matrix.suite == '_selftest' | |
| run: >- | |
| pnpm tsx ecosystem-ci.ts | |
| run-suites | |
| --stack rspack | |
| --suite-${{ inputs.suiteRefType }} ${{ inputs.suiteRef }} | |
| ${{ matrix.suite }} |