Test PR comment #70
This file contains 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
# Creates a PR benchmark comment with a comparison to master | ||
name: Benchmark pull requests | ||
on: | ||
issue_comment: | ||
types: [created] | ||
env: | ||
CARGO_TERM_COLOR: always | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
setup: | ||
name: Set up benchmark parameters | ||
runs-on: ubuntu-latest | ||
if: | ||
github.event.issue.pull_request | ||
&& github.event.issue.state == 'open' | ||
&& contains(github.event.comment.body, '!gpu-benchmark') | ||
&& (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') | ||
outputs: | ||
benches: ${{ steps.get-benches.outputs.benches }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: lurk-lab/ci-workflows | ||
- uses: ./.github/actions/gpu-setup | ||
with: | ||
gpu-framework: 'cuda' | ||
- uses: ./.github/actions/ci-env | ||
# Get base branch of the PR | ||
- uses: xt0rted/pull-request-comment-branch@v2 | ||
id: comment-branch | ||
- uses: actions/checkout@v4 | ||
- name: Checkout PR branch | ||
run: gh pr checkout $PR_NUMBER | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
PR_NUMBER: ${{ github.event.issue.number }} | ||
# Install dependencies | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: Load env vars | ||
id: get-benches | ||
run: | | ||
echo "LURK_BENCH_OUTPUT=pr-comment" | tee -a $GITHUB_ENV | ||
printf "${{ github.event.comment.body }}" > comment.txt | ||
BENCHES=$(awk '/Benches:/{f=1;next} /Features:/{f=0} f{print $0}' comment.txt) | ||
FEATURES=$(awk '/Features:/{f=1;next} /Env vars:/{f=0} f{print $0}' comment.txt) | ||
ENV_VARS=$(awk '/Env vars:/{f=1;next} /$EOF:/{f=0} f{print $0}' comment.txt) | ||
for var in $ENV_VARS | ||
do | ||
echo $var | tee -a $GITHUB_ENV | ||
done | ||
echo $BENCHES | ||
echo "benches=[\"fibonacci\"]" | tee -a $GITHUB_OUTPUT | ||
echo "FEATURES=$FEATURES" | tee -a $GITHUB_ENV | ||
gpu-benchmark: | ||
needs: [ setup ] | ||
runs-on: [self-hosted, gpu-bench] | ||
strategy: | ||
matrix: | ||
value: ${{ fromJSON(needs.setup.outputs.benches }} | ||
Check failure on line 69 in .github/workflows/pr-comment.yml
|
||
steps: | ||
- run: echo "${{ matrix.value }}" | ||
# Run the comparative benchmark and comment output on the PR | ||
- uses: boa-dev/criterion-compare-action@v3 | ||
with: | ||
# Note: Removing `benchName` causes `criterion` errors: https://github.com/boa-dev/criterion-compare-action#troubleshooting | ||
# Optional. Compare only this benchmark target | ||
benchName: ${{ matrix.value }} | ||
# Optional. Features activated in the benchmark | ||
features: "cuda,${{ env.FEATURES }}" | ||
# Needed. The name of the branch to compare with | ||
branchName: ${{ steps.comment-branch.outputs.base_ref }} |