wip: python perf #42
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 Benchmarks (PR) | |
| on: | |
| pull_request: | |
| paths: | |
| - 'perf/**' | |
| - '.github/actions/detect-changed-impls/**' | |
| - '.github/actions/run-bash-perf-test/**' | |
| - '.github/workflows/perf-pr.yml' | |
| workflow_dispatch: | |
| inputs: | |
| test-select: | |
| description: 'Select specific implementations to test (pipe-separated substrings, e.g., "go|rust")' | |
| required: false | |
| default: '' | |
| type: string | |
| test-ignore: | |
| description: 'Ignore specific implementations (pipe-separated substrings)' | |
| required: false | |
| default: '~failing' | |
| type: string | |
| baseline-select: | |
| description: 'Select specific baseline tests (pipe-separated substrings)' | |
| required: false | |
| default: '' | |
| type: string | |
| baseline-ignore: | |
| description: 'Ignore specific baseline tests (pipe-separated substrings)' | |
| required: false | |
| default: '~failing' | |
| type: string | |
| iterations: | |
| description: 'Number of iterations per test' | |
| required: false | |
| default: 10 | |
| type: number | |
| force-matrix-rebuild: | |
| description: 'Force test matrix regeneration (bypass cache)' | |
| required: false | |
| default: false | |
| type: boolean | |
| force-image-rebuild: | |
| description: 'Force Docker image rebuilds (bypass cache)' | |
| required: false | |
| default: false | |
| type: boolean | |
| debug: | |
| description: 'Enable debug mode (sets DEBUG=true in test containers)' | |
| required: false | |
| default: false | |
| type: boolean | |
| snapshot: | |
| description: 'Create and upload test snapshot for debugging' | |
| required: false | |
| default: true | |
| type: boolean | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| resolve-parameters: | |
| runs-on: [self-hosted, linux, x64, ephemeral] | |
| outputs: | |
| test-select: ${{ steps.resolve.outputs.test-select }} | |
| test-ignore: ${{ steps.resolve.outputs.test-ignore }} | |
| baseline-select: ${{ steps.resolve.outputs.baseline-select }} | |
| baseline-ignore: ${{ steps.resolve.outputs.baseline-ignore }} | |
| iterations: ${{ steps.resolve.outputs.iterations }} | |
| force-matrix-rebuild: ${{ steps.resolve.outputs.force-matrix-rebuild }} | |
| force-image-rebuild: ${{ steps.resolve.outputs.force-image-rebuild }} | |
| debug: ${{ steps.resolve.outputs.debug }} | |
| snapshot: ${{ steps.resolve.outputs.snapshot }} | |
| should-run-tests: ${{ steps.resolve.outputs.should-run-tests }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changed implementations | |
| if: github.event_name != 'workflow_dispatch' | |
| id: detect | |
| uses: ./.github/actions/detect-changed-impls | |
| with: | |
| test-type: perf | |
| - name: Resolve parameters | |
| id: resolve | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| # Manual trigger - use workflow inputs | |
| echo "test-select=${{ github.event.inputs.test-select }}" >> $GITHUB_OUTPUT | |
| echo "test-ignore=${{ github.event.inputs.test-ignore }}" >> $GITHUB_OUTPUT | |
| echo "baseline-select=${{ github.event.inputs.baseline-select }}" >> $GITHUB_OUTPUT | |
| echo "baseline-ignore=${{ github.event.inputs.baseline-ignore }}" >> $GITHUB_OUTPUT | |
| echo "iterations=${{ github.event.inputs.iterations }}" >> $GITHUB_OUTPUT | |
| echo "force-matrix-rebuild=${{ github.event.inputs.force-matrix-rebuild }}" >> $GITHUB_OUTPUT | |
| echo "force-image-rebuild=${{ github.event.inputs.force-image-rebuild }}" >> $GITHUB_OUTPUT | |
| echo "debug=${{ github.event.inputs.debug }}" >> $GITHUB_OUTPUT | |
| echo "snapshot=${{ github.event.inputs.snapshot }}" >> $GITHUB_OUTPUT | |
| echo "should-run-tests=true" >> $GITHUB_OUTPUT | |
| echo "→ Manual trigger: using workflow inputs" | |
| else | |
| # Automatic trigger - use change detection outputs | |
| echo "test-select=${{ steps.detect.outputs.changed-impls }}" >> $GITHUB_OUTPUT | |
| # Negate each implementation ID in the pipe-separated list | |
| # Always include ~failing to skip known-broken tests | |
| CHANGED_IMPLS="${{ steps.detect.outputs.changed-impls }}" | |
| if [ -n "$CHANGED_IMPLS" ]; then | |
| NEGATED_IMPLS=$(echo "$CHANGED_IMPLS" | sed 's/|/|!/g;s/^/!/') | |
| echo "test-ignore=~failing|$NEGATED_IMPLS" >> $GITHUB_OUTPUT | |
| else | |
| echo "test-ignore=~failing" >> $GITHUB_OUTPUT | |
| fi | |
| echo "baseline-select=${{ steps.detect.outputs.changed-baselines }}" >> $GITHUB_OUTPUT | |
| # Negate each baseline ID in the pipe-separated list | |
| # Always include ~failing to skip known-broken baselines | |
| CHANGED_BASELINES="${{ steps.detect.outputs.changed-baselines }}" | |
| if [ -n "$CHANGED_BASELINES" ]; then | |
| NEGATED_BASELINES=$(echo "$CHANGED_BASELINES" | sed 's/|/|!/g;s/^/!/') | |
| echo "baseline-ignore=~failing|$NEGATED_BASELINES" >> $GITHUB_OUTPUT | |
| else | |
| echo "baseline-ignore=~failing" >> $GITHUB_OUTPUT | |
| fi | |
| echo "iterations=10" >> $GITHUB_OUTPUT | |
| echo "force-matrix-rebuild=${{ steps.detect.outputs.impls-yaml-changed }}" >> $GITHUB_OUTPUT | |
| # Force image rebuild if images.yaml changed (commit SHA changes require new images) | |
| # or if images folder changed (local implementation files changed) | |
| if [ "${{ steps.detect.outputs.impls-yaml-changed }}" = "true" ] || [ "${{ steps.detect.outputs.images-folder-changed }}" = "true" ]; then | |
| echo "force-image-rebuild=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "force-image-rebuild=false" >> $GITHUB_OUTPUT | |
| fi | |
| echo "debug=false" >> $GITHUB_OUTPUT | |
| echo "snapshot=true" >> $GITHUB_OUTPUT | |
| echo "should-run-tests=${{ steps.detect.outputs.has-changes }}" >> $GITHUB_OUTPUT | |
| echo "→ Automatic trigger: using change detection outputs" | |
| fi | |
| run-tests: | |
| needs: resolve-parameters | |
| if: needs.resolve-parameters.outputs.should-run-tests == 'true' | |
| runs-on: [self-hosted, linux, x64, ephemeral] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run perf benchmarks | |
| uses: ./.github/actions/run-bash-perf-test | |
| with: | |
| test-select: '${{ needs.resolve-parameters.outputs.test-select }}' | |
| test-ignore: '${{ needs.resolve-parameters.outputs.test-ignore }}' | |
| baseline-select: '${{ needs.resolve-parameters.outputs.baseline-select }}' | |
| baseline-ignore: '${{ needs.resolve-parameters.outputs.baseline-ignore }}' | |
| iterations: '${{ needs.resolve-parameters.outputs.iterations }}' | |
| cache-dir: /srv/cache | |
| snapshot: ${{ needs.resolve-parameters.outputs.snapshot }} | |
| force-matrix-rebuild: ${{ needs.resolve-parameters.outputs.force-matrix-rebuild }} | |
| force-image-rebuild: ${{ needs.resolve-parameters.outputs.force-image-rebuild }} | |
| debug: ${{ needs.resolve-parameters.outputs.debug }} |