feat: Store benchmark results as git notes (#15)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Marcelo Soares <marcelo.me.soares@gmail.com>
This commit is contained in:
parent
ce7bf998bc
commit
05ad0dbc02
2 changed files with 37 additions and 2 deletions
21
.github/workflows/ci.yaml
vendored
21
.github/workflows/ci.yaml
vendored
|
|
@ -102,11 +102,10 @@ jobs:
|
||||||
benchmarks:
|
benchmarks:
|
||||||
needs: generate
|
needs: generate
|
||||||
name: run benchmarks
|
name: run benchmarks
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
contents: read
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Dart
|
- name: Set up Dart
|
||||||
|
|
@ -119,13 +118,31 @@ jobs:
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: generated-code
|
name: generated-code
|
||||||
|
- name: Configure Git
|
||||||
|
run: |
|
||||||
|
git config --global user.name "GitHub Actions"
|
||||||
|
git config --global user.email "actions@github.com"
|
||||||
|
- name: Fetch Existing Benchmark Data
|
||||||
|
run: git fetch origin refs/notes/benchmarks:refs/notes/benchmarks || true
|
||||||
- name: Run benchmarks
|
- name: Run benchmarks
|
||||||
run: dart benchmark/run.dart --ci > benchmark-results.txt
|
run: dart benchmark/run.dart --ci > benchmark-results.txt
|
||||||
- name: Comment on PR
|
- name: Comment on PR
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
uses: thollander/actions-comment-pull-request@v3
|
uses: thollander/actions-comment-pull-request@v3
|
||||||
with:
|
with:
|
||||||
file-path: benchmark-results.txt
|
file-path: benchmark-results.txt
|
||||||
comment-tag: benchmark-results
|
comment-tag: benchmark-results
|
||||||
|
- name: Store Benchmark Data in Git Notes
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
|
COMMIT_SHA=${{ github.event.pull_request.head.sha }}
|
||||||
|
else
|
||||||
|
COMMIT_SHA=${{ github.sha }}
|
||||||
|
fi
|
||||||
|
git notes --ref=benchmarks add -f -F benchmark-results.txt $COMMIT_SHA
|
||||||
|
- name: Push Benchmark Data
|
||||||
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork != true
|
||||||
|
run: git push origin refs/notes/benchmarks
|
||||||
|
|
||||||
publish_check:
|
publish_check:
|
||||||
needs: generate
|
needs: generate
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,24 @@ To run the benchmarks:
|
||||||
dart benchmark/run.dart
|
dart benchmark/run.dart
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Accessing Benchmark Results
|
||||||
|
|
||||||
|
When running from the CI, benchmark results are automatically stored as git notes on commits. If running on a pull-request, it is also pasted as a comment that is kept up to date on each push. To access historical benchmark data:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Fetch benchmark notes from remote (if not already available)
|
||||||
|
git fetch origin refs/notes/benchmarks:refs/notes/benchmarks
|
||||||
|
|
||||||
|
# View benchmark results for the latest commit
|
||||||
|
git notes --ref=benchmarks show
|
||||||
|
|
||||||
|
# View benchmark results for a specific commit
|
||||||
|
git notes --ref=benchmarks show <commit-sha>
|
||||||
|
|
||||||
|
# View all commits with their benchmark results
|
||||||
|
git log --show-notes=benchmark
|
||||||
|
```
|
||||||
|
|
||||||
## Benchmark Details
|
## Benchmark Details
|
||||||
|
|
||||||
### Table Structure
|
### Table Structure
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue