-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: check performance regressions with CI
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: benchmark | ||
on: | ||
pull_request: | ||
branches: ["main"] | ||
jobs: | ||
benchmark: | ||
runs-on: ubuntu-latest | ||
container: swiftlang/swift:nightly-6.0-jammy | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: apt-get update && apt-get install --no-install-recommends -y libjemalloc-dev | ||
- name: Run benchmarks for PR branch | ||
run: swift package --package-path Benchmarks benchmark baseline update pull_request --no-progress --quiet | ||
- name: Switch to branch 'main' | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
clean: false | ||
- name: Run benchmarks for branch 'main' | ||
run: swift package --package-path Benchmarks benchmark baseline update main --no-progress --quiet | ||
- name: Compare PR and main | ||
id: benchmark | ||
run: | | ||
echo '## Summary' >> "$GITHUB_STEP_SUMMARY" | ||
echo "$(date)" >> "$GITHUB_STEP_SUMMARY" | ||
echo "exitStatus=1" >> "$GITHUB_OUTPUT" | ||
swift package --package-path Benchmarks benchmark baseline check main pull_request --format markdown >> "$GITHUB_STEP_SUMMARY" | ||
echo '---' >> "$GITHUB_STEP_SUMMARY" | ||
swift package --package-path Benchmarks benchmark baseline compare main pull_request --no-progress --quiet --format markdown >> "$GITHUB_STEP_SUMMARY" | ||
echo "exitStatus=0" >> "$GITHUB_OUTPUT" | ||
- name: Pull request comment text | ||
id: prtest | ||
env: | ||
exitStatus: ${{ steps.benchmark.outputs.exitStatus }} | ||
run: | | ||
echo 'PRTEST<<EOF' >> "$GITHUB_OUTPUT" | ||
echo "[Pull request benchmark comparison with 'main' run at $(date -Iseconds)](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> "$GITHUB_OUTPUT" | ||
[[ $exitStatus == '1' ]] && echo "_Pull request had performance regressions_" >> "$GITHUB_OUTPUT" | ||
echo 'EOF' >> "$GITHUB_OUTPUT" | ||
- name: Comment PR | ||
uses: thollander/actions-comment-pull-request@v3 | ||
with: | ||
message: ${{ steps.prtest.outputs.PRTEST }} | ||
comment_tag: execution | ||
- name: Exit with correct status | ||
run: | | ||
exit ${{ steps.benchmark.outputs.exitStatus }} |