Merge pull request #91 from miparnisari/bench-cpus

ensure benchmarks are compared if the CPUs are the same
This commit is contained in:
Karl Seguin
2023-11-27 07:58:24 +08:00
committed by GitHub
2 changed files with 11 additions and 3 deletions

View File

@@ -37,10 +37,14 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
comment-on-alert: true comment-on-alert: true
- name: Get CPU information
uses: kenchan0130/actions-system-info@master
id: system-info
- name: Save benchmark JSON to cache - name: Save benchmark JSON to cache
uses: actions/cache/save@v3 uses: actions/cache/save@v3
with: with:
path: ./cache/benchmark-data.json path: ./cache/benchmark-data.json
# Save with commit hash to avoid "cache already exists" # Save with commit hash to avoid "cache already exists"
# Save with OS to prevent comparing against results from different CPUs # Save with OS & CPU info to prevent comparing against results from different CPUs
key: ${{ github.sha }}-${{ runner.os }}-go-benchmark key: ${{ github.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-go-benchmark

View File

@@ -56,6 +56,10 @@ jobs:
set -o pipefail set -o pipefail
make bench | tee ${{ github.sha }}_bench_output.txt make bench | tee ${{ github.sha }}_bench_output.txt
- name: Get CPU information
uses: kenchan0130/actions-system-info@master
id: system-info
- name: Get Master branch SHA - name: Get Master branch SHA
id: get-master-branch-sha id: get-master-branch-sha
run: | run: |
@@ -67,7 +71,7 @@ jobs:
id: cache id: cache
with: with:
path: ./cache/benchmark-data.json path: ./cache/benchmark-data.json
key: ${{ steps.get-master-branch-sha.outputs.sha }}-${{ runner.os }}-go-benchmark key: ${{ steps.get-master-branch-sha.outputs.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-go-benchmark
- name: Compare benchmarks with master - name: Compare benchmarks with master
uses: benchmark-action/github-action-benchmark@v1 uses: benchmark-action/github-action-benchmark@v1