diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 201304c37..18f9ff244 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,6 +102,63 @@ jobs: - name: Unit tests run: make test + run-benchdiff: + runs-on: ubuntu-latest + permissions: + checks: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-go@v4 + with: + go-version: stable + cache-dependency-path: '**/go.sum' + # Version: https://github.com/WillAbides/benchdiff-action/releases/tag/v0.3.3 + - uses: WillAbides/benchdiff-action@4d1d267fa96763646dd7c0d58e242817ce392c61 + ## As long as we cannot use write permissions on forked pull requests, then let's avoid failing + continue-on-error: true + id: benchdiff + with: + benchdiff_version: 0.9.1 + status_sha: ${{ github.sha }} + status_name: benchdiff-result + status_on_degraded: neutral + # See https://github.com/WillAbides/benchdiff + benchdiff_args: | + --base-ref=origin/main + --cpu=1,2 + --count=5 + --warmup-count=1 + --warmup-time=10ms + --benchtime=100ms + --tolerance=20 + --benchmem + --debug + + - name: Summary + run: | + echo "${{ steps.benchdiff.outputs.benchstat_output }}" > benchdiff-report.md + { + echo "## Benchdiff Results" + echo "" + echo 'Head: `${{ steps.benchdiff.outputs.head_sha }}`' + echo 'Base: `${{ steps.benchdiff.outputs.base_sha }}`' + echo 'Degraded: `${{ steps.benchdiff.outputs.degraded_result }}`' + echo "" + echo "
" + echo "See results" + echo "" + echo "${{ steps.benchdiff.outputs.benchstat_output }}" + echo "" + echo "
" + } >> $GITHUB_STEP_SUMMARY + + - uses: actions/upload-artifact@v3 + with: + name: benchdiff-report + path: benchdiff-report.md + # Very last job to create a GitHub check with the status. This is handy to centralise the # GitHub check validation in the Branch protection and to support the ci-docs.yml ci: