Skip to content

Commit 69ea028

Browse files
committed
ci: add benchmark workflow
1 parent 314e5a3 commit 69ea028

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

.github/workflows/bench.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Benchmark
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: write
12+
deployments: write
13+
pull-requests: write
14+
15+
jobs:
16+
benchmark:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-go@v4
21+
with:
22+
go-version: stable
23+
24+
- name: Run benchmark
25+
run: go test ./... -benchmem -bench ^Benchmark -benchtime=300000x | tee bench.log
26+
27+
- name: Check benchmark result
28+
uses: benchmark-action/github-action-benchmark@v1
29+
with:
30+
name: Go Benchmark
31+
tool: go
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
output-file-path: bench.log
34+
alert-threshold: '200%'
35+
comment-on-alert: true
36+
fail-on-alert: true
37+
summary-always: true
38+
alert-comment-cc-users: '@pulsejet'
39+
40+
- name: Store benchmark result
41+
uses: benchmark-action/github-action-benchmark@v1
42+
if: github.event_name != 'pull_request'
43+
with:
44+
name: Go Benchmark
45+
tool: go
46+
output-file-path: bench.log
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
auto-push: true
49+
fail-on-alert: true

.github/workflows/build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [ubuntu-22.04, ubuntu-24.04,
16-
macos-13, macos-14,
17-
windows-2022]
15+
os: [ubuntu-latest, macos-latest, windows-latest]
1816
fail-fast: false
1917
steps:
2018
- name: Checkout repository

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: lint
22
on:
33
push:
4+
branches: ["main"]
45
pull_request:
56

67
jobs:

0 commit comments

Comments
 (0)