-
Notifications
You must be signed in to change notification settings - Fork 1.1k
50 lines (49 loc) · 1.62 KB
/
benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Benchmark
on:
push:
branches:
- main
workflow_dispatch:
env:
DEFAULT_GO_VERSION: "~1.23.0"
jobs:
benchmark:
name: Benchmarks
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.DEFAULT_GO_VERSION }}
check-latest: true
cache-dependency-path: "**/go.sum"
- name: Run benchmarks
run: make benchmark | tee output.txt
- name: Download previous benchmark data
uses: actions/cache/restore@v4
with:
path: ./benchmarks
# `github.event.before` means the commit before the push (i.e. the previous commit).
# So we can fetch the exact benchmark data from the previous commit.
key: ${{ runner.os }}-benchmark-${{ github.event.before }}
- name: Store benchmarks result
uses: benchmark-action/[email protected]
with:
name: Benchmarks
tool: 'go'
output-file-path: output.txt
external-data-json-path: ./benchmarks/data.json
github-token: ${{ secrets.GITHUB_TOKEN }}
gh-pages-branch: benchmarks
fail-on-alert: true
alert-threshold: "400%"
# Add benchmark summary to GitHub workflow run report
summary-always: true
- name: Save benchmark data
uses: actions/cache/save@v4
# The cache will be saved even if a step fails.
if: always()
with:
path: ./benchmarks
# Use the current commit SHA as the cache key.
key: ${{ runner.os }}-benchmark-${{ github.sha }}