From 964f899bf49c334890a210d2a1680b84b4f9da8d Mon Sep 17 00:00:00 2001 From: Maria Ines Parnisari Date: Thu, 23 Nov 2023 11:29:35 -0800 Subject: [PATCH] ensure benchmarks are compared if the CPUs are the same --- .github/workflows/master.yaml | 8 ++++++-- .github/workflows/pull_request.yaml | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 5c187d1..37ab3fd 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -37,10 +37,14 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} comment-on-alert: true + - name: Get CPU information + uses: kenchan0130/actions-system-info@master + id: system-info + - name: Save benchmark JSON to cache uses: actions/cache/save@v3 with: path: ./cache/benchmark-data.json # Save with commit hash to avoid "cache already exists" - # Save with OS to prevent comparing against results from different CPUs - key: ${{ github.sha }}-${{ runner.os }}-go-benchmark + # Save with OS & CPU info to prevent comparing against results from different CPUs + key: ${{ github.sha }}-${{ runner.os }}-${{ steps.system-info.outputs.cpu-model }}-go-benchmark diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index d4ca300..2894271 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -56,6 +56,10 @@ jobs: set -o pipefail 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 id: get-master-branch-sha run: | @@ -67,7 +71,7 @@ jobs: id: cache with: 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 uses: benchmark-action/github-action-benchmark@v1