Skip to content
Merged
Show file tree
Hide file tree
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
33 changes: 33 additions & 0 deletions .github/workflows/comment-perf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Post benchmark result on pull request

# This workflow can write to the PR. It must never execute PR author arbitrary
# code to prevent from leaking secrets.
# The pull_request_target trigger MUST NOT be used as it bypasses the
# requirement of maintainer approval of a PR from an outside contributor and
# it is executed in the context of the target repository, giving access to
# secrets.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this helps.

on:
workflow_run:
workflows: ["Performance"]
types: [completed]

jobs:
post-comment:
name: Post PR comment
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'}}
Comment thread
upils marked this conversation as resolved.
steps:
- name: Download comment
uses: actions/download-artifact@v4
with:
name: benchmark-report
path: benchmark-report.txt
github-token: ${{ secrets.ROCKSBOT_CHISEL_PR_COMMENTER }}
Comment thread
cjdcordeiro marked this conversation as resolved.
run-id: ${{ github.event.workflow_run.id }}

- name: Post message to PR
uses: mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8
with:
message-path: benchmark-report.txt
issue: ${{ github.event.workflow_run.pull_requests[0].number }}
repo-token: ${{ secrets.ROCKSBOT_CHISEL_PR_COMMENTER }}
16 changes: 10 additions & 6 deletions .github/workflows/performance.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Performance

# This workflow is decoupled from comment-perf.yaml to protect secrets.
# The benchmark test executes the chisel binary, so the PR author could execute
# arbitrary code in the runner. Hence, secrets MUST NOT be available to this
# workflow.
on:
pull_request_target:
pull_request:
branches: [main]

jobs:
Expand Down Expand Up @@ -37,8 +41,6 @@ jobs:
runs-on: ubuntu-22.04
needs: build
name: Benchmark chisel info (chisel-releases 24.04)
permissions:
pull-requests: write
steps:
- name: Download base
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -68,7 +70,9 @@ jobs:
chmod +x base head
hyperfine --export-markdown "$msg_file" "./base info --release ./chisel-releases 'python3.12_core'" -n "BASE" "./head info --release ./chisel-releases 'python3.12_core'" -n "HEAD"

- name: Post message to PR
uses: mshick/add-pr-comment@v2
- name: Upload result
Comment thread
upils marked this conversation as resolved.
uses: actions/upload-artifact@v4
with:
message-path: ${{ steps.benchmark.outputs.msg_file }}
name: benchmark-report
path: ${{ steps.benchmark.outputs.msg_file }}
Comment thread
upils marked this conversation as resolved.
retention-days: 1
Loading