-
Notifications
You must be signed in to change notification settings - Fork 182
improve readme and update minimal example #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 12 commits
fa49d05
ca3c561
bb00a3f
f0d7aea
75dcd0d
b83835a
7839b94
a5f07e9
e7d61db
f3bac58
69b61e7
1fe4b3a
fa12634
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,41 @@ | ||
| name: Example for minimal setup | ||
| on: | ||
| # NOTE! Do NOT add any other "on", because this workflow has permission to write to the repo! | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| permissions: | ||
| contents: write | ||
| deployments: write | ||
| # permission to update benchmark contents in gh-pages branch | ||
| contents: "write" | ||
|
|
||
| jobs: | ||
| benchmark: | ||
| name: Run minimal steps to run github-action-benchmark | ||
| name: Run benchmark and save results | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v4 | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: "stable" | ||
| - name: Run benchmark | ||
| - name: Run benchmark and stores the output to a file | ||
| run: cd examples/go && go test -bench 'BenchmarkFib' | tee output.txt | ||
| - name: Download previous benchmark data | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ./cache | ||
| key: ${{ runner.os }}-benchmark | ||
| - name: Store benchmark result | ||
| - name: Get JSON for benchmark | ||
| uses: benchmark-action/github-action-benchmark@v1 | ||
| with: | ||
| # What benchmark tool the output.txt came from | ||
| tool: 'go' | ||
| output-file-path: examples/go/output.txt | ||
| # Where the output from the benchmark tool is stored | ||
| output-file-path: output.txt | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| # Updates this file | ||
| external-data-json-path: ./cache/benchmark-data.json | ||
| # Workflow will fail when an alert happens | ||
| fail-on-alert: true | ||
|
Comment on lines
+32
to
33
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm not sure if this line makes sense here. this step isn't comparing benchmark results, so how would it fail? |
||
| # Writes to gh-pages-branch | ||
| auto-push: "true" | ||
| - name: Save JSON in cache | ||
| uses: actions/cache/save@v5 | ||
| with: | ||
| path: ./cache/benchmark-data.json | ||
| # Save with commit hash to avoid "cache already exists" | ||
| key: "${{ github.sha }}-${{ runner.os }}-go-benchmark" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing cache restore step prevents comparison with previous benchmarks. The workflow saves For a functional minimal example, add a cache restore step: Proposed fix - name: Run benchmark and stores the output to a file
run: go test ./examples/go -bench 'BenchmarkFib' | tee output.txt
+ - name: Restore benchmark JSON from cache
+ uses: actions/cache/restore@v5
+ with:
+ path: ./cache/benchmark-data.json
+ key: "${{ runner.os }}-go-benchmark"
+ restore-keys: |
+ ${{ runner.os }}-go-benchmark
- name: Get JSON for benchmark
uses: benchmark-action/github-action-benchmark@v1🧰 Tools🪛 GitHub Check: Run unit tests[failure] 41-41: 🤖 Prompt for AI Agents
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i feel like there is a companion minimal example missing: where a PR runs benchmarks and compares them against the benchmarks saved in here...