Skip to content

Commit e9a80ae

Browse files
authored
Merge pull request #91 from miparnisari/bench-cpus
ensure benchmarks are compared if the CPUs are the same
2 parents 3aa6a05 + 964f899 commit e9a80ae

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/master.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ jobs:
3737
github-token: ${{ secrets.GITHUB_TOKEN }}
3838
comment-on-alert: true
3939

40+
- name: Get CPU information
41+
uses: kenchan0130/actions-system-info@master
42+
id: system-info
43+
4044
- name: Save benchmark JSON to cache
4145
uses: actions/cache/save@v3
4246
with:
4347
path: ./cache/benchmark-data.json
4448
# Save with commit hash to avoid "cache already exists"
45-
# Save with OS to prevent comparing against results from different CPUs
46-
key: ${{ github.sha }}-${{ runner.os }}-go-benchmark
49+
# Save with OS & CPU info to prevent comparing against results from different CPUs
50+
key: ${{ github.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-go-benchmark

.github/workflows/pull_request.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
set -o pipefail
5757
make bench | tee ${{ github.sha }}_bench_output.txt
5858
59+
- name: Get CPU information
60+
uses: kenchan0130/actions-system-info@master
61+
id: system-info
62+
5963
- name: Get Master branch SHA
6064
id: get-master-branch-sha
6165
run: |
@@ -67,7 +71,7 @@ jobs:
6771
id: cache
6872
with:
6973
path: ./cache/benchmark-data.json
70-
key: ${{ steps.get-master-branch-sha.outputs.sha }}-${{ runner.os }}-go-benchmark
74+
key: ${{ steps.get-master-branch-sha.outputs.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-go-benchmark
7175

7276
- name: Compare benchmarks with master
7377
uses: benchmark-action/github-action-benchmark@v1

0 commit comments

Comments
 (0)