Skip to content

Commit

Permalink
Fix benchmark caching, and store (and show) baseline SHA
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Mar 14, 2024
1 parent 92db586 commit 56c380d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ./target/criterion
key: criterion-${{ runner.os }}-${{ hashFiles('./target/criterion/**.json') }}
restore-keys: criterion-${{ runner.os }}-
key: criterion-${{ runner.name }}-${{ hashFiles('./target/criterion/**.json') }}
restore-keys: criterion-${{ runner.name }}-

# Disable turboboost, hyperthreading and use performance governor.
- name: Prepare machine
Expand Down Expand Up @@ -120,7 +120,11 @@ jobs:
uses: actions/cache/save@v4
with:
path: ./target/criterion
key: ${{ steps.criterion-cache.outputs.cache-primary-key }}
key: criterion-${{ runner.name }}-${{ hashFiles('./target/criterion/**.json') }}

- name: Remember main-branch push URL
if: github.ref == 'refs/heads/main'
run: echo "${{ github.sha }}" > target/criterion/baseline-sha.txt

- name: Export perf data
id: export
Expand All @@ -138,15 +142,19 @@ jobs:
- name: Format results as Markdown
id: results
run: |
echo '### Benchmark results' > results.md
{
echo "### Benchmark results"
echo
echo "Performance differences relative to $(cat target/criterion/baseline-sha.txt)."
echo
} > results.md
grep -Ev 'ignored|running \d+ tests|%\)' results.txt |\
sed -E -e 's/(Performance has regressed.)/:broken_heart: **\1**/gi' \
-e 's/(Performance has improved.)/:green_heart: **\1**/gi' \
-e 's/^ +/ /gi' \
-e 's/^([a-z0-9].*)$/* **\1**/gi' \
-e 's/(change:[^%]*% )([^%]*%)(.*)/\1**\2**\3/gi' \
>> results.md
echo '' >> results.md
- name: Export PR comment data
uses: ./.github/actions/pr-comment-data-export
Expand Down

0 comments on commit 56c380d

Please sign in to comment.