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: | |
cpu-benchmark: | |
name: run fibonacci benchmark | |
runs-on: ubuntu-latest | |
if: | |
github.event.issue.pull_request | |
&& github.event.issue.state == 'open' | |
&& contains(github.event.comment.body, '!benchmark') | |
&& (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') | |
steps: | |
- 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 | |
- name: Install dependencies | |
run: sudo apt-get install -y pkg-config libssl-dev | |
- uses: dtolnay/rust-toolchain@stable | |
- run: which cargo | |
- uses: Swatinem/rust-cache@v2 | |
- name: Load env vars | |
run: | | |
set -a | |
source bench.env | |
set +a | |
echo "LURK_BENCH_OUTPUT=pr-comment" >> $GITHUB_ENV | |
env | grep 'LURK' | |
working-directory: ${{ github.workspace }}/benches | |
# Run the comparative benchmark and comment output on the PR | |
- uses: boa-dev/criterion-compare-action@v3 | |
with: | |
# Optional. Compare only this benchmark target | |
benchName: "fibonacci" | |
# Needed. The name of the branch to compare with | |
branchName: ${{ github.ref_name }} | |
gpu-benchmark: | |
name: run fibonacci benchmark on GPU | |
runs-on: [self-hosted, gpu-bench] | |
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') | |
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 | |
- 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 | |
- run: rustup show | |
- run: | | |
echo "PATH=${PATH}:/root/.cargo/bin" | tee -a $GITHUB_PATH | |
echo $GITHUB_PATH | |
echo $PATH | |
- run: | | |
which cargo | |
which rustc | |
which rustup | |
- run: rustc -vV | |
- run: cargo --version | |
- run: echo $PATH | |
- run: cargo check | |
- run: cargo install critcmp | |
- uses: Swatinem/rust-cache@v2 | |
- name: Load env vars | |
run: | | |
echo "LURK_BENCH_OUTPUT=pr-comment" >> $GITHUB_ENV | |
working-directory: ${{ github.workspace }}/benches | |
- uses: cardinalby/export-env-action@v2 | |
with: | |
envFile: 'benches/bench.env' | |
expand: true | |
# 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: "fibonacci" | |
# Needed. The name of the branch to compare with | |
branchName: ${{ github.ref_name }} |