21
21
env :
22
22
CC : clang-22
23
23
CXX : clang++-22
24
- COMMENT_BODY : ${{ github.event.comment.body }}
25
- PULL_REQUEST_HEAD : ${{ github.event.issue.pull_request.head.sha }}
26
- PULL_REQUEST_BASE : ${{ github.event.issue.pull_request.base.sha }}
27
24
28
25
jobs :
29
26
run-benchmarks :
33
30
34
31
runs-on : llvm-premerge-libcxx-next-runners # TODO: This should run on a dedicated set of machines
35
32
steps :
36
- - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
37
- with :
38
- ref : ${PULL_REQUEST_HEAD}
39
- fetch-depth : 0
40
- fetch-tags : true # This job requires access to all the Git branches so it can diff against (usually) main
41
-
42
33
- uses : actions/setup-python@v6
43
34
with :
44
35
python-version : ' 3.10'
@@ -48,18 +39,42 @@ jobs:
48
39
python3 -m venv .venv
49
40
source .venv/bin/activate
50
41
python -m pip install -r libcxx/utils/requirements.txt
42
+ python -m pip install pygithub
43
+
44
+ - name : Extract information from the PR
45
+ id : vars
46
+ run : |
47
+ source .venv/bin/activate
48
+ cat <<EOF | python >> ${GITHUB_OUTPUT}
49
+ import github
50
+ repo = github.Github("${{ github.token }}").get_repo("${{ github.repository }}")
51
+ pr = repo.get_pull(${{ github.event.issue.number }})
52
+ print(f"pr_base={pr.base.sha}")
53
+ print(f"pr_head={pr.head.sha}")
54
+ EOF
55
+ BENCHMARKS=$(echo "${{ github.event.comment.body }}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
56
+ echo "benchmarks=${BENCHMARKS}" >> ${GITHUB_OUTPUT}
57
+
58
+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
59
+ with :
60
+ ref : ${{ steps.vars.outputs.pr_head }}
61
+ fetch-depth : 0
62
+ fetch-tags : true # This job requires access to all the Git branches so it can diff against (usually) main
63
+ path : repo # Avoid nuking the workspace, where we have the Python virtualenv
51
64
52
65
- name : Run baseline
53
66
run : |
54
- BENCHMARKS=$(echo "${COMMENT_BODY}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
55
- baseline_commit=$(git merge-base ${PULL_REQUEST_BASE} ${PULL_REQUEST_SHA })
56
- ./libcxx/utils/test-at-commit --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${BENCHMARKS }
67
+ source .venv/bin/activate
68
+ baseline_commit=$(git -C repo merge-base ${{ steps.vars.outputs.pr_base }} ${{ steps.vars.outputs.pr_head } })
69
+ ./repo/ libcxx/utils/test-at-commit --git-repo repo -- commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${{ steps.vars.outputs.benchmarks } }
57
70
58
71
- name : Run candidate
59
72
run : |
60
- BENCHMARKS=$(echo "${COMMENT_BODY}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
61
- ./libcxx/utils/test-at-commit --commit ${PULL_REQUEST_SHA} -B build/candidate -- -sv -j1 --param optimization=speed ${BENCHMARKS }
73
+ source .venv/bin/activate
74
+ ./repo/ libcxx/utils/test-at-commit --git-repo repo -- commit ${{ steps.vars.outputs.pr_head }} -B build/candidate -- -sv -j1 --param optimization=speed ${{ steps.vars.outputs.benchmarks } }
62
75
63
76
- name : Compare baseline and candidate runs
64
- run : ./libcxx/utils/compare-benchmarks <(./libcxx/utils/consolidate-benchmarks build/baseline) \
65
- <(./libcxx/utils/consolidate-benchmarks build/candidate)
77
+ run : |
78
+ source .venv/bin/activate
79
+ ./repo/libcxx/utils/compare-benchmarks <(./repo/libcxx/utils/consolidate-benchmarks build/baseline) \
80
+ <(./repo/libcxx/utils/consolidate-benchmarks build/candidate)
0 commit comments