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

allows benchmark results to be commented securely even from forks #181

Merged
merged 1 commit into from
Apr 30, 2021
Merged
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
36 changes: 11 additions & 25 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:

jobs:
benchmark:
performance-tracking:
runs-on: ubuntu-latest
steps:
# setup
Expand All @@ -16,7 +16,7 @@ jobs:
- name: install dependencies
run: julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI@0.1"'

# benchmark
# run the benchmark suite
- name: run benchmarks
run: |
julia -e '
Expand All @@ -25,9 +25,8 @@ jobs:
BenchmarkCI.displayjudgement()
'

# generate result markdown
# generate and record the benchmark result as markdown
- name: generate benchmark result
id: generate-result-markdown
run: |
body=$(julia -e '
using BenchmarkCI
Expand All @@ -42,27 +41,14 @@ jobs:
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo ::set-output name=body::$body
echo $body > ./benchmark-result.artifact

# check if the previous comment exists
- name: find comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: JET Benchmark Result
# record the pull request number
- name: record pull request number
run: echo ${{ github.event.pull_request.number }} > ./pull-request-number.artifact

# create/update comment
- name: create comment
if: ${{ steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.generate-result-markdown.outputs.body }}
- name: update comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@v1
# save as artifacts (performance tracking (comment) workflow will use it)
- uses: actions/upload-artifact@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: ${{ steps.generate-result-markdown.outputs.body }}
name: perforamance-tracking
path: ./*.artifact