Skip to content

Run benchmarks from comment trigger #401

Run benchmarks from comment trigger

Run benchmarks from comment trigger #401

name: Run benchmarks from comment trigger
# https://dev.to/zirkelc/trigger-github-workflow-for-comment-on-pull-request-45l2
on:
issue_comment:
types: [created]
jobs:
benchmark:
if: github.event.issue.pull_request && contains(github.event.comment.body, '[benchmark]')
runs-on: ubuntu-latest
env:
JULIA_NUM_THREADS: 2
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v1
id: comment-branch
- name: Set latest commit status as pending
uses: myrotvorets/set-commit-status-action@master
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
status: pending
- name: Checkout PR branch
uses: actions/checkout@v3
with:
# https://github.com/actions/checkout/issues/331#issuecomment-1438220926
ref: refs/pull/${{ github.event.issue.number }}/head
- name: Setup Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- uses: julia-actions/setup-julia@latest
with:
version: 1
- name: Install dependencies
run: julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI@0.1"'
- name: Run benchmarks
run: julia -e 'using Pkg; using BenchmarkCI; BenchmarkCI.judge(; baseline="origin/main")'
- name: Post results
run: julia -e 'using BenchmarkCI; BenchmarkCI.postjudge()'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}