Skip to content

Commit

Permalink
tests(ci): skip comment on empty regression (#28)
Browse files Browse the repository at this point in the history
tests(ci): skip comment on empty regression
  • Loading branch information
msaf1980 authored Mar 18, 2023
1 parent 8bc825c commit 8cfb340
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,21 @@ jobs:
./ci/bechmark.py -f ${{ steps.changed.outputs.changed }} | tee ${{ env.TMP_DIR }}/bench-base.txt
- name: Benchstat
id: regression
if: ${{ steps.changed.outputs.changed != '' }}
run: |
set -euo pipefail
cp ${{ env.TMP_DIR }}/bench-base.txt ${{ env.TMP_DIR }}/bench-pr.txt .
qbenchstat -increasing 'match/s' -threshold 2 -format html bench-base.txt bench-pr.txt > ${{ env.TMP_DIR }}/benchstat.html
if [ -s ${{ env.TMP_DIR }}/benchstat.html ]; then
echo "regression=true" >> $GITHUB_OUTPUT
else
echo "regression=false" >> $GITHUB_OUTPUT
fi
qbenchstat -increasing 'match/s' -format html bench-base.txt bench-pr.txt > benchstat_${{ matrix.go-version }}.html
- name: Upload Benchstat
if: ${{ steps.changed.outputs.changed != '' }}
if: ${{ steps.regression.outputs.regression }}
uses: actions/upload-artifact@v2
with:
name: benchstat_${{ env.HEAD_SHA }}
Expand All @@ -86,7 +92,7 @@ jobs:
- name: Create comment PR
if: ${{ steps.changed.outputs.changed != '' }}
run: |
echo "<details><summary>Benchmark comparison (id ${{ github.run_id }}) for golang ${{ matrix.go-version }} on [${{ env.BASE_SHA }}] (${{ github.event.pull_request.base.ref }}) vs [${{ env.HEAD_SHA }}] (${{ github.event.pull_request.head.ref }})</summary>" > ${{ env.TMP_DIR }}/pr_comment
echo "<details><summary>Benchmark comparison (id ${{ github.run_id }}) for golang ${{ matrix.go-version }} on ${{ github.event.pull_request.base.ref }} [${{ env.BASE_SHA }}] vs (${{ github.event.pull_request.head.ref }}) [${{ env.HEAD_SHA }}]</summary>" > ${{ env.TMP_DIR }}/pr_comment
cat ${{ env.TMP_DIR }}/benchstat.html >> ${{ env.TMP_DIR }}/pr_comment
echo "</details>" >> ${{ env.TMP_DIR }}/pr_comment
Expand Down

0 comments on commit 8cfb340

Please sign in to comment.