Skip to content

Commit

Permalink
Split into two workflows
Browse files Browse the repository at this point in the history
One workflow generates the report and publishes it on commits to main. The other attempts only to comment on PRs.
  • Loading branch information
mhutchinson committed Dec 10, 2024
1 parent 3ffe21f commit 66b73d4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/benchmark-go-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Benchmark Go

on:
push:
branches:
- main

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write

jobs:
benchmark:
name: Performance regression check
runs-on: ubuntu-latest
steps:
- name: Fetch Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.1.0
with:
go-version-file: go.mod

- name: Run benchmark
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
with:
tool: 'go'
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "150%"
fail-on-alert: true
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
name: Benchmark Go

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
# allow posting comments to pull request
pull-requests: write

Expand All @@ -38,7 +31,6 @@ jobs:
tool: 'go'
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "150%"
fail-on-alert: true
comment-on-alert: true # notify on PR if alert triggers
Expand Down

0 comments on commit 66b73d4

Please sign in to comment.