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
| # This workflow runs a Criterion benchmark on a PR and compares the results against the base branch. | |
| # It is triggered on a PR or a push to main. | |
| # | |
| # The workflow is gated on the presence of the "performance" label on the PR. | |
| # | |
| # The workflow runs on a self-hosted runner pool. We can't use the shared runners for this, | |
| # because they are only permitted to run on the default branch to preserve resources. | |
| # | |
| # In the future, we might like to consider using bencher.dev or the framework used by otel-golang here. | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - dependabot/scottgerring/benchmark-fix | |
| name: benchmark pull requests | |
| permissions: | |
| contents: read | |
| jobs: | |
| runBenchmark: | |
| name: run benchmark | |
| permissions: | |
| pull-requests: write | |
| # If we're running on a PR, use ubuntu-latest - a shared runner. We can't use the self-hosted | |
| # runners on arbitrary PRs, and we don't want to unleash that load on the pool anyway. | |
| # If we're running on main, use the OTEL self-hosted runner pool. | |
| # | |
| # TODO - temporarily use self-hosted to get shared-worker environment going | |
| runs-on: 'oracle-bare-metal-64cpu-512gb-x86-64' | |
| # runs-on: ${{ github.event_name == 'pull_request' && 'ubuntu-latest' || 'self-hosted' }} | |
| if: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'performance')) || github.event_name == 'push' }} | |
| container: | |
| image: rust:slim-bullseye | |
| env: | |
| # For PRs, compare against the base branch - e.g., 'main'. | |
| # For pushes to main, compare against the previous commit | |
| BRANCH_NAME: ${{ github.event_name == 'pull_request' && github.base_ref || github.event.before }} | |
| GIT_DISCOVERY_ACROSS_FILESYSTEM: 1 | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 | |
| with: | |
| egress-policy: audit | |
| - name: Setup container environment | |
| run: | | |
| apt-get update && apt-get install --fix-missing -y unzip cmake build-essential pkg-config curl git | |
| cargo install cargo-criterion | |
| - name: Make repo safe for Git inside container | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 # Fetch full history for git-based tools | |
| - name: Run benchmark | |
| run: | | |
| cargo bench | |
| echo 'Benchmark run complete' | |
| - name: Debug Git state (optional) | |
| run: | | |
| echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" | |
| ls -alh "$GITHUB_WORKSPACE/.git" || echo ".git not found" | |
| git rev-parse HEAD || echo "Not a git repo" | |
| - uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 | |
| with: | |
| toolchain: stable | |
| - uses: boa-dev/criterion-compare-action@adfd3a94634fe2041ce5613eb7df09d247555b87 # v3.2.4 | |
| with: | |
| cwd: opentelemetry-appender-tracing # TEMP - make the run shorter for now | |
| branchName: ${{ env.BRANCH_NAME }} |