fix: keep fork quality workflows running #317
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: Performance Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - release* | |
| - release/* | |
| - release-* | |
| workflow_dispatch: | |
| permissions: | |
| actions: read | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| performance: | |
| name: E2E Performance Tests | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| platform: Windows | |
| comment_header: perf-windows | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| platform: Linux | |
| comment_header: perf-linux | |
| - os: macos-latest | |
| target: x86_64-apple-darwin | |
| platform: macOS | |
| comment_header: perf-macos | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 | |
| - name: Post In-Progress Comment | |
| if: >- | |
| github.event_name == 'pull_request' && | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| continue-on-error: true | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 | |
| with: | |
| header: ${{ matrix.comment_header }} | |
| message: | | |
| ## Performance Report (${{ matrix.platform }}) :hourglass_flowing_sand: | |
| Running performance tests against baseline `${{ github.event.pull_request.base.sha }}`. | |
| - name: Set Python to PATH | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Validate Snapshot Comparator | |
| run: python -m unittest discover -s scripts/tests -p 'test_*.py' -v | |
| shell: bash | |
| - name: Add Conda to PATH (Windows) | |
| if: startsWith(matrix.os, 'windows') | |
| run: | | |
| $path = $env:PATH + ";" + $env:CONDA + "\condabin" | |
| echo "PATH=$path" >> $env:GITHUB_ENV | |
| - name: Add Conda to PATH (Ubuntu) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: echo "PATH=$PATH:$CONDA/condabin" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Install Conda + add to PATH (macOS) | |
| if: startsWith(matrix.os, 'macos') | |
| run: | | |
| curl -o ~/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh | |
| bash ~/miniconda.sh -b -p ~/miniconda | |
| echo "PATH=$PATH:$HOME/miniconda/bin" >> $GITHUB_ENV | |
| echo "CONDA=$HOME/miniconda" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Create test Conda environment | |
| run: conda create -n perf-test-env python=3.12 -y | |
| - name: Create test venv | |
| run: python -m venv .venv | |
| shell: bash | |
| - name: Rust Tool Chain setup | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Cargo Fetch | |
| run: cargo fetch | |
| shell: bash | |
| - name: Build Release | |
| run: cargo build --release --target ${{ matrix.target }} | |
| shell: bash | |
| - name: Run Performance Tests | |
| id: benchmark | |
| run: | | |
| set -o pipefail | |
| cargo test --release --features ci-perf --target ${{ matrix.target }} --test e2e_performance test_performance_summary -- --nocapture 2>&1 | tee perf-output.txt | |
| env: | |
| RUST_BACKTRACE: 1 | |
| RUST_LOG: warn | |
| shell: bash | |
| - name: Extract Performance Metrics | |
| if: steps.benchmark.outcome == 'success' | |
| run: | | |
| if ! grep -q "JSON metrics:" perf-output.txt; then | |
| echo "Performance test produced no JSON metrics" >&2 | |
| exit 1 | |
| fi | |
| sed -n '/JSON metrics:/,/^}/p' perf-output.txt | tail -n +2 > metrics.json | |
| python -m json.tool metrics.json > /dev/null | |
| cat metrics.json | |
| shell: bash | |
| - name: Wait for Exact PR Base Performance | |
| id: wait_for_base_performance | |
| if: always() && github.event_name == 'pull_request' | |
| run: >- | |
| python scripts/wait_for_baseline.py | |
| --repository "${{ github.repository }}" | |
| --workflow perf-baseline.yml | |
| --commit "${{ github.event.pull_request.base.sha }}" | |
| --artifact "perf-baseline-${{ matrix.os }}" | |
| --timeout-seconds 1200 | |
| --poll-seconds 20 | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| shell: bash | |
| - name: Download Exact PR Base Performance | |
| if: >- | |
| always() && github.event_name == 'pull_request' && | |
| steps.wait_for_base_performance.outcome == 'success' | |
| uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 | |
| with: | |
| workflow: perf-baseline.yml | |
| commit: ${{ github.event.pull_request.base.sha }} | |
| workflow_conclusion: success | |
| name: perf-baseline-${{ matrix.os }} | |
| path: baseline-perf | |
| check_artifacts: true | |
| search_artifacts: true | |
| - name: Download Main Performance for Manual Run | |
| if: always() && github.event_name == 'workflow_dispatch' | |
| uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 | |
| with: | |
| workflow: perf-baseline.yml | |
| branch: main | |
| workflow_conclusion: success | |
| name: perf-baseline-${{ matrix.os }} | |
| path: baseline-perf | |
| check_artifacts: true | |
| search_artifacts: true | |
| - name: Compare Performance Snapshot | |
| if: always() | |
| run: >- | |
| python scripts/quality_snapshot.py performance | |
| --current metrics.json | |
| --baseline baseline-perf/metrics.json | |
| --platform "${{ matrix.platform }}" | |
| --report performance-report.md | |
| --summary "$GITHUB_STEP_SUMMARY" | |
| shell: bash | |
| - name: Upload PR Performance Results | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: perf-pr-${{ matrix.os }} | |
| path: | | |
| metrics.json | |
| performance-report.md | |
| if-no-files-found: ignore | |
| - name: Post Performance Comment | |
| if: >- | |
| always() && github.event_name == 'pull_request' && | |
| github.event.pull_request.head.repo.full_name == github.repository | |
| continue-on-error: true | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 | |
| with: | |
| header: ${{ matrix.comment_header }} | |
| path: performance-report.md |