mirror of
https://github.com/intel/llvm.git
synced 2026-01-31 16:29:50 +08:00
[libc++] Properly extract the PR head and base from the Github event
This commit is contained in:
47
.github/workflows/libcxx-run-benchmarks.yml
vendored
47
.github/workflows/libcxx-run-benchmarks.yml
vendored
@@ -21,9 +21,6 @@ on:
|
||||
env:
|
||||
CC: clang-22
|
||||
CXX: clang++-22
|
||||
COMMENT_BODY: ${{ github.event.comment.body }}
|
||||
PULL_REQUEST_HEAD: ${{ github.event.issue.pull_request.head.sha }}
|
||||
PULL_REQUEST_BASE: ${{ github.event.issue.pull_request.base.sha }}
|
||||
|
||||
jobs:
|
||||
run-benchmarks:
|
||||
@@ -33,12 +30,6 @@ jobs:
|
||||
|
||||
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:
|
||||
ref: ${PULL_REQUEST_HEAD}
|
||||
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'
|
||||
@@ -48,18 +39,42 @@ jobs:
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python -m pip install -r libcxx/utils/requirements.txt
|
||||
python -m pip install pygithub
|
||||
|
||||
- name: Extract information from the PR
|
||||
id: vars
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
cat <<EOF | python >> ${GITHUB_OUTPUT}
|
||||
import github
|
||||
repo = github.Github("${{ github.token }}").get_repo("${{ github.repository }}")
|
||||
pr = repo.get_pull(${{ github.event.issue.number }})
|
||||
print(f"pr_base={pr.base.sha}")
|
||||
print(f"pr_head={pr.head.sha}")
|
||||
EOF
|
||||
BENCHMARKS=$(echo "${{ github.event.comment.body }}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
|
||||
echo "benchmarks=${BENCHMARKS}" >> ${GITHUB_OUTPUT}
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
ref: ${{ steps.vars.outputs.pr_head }}
|
||||
fetch-depth: 0
|
||||
fetch-tags: true # This job requires access to all the Git branches so it can diff against (usually) main
|
||||
path: repo # Avoid nuking the workspace, where we have the Python virtualenv
|
||||
|
||||
- name: Run baseline
|
||||
run: |
|
||||
BENCHMARKS=$(echo "${COMMENT_BODY}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
|
||||
baseline_commit=$(git merge-base ${PULL_REQUEST_BASE} ${PULL_REQUEST_SHA})
|
||||
./libcxx/utils/test-at-commit --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${BENCHMARKS}
|
||||
source .venv/bin/activate
|
||||
baseline_commit=$(git -C repo merge-base ${{ steps.vars.outputs.pr_base }} ${{ steps.vars.outputs.pr_head }})
|
||||
./repo/libcxx/utils/test-at-commit --git-repo repo --commit ${baseline_commit} -B build/baseline -- -sv -j1 --param optimization=speed ${{ steps.vars.outputs.benchmarks }}
|
||||
|
||||
- name: Run candidate
|
||||
run: |
|
||||
BENCHMARKS=$(echo "${COMMENT_BODY}" | sed -nE 's/\/libcxx-bot benchmark (.+)/\1/p')
|
||||
./libcxx/utils/test-at-commit --commit ${PULL_REQUEST_SHA} -B build/candidate -- -sv -j1 --param optimization=speed ${BENCHMARKS}
|
||||
source .venv/bin/activate
|
||||
./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 }}
|
||||
|
||||
- name: Compare baseline and candidate runs
|
||||
run: ./libcxx/utils/compare-benchmarks <(./libcxx/utils/consolidate-benchmarks build/baseline) \
|
||||
<(./libcxx/utils/consolidate-benchmarks build/candidate)
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
./repo/libcxx/utils/compare-benchmarks <(./repo/libcxx/utils/consolidate-benchmarks build/baseline) \
|
||||
<(./repo/libcxx/utils/consolidate-benchmarks build/candidate)
|
||||
|
||||
Reference in New Issue
Block a user