Skip to content

Commit fd3c9a0

Browse files
committed
Try adding a workflow that is triggered on comments
1 parent a7ebd66 commit fd3c9a0

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This file defines a workflow that runs the libc++ benchmarks when a comment is added to the PR.
2+
#
3+
# The comment is of the form:
4+
#
5+
# /libcxx-bot benchmark <path-to-benchmarks-to-run>
6+
#
7+
# That will cause the specified benchmarks to be run on the PR and on the pull-request target, and
8+
# their results to be compared.
9+
name: Benchmark libc++
10+
on:
11+
issue_comment:
12+
types: [created, edited]
13+
schedule:
14+
# Run nightly at 08:00 UTC (aka 00:00 Pacific, aka 03:00 Eastern)
15+
- cron: '0 8 * * *'
16+
17+
permissions:
18+
contents: read # Default everything to read-only
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
benchmarks:
26+
if: |
27+
github.event.issue.pull_request # Ensure the comment is on a PR
28+
&& contains(github.event.comment.body, '/libcxx-bot benchmark')
29+
30+
runs-on: llvm-premerge-libcxx-next-runners # TODO: This should run on a dedicated set of machines
31+
steps:
32+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
33+
with:
34+
fetch-depth: 0
35+
fetch-tags: true # This job requires access to all the Git branches so it can diff against (usually) main
36+
37+
- uses: actions/setup-python@v6
38+
with:
39+
python-version: '3.10'
40+
41+
- name: Install dependencies
42+
run: |
43+
python3 -m venv .venv
44+
source .venv/bin/activate
45+
python -m pip install -r libcxx/utils/requirements.txt
46+
47+
- name: Extract benchmarks to run
48+
run: |
49+
BENCHMARKS=$(echo "${{ github.event.comment.body }}" | sed -n 's/\/libcxx-bot benchmark (.+)/\1/p')
50+
51+
- name: Run baseline
52+
run: |
53+
baseline_commit=$(git merge-base refs/remotes/origin/${GITHUB_BASE_REF} ${GITHUB_SHA})
54+
./libcxx/utils/test-at-commit --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${BENCHMARKS}
55+
env:
56+
CC: clang-22
57+
CXX: clang++-22
58+
59+
- name: Run candidate
60+
run: ./libcxx/utils/test-at-commit --commit ${GITHUB_SHA} -B build/candidate -- -sv -j1 --param optimization=speed ${BENCHMARKS}
61+
env:
62+
CC: clang-22
63+
CXX: clang++-22
64+
65+
- name: Compare baseline and candidate runs
66+
run: ./libcxx/utils/compare-benchmarks <(./libcxx/utils/consolidate-benchmarks build/baseline) \
67+
<(./libcxx/utils/consolidate-benchmarks build/candidate)

0 commit comments

Comments
 (0)