43 lines (37 loc) · 1.05 KB
/
bench.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
name: bench
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
benchmark:
runs-on: [self-hosted, linux, x64]
steps:
- name: Checkout latest code
uses: actions/checkout@v2.4.0
- name: Install Go
uses: actions/setup-go@v2.2.0
with:
go-version: 1.17
- name: Get Go environment
id: go-env
run: echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up cache
uses: actions/cache@v2.1.7
with:
path: ${{ steps.go-env.outputs.modcache }}
key: benchmark-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
benchmark-${{ runner.os }}-go-
# Run all benchmarks.
- name: Run benchmarks
run: go test -v -bench . -run ^$ ./... | tee benchmark.txt
- name: Upload artifact
uses: actions/upload-artifact@v2.3.1
with:
name: benchmark-result
path: benchmark.txt
if-no-files-found: error
retention-days: 1