refactor: update benchmark config and remove PR workflows #1
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: Benchmarks | |
| # Runs benchmarks to track performance and detect regressions. | |
| # - On push to main: automatically updates baseline in Bencher | |
| # - On manual dispatch: run specific benchmarks on-demand | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| # Only run benchmarks if relevant code changes | |
| - "src/**" | |
| - "benches/**" | |
| - "Cargo.toml" | |
| - "Cargo.lock" | |
| workflow_dispatch: | |
| inputs: | |
| benchmark: | |
| description: "Benchmark to run" | |
| required: true | |
| default: "all" | |
| type: choice | |
| options: | |
| - all | |
| - historic_scanning | |
| - latest_events_scanning | |
| permissions: | |
| contents: read | |
| checks: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # Run historic benchmarks | |
| benchmark_historic: | |
| name: Run Historic Benchmarks | |
| runs-on: ubuntu-latest | |
| # Run on push to main, or when manually selecting 'all' or 'historic_scanning' | |
| if: ${{ github.event_name == 'push' || inputs.benchmark == 'all' || inputs.benchmark == 'historic_scanning' }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf /usr/local/lib/android | |
| df -h | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | |
| - name: Install Foundry (Anvil) | |
| uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0 | |
| - name: Install Bencher CLI | |
| uses: bencherdev/bencher@main | |
| - name: Run historic benchmarks and track with Bencher | |
| env: | |
| BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} | |
| BENCHER_PROJECT: ${{ vars.BENCHER_PROJECT }} | |
| run: | | |
| bencher run \ | |
| --project "$BENCHER_PROJECT" \ | |
| --token "$BENCHER_API_TOKEN" \ | |
| --branch main \ | |
| --testbed ubuntu-latest \ | |
| --threshold-measure latency \ | |
| --threshold-test t_test \ | |
| --threshold-max-sample-size 64 \ | |
| --threshold-upper-boundary 0.99 \ | |
| --thresholds-reset \ | |
| --err \ | |
| --adapter rust_criterion \ | |
| --github-actions "${{ secrets.GITHUB_TOKEN }}" \ | |
| "cargo bench --manifest-path benches/Cargo.toml --bench historic_scanning" | |
| # Run latest events benchmarks | |
| benchmark_latest: | |
| name: Run Latest Events Benchmarks | |
| runs-on: ubuntu-latest | |
| # Run on push to main, or when manually selecting 'all' or 'latest_events_scanning' | |
| if: ${{ github.event_name == 'push' || inputs.benchmark == 'all' || inputs.benchmark == 'latest_events_scanning' }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf "/usr/local/share/boost" | |
| sudo rm -rf /usr/local/lib/android | |
| df -h | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Install Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c # v1.15.2 | |
| - name: Install Foundry (Anvil) | |
| uses: foundry-rs/foundry-toolchain@8b0419c685ef46cb79ec93fbdc131174afceb730 # v1.6.0 | |
| - name: Install Bencher CLI | |
| uses: bencherdev/bencher@main | |
| - name: Run latest events benchmarks and track with Bencher | |
| env: | |
| BENCHER_API_TOKEN: ${{ secrets.BENCHER_API_TOKEN }} | |
| BENCHER_PROJECT: ${{ vars.BENCHER_PROJECT }} | |
| run: | | |
| bencher run \ | |
| --project "$BENCHER_PROJECT" \ | |
| --token "$BENCHER_API_TOKEN" \ | |
| --branch "${{ github.ref_name }}" \ | |
| --testbed ubuntu-latest \ | |
| --threshold-measure latency \ | |
| --threshold-test t_test \ | |
| --threshold-max-sample-size 64 \ | |
| --threshold-upper-boundary 0.99 \ | |
| --thresholds-reset \ | |
| --err \ | |
| --adapter rust_criterion \ | |
| --github-actions "${{ secrets.GITHUB_TOKEN }}" \ | |
| "cargo bench --manifest-path benches/Cargo.toml --bench latest_events_scanning" |