Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade bench workflow + trigger on '/benchmark' comment #228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
# According to:
# - https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#issue_comment
# - https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context
#
name: Benchmark PR

permissions:
contents: read
pull-requests: write

on: workflow_dispatch
on:
issue_comment:
types: [created]

jobs:
runBenchmark:
if: |
github.event.issue.pull_request &&
contains(github.event.comment.body, '/benchmark')
name: Criterion benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: boa-dev/criterion-compare-action@v3
- name: Checkout to init the repository
uses: actions/checkout@v4
- name: Get PR base branch name
run: |
branchName=$(curl -s https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} | python3 -c "import sys, json; print(json.load(sys.stdin)['base']['ref'])")
echo "branchName=$branchName" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Compares PR branch to target
uses: boa-dev/criterion-compare-action@v3
with:
branchName: ${{ github.base_ref }}
branchName: ${{ env.branchName }}
benchName: "bench_archive"
token: ${{ secrets.GITHUB_TOKEN }}
Loading