Skip to content

Commit b2d9cea

Browse files
authored
Add benchmark regression detection (#799)
Add benchmark regression detection with github-action-benchmark
1 parent 25ea6a9 commit b2d9cea

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,27 @@ jobs:
173173
# Output to both logs and step summary
174174
cat benchmark-table.txt
175175
cat benchmark-table.txt >> $GITHUB_STEP_SUMMARY
176+
- name: Prepare for benchmark storage
177+
run: |
178+
# Save benchmark results outside the repo before stashing
179+
cp benchmark-results.json /tmp/benchmark-results.json
180+
# Stash changes from make sync to allow branch switching
181+
git stash --include-untracked
182+
# Restore the benchmark results
183+
cp /tmp/benchmark-results.json benchmark-results.json
184+
- name: Store benchmark result
185+
uses: benchmark-action/github-action-benchmark@v1
186+
with:
187+
tool: 'pytest'
188+
output-file-path: benchmark-results.json
189+
# Store benchmark data in gh-pages branch
190+
gh-pages-branch: gh-pages
191+
benchmark-data-dir-path: dev/bench
192+
# Fail if performance regresses by more than 20%
193+
alert-threshold: '120%'
194+
fail-on-alert: true
195+
# Comment on PR when regression detected
196+
comment-on-alert: true
197+
github-token: ${{ secrets.GITHUB_TOKEN }}
198+
# Only push to gh-pages on main branch
199+
auto-push: ${{ github.ref == 'refs/heads/main' }}

0 commit comments

Comments
 (0)