diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 3a4a7875cb..fbe250d098 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -115,6 +115,27 @@ jobs: perf report -i server/perf.data --no-children --stdio > server.perf.txt & wait + - name: Format results as Markdown + id: results + run: | + { + 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 + + - name: Remember main-branch push URL + if: github.ref == 'refs/heads/main' + run: echo "${{ github.sha }}" > target/criterion/baseline-sha.txt + - name: Cache main-branch results if: github.ref == 'refs/heads/main' uses: actions/cache/save@v4 @@ -122,10 +143,6 @@ jobs: path: ./target/criterion 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 uses: actions/upload-artifact@v4 @@ -139,23 +156,6 @@ jobs: target/criterion* compression-level: 9 - - name: Format results as Markdown - id: results - run: | - { - 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 - - name: Export PR comment data uses: ./.github/actions/pr-comment-data-export with: