[libc++] Add a job that runs the benchmarks as part of the CI #1
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 file defines a workflow that runs the libc++ benchmarks when a comment is added to the PR. | ||
|
Check failure on line 1 in .github/workflows/libcxx-run-benchmarks.yml
|
||
| # | ||
| # The comment is of the form: | ||
| # | ||
| # /libcxx-bot benchmark <path-to-benchmarks-to-run> | ||
| # | ||
| # That will cause the specified benchmarks to be run on the PR and on the pull-request target, and | ||
| # their results to be compared. | ||
| name: Benchmark libc++ | ||
| on: | ||
| issue_comment: | ||
| types: [created, edited] | ||
| schedule: | ||
| # Run nightly at 08:00 UTC (aka 00:00 Pacific, aka 03:00 Eastern) | ||
| - cron: '0 8 * * *' | ||
| permissions: | ||
| contents: read # Default everything to read-only | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| benchmarks: | ||
| if: | | ||
| github.event.issue.pull_request # Ensure the comment is on a PR | ||
| && contains(github.event.comment.body, '/libcxx-bot benchmark') | ||
| runs-on: llvm-premerge-libcxx-next-runners # TODO: This should run on a dedicated set of machines | ||
| steps: | ||
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| fetch-tags: true # This job requires access to all the Git branches so it can diff against (usually) main | ||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.10' | ||
| - name: Install dependencies | ||
| run: | | ||
| python3 -m venv .venv | ||
| source .venv/bin/activate | ||
| python -m pip install -r libcxx/utils/requirements.txt | ||
| - name: Extract benchmarks to run | ||
| run: | | ||
| BENCHMARKS=$(echo "${{ github.event.comment.body }}" | sed -n 's/\/libcxx-bot benchmark (.+)/\1/p') | ||
| - name: Run baseline | ||
| run: | | ||
| baseline_commit=$(git merge-base refs/remotes/origin/${GITHUB_BASE_REF} ${GITHUB_SHA}) | ||
| ./libcxx/utils/test-at-commit --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${BENCHMARKS} | ||
| env: | ||
| CC: clang-22 | ||
| CXX: clang++-22 | ||
| - name: Run candidate | ||
| run: ./libcxx/utils/test-at-commit --commit ${GITHUB_SHA} -B build/candidate -- -sv -j1 --param optimization=speed ${BENCHMARKS} | ||
| env: | ||
| CC: clang-22 | ||
| CXX: clang++-22 | ||
| - name: Compare baseline and candidate runs | ||
| run: ./libcxx/utils/compare-benchmarks <(./libcxx/utils/consolidate-benchmarks build/baseline) \ | ||
| <(./libcxx/utils/consolidate-benchmarks build/candidate) | ||