File tree Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Expand file tree Collapse file tree 2 files changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CodSpeed Benchmarks
2+
3+ on :
4+ push :
5+ branches :
6+ - " main"
7+ pull_request :
8+ workflow_dispatch :
9+
10+ env :
11+ # renovate: datasource=github-releases depName=codspeed packageName=CodSpeedHQ/runner
12+ CODSPEED_RUNNER_VERSION : v4.3.4
13+
14+ jobs :
15+ benchmarks :
16+ name : Run benchmarks
17+ runs-on : ubuntu-latest
18+ steps :
19+ - uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
20+ - uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
21+ - name : Setup Go
22+ uses : actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
23+ with :
24+ go-version : stable
25+ cache : false
26+ - name : Cache Go
27+ id : go-cache
28+ uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
29+ with :
30+ path : |
31+ ~/go/bin
32+ ~/go/pkg/mod
33+ key : go-cache-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }}
34+
35+ # The following comes from https://github.com/CodSpeedHQ/action/blob/6a8e2b/action.yml with significant modifications.
36+ # Copyright (c) 2022 CodSpeed and contributors
37+ # TODO: Switch to a setup-codspeed action when available, see https://github.com/CodSpeedHQ/action/issues/146
38+ - name : Determine kernel version
39+ id : versions
40+ shell : bash
41+ run : |
42+ # Get kernel version for cache key
43+ KERNEL_VERSION=$(uname -r)
44+ echo "kernel-version=$KERNEL_VERSION" >> $GITHUB_OUTPUT
45+ - name : Cache CodSpeed instruments
46+ uses : actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
47+ with :
48+ path : ~/.cache/codspeed-action
49+ key : codspeed-instruments-instrumentation-${{ runner.os }}-${{ runner.arch }}-${{steps.versions.outputs.kernel-version }}-${{ env.CODSPEED_RUNNER_VERSION }}
50+ restore-keys : |
51+ codspeed-instruments-instrumentation-${{ runner.os }}-${{ runner.arch }}-${{steps.versions.outputs.kernel-version }}-${{ env.CODSPEED_RUNNER_VERSION }}
52+ - name : Setup codspeed
53+ run : |
54+ curl -fsSL https://github.com/CodSpeedHQ/runner/releases/download/${{ env.CODSPEED_RUNNER_VERSION }}/codspeed-runner-installer.sh | bash -s -- --quiet
55+ - name : Run benchmarks
56+ run : |
57+ make for-all-target TARGET="codspeed-benchmark"
58+
Original file line number Diff line number Diff line change 9999.PHONY: moddownload
100100moddownload:
101101 $(GOCMD) mod download
102+
103+ codspeed-benchmark:
104+ if go test ./... -list=Benchmark | grep -q Benchmark; then \
105+ codspeed run --mode instrumentation --setup-cache-dir=~/.cache/codspeed-action -- 'go test -bench=./...'; \
106+ fi
You can’t perform that action at this time.
0 commit comments