Version Packages #205
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: Runtime performance | |
| on: | |
| pull_request: | |
| concurrency: | |
| group: runtime-performance-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| required: ${{ steps.classify.outputs.runtime_performance }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - id: classify | |
| run: >- | |
| node scripts/ci-changes.mjs | |
| --base ${{ github.event.pull_request.base.sha }} | |
| --head ${{ github.event.pull_request.head.sha }} | |
| --github-output "$GITHUB_OUTPUT" | |
| measure: | |
| needs: changes | |
| if: needs.changes.outputs.required == 'true' | |
| name: runtime-performance measurement | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - name: Check out base | |
| uses: actions/checkout@v7 | |
| with: | |
| path: base | |
| ref: ${{ github.event.pull_request.base.sha }} | |
| - name: Check out pull request | |
| uses: actions/checkout@v7 | |
| with: | |
| path: head | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: pnpm/action-setup@v6 | |
| with: | |
| package_json_file: head/package.json | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| cache-dependency-path: | | |
| base/pnpm-lock.yaml | |
| head/pnpm-lock.yaml | |
| - name: Install and build pull request | |
| run: | | |
| pnpm --dir head install --frozen-lockfile | |
| pnpm --dir head build | |
| - name: Install and build base | |
| run: | | |
| pnpm --dir base install --frozen-lockfile | |
| pnpm --dir base build | |
| - name: Measure base and pull request | |
| id: benchmark | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| reports="$RUNNER_TEMP/runtime-performance" | |
| harness="$GITHUB_WORKSPACE/head/scripts/runtime-performance.mjs" | |
| mkdir -p "$reports/base" "$reports/head" | |
| measure() { | |
| local checkout="$1" | |
| local output="$2" | |
| ( | |
| cd "$checkout" | |
| EFFECT_MACHINE_BENCHMARK_ROOT="$PWD" node --expose-gc "$harness" --json | |
| ) > "$output" | |
| } | |
| measure base "$reports/base/1.json" | |
| measure head "$reports/head/1.json" | |
| measure head "$reports/head/2.json" | |
| measure base "$reports/base/2.json" | |
| measure base "$reports/base/3.json" | |
| measure head "$reports/head/3.json" | |
| measure head "$reports/head/4.json" | |
| measure base "$reports/base/4.json" | |
| measure base "$reports/base/5.json" | |
| measure head "$reports/head/5.json" | |
| if ! node head/scripts/compare-runtime-performance.mjs \ | |
| --check \ | |
| "$reports/base" \ | |
| "$reports/head" \ | |
| > "$RUNNER_TEMP/runtime-performance-report.md"; then | |
| cat "$RUNNER_TEMP/runtime-performance-report.md" >> "$GITHUB_STEP_SUMMARY" | |
| exit 1 | |
| fi | |
| cat "$RUNNER_TEMP/runtime-performance-report.md" >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload report for the comment workflow | |
| if: always() && steps.benchmark.outcome != 'skipped' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: runtime-performance-report | |
| path: ${{ runner.temp }}/runtime-performance | |
| if-no-files-found: error | |
| retention-days: 7 | |
| runtime-performance: | |
| if: always() | |
| needs: [changes, measure] | |
| name: runtime-performance | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Require relevant runtime performance to pass | |
| env: | |
| CHANGE_RESULT: ${{ needs.changes.result }} | |
| MEASUREMENT_REQUIRED: ${{ needs.changes.outputs.required }} | |
| MEASUREMENT_RESULT: ${{ needs.measure.result }} | |
| run: | | |
| test "$CHANGE_RESULT" = "success" | |
| if test "$MEASUREMENT_REQUIRED" = "true"; then | |
| test "$MEASUREMENT_RESULT" = "success" | |
| else | |
| test "$MEASUREMENT_RESULT" = "skipped" | |
| echo "Runtime performance is not affected by this pull request." >> "$GITHUB_STEP_SUMMARY" | |
| fi |