Skip to content

Commit 0a0d80f

Browse files
committed
feat(ci): use gh-pages for baseline, add permissions, apply review feedback
- Switch PR comparison from actions/cache to gh-pages branch - Add permissions (contents: write, pull-requests: write) for alert comments and gh-pages auto-push - Lower alert threshold to 110% - Restrict to github.repository == 'kube-rs/kube' Signed-off-by: doxxx <doxxx93@gmail.com>
1 parent 4b15747 commit 0a0d80f

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

.github/workflows/memory-bench.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,14 @@ concurrency:
2121
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
2222
cancel-in-progress: true
2323

24+
permissions:
25+
contents: write
26+
pull-requests: write
27+
2428
jobs:
2529
memory-bench:
2630
runs-on: ubuntu-latest
31+
if: github.repository == 'kube-rs/kube'
2732
steps:
2833
- uses: actions/checkout@v6
2934
- uses: dtolnay/rust-toolchain@stable
@@ -32,19 +37,27 @@ jobs:
3237
- name: Run memory benchmark
3338
run: cargo bench -p kube-runtime --bench memory > bench-result.json
3439

35-
- name: Restore benchmark baseline
36-
uses: actions/cache@v4
37-
with:
38-
path: ./bench-data
39-
key: memory-bench-data
40-
41-
- name: Compare benchmarks
40+
- name: Compare benchmarks (PR)
41+
if: github.event_name == 'pull_request'
4242
uses: benchmark-action/github-action-benchmark@v1
4343
with:
4444
tool: customSmallerIsBetter
4545
output-file-path: bench-result.json
46-
external-data-json-path: ./bench-data/data.json
4746
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
gh-pages-branch: gh-pages
48+
benchmark-data-dir-path: bench
49+
auto-push: false
4850
comment-on-alert: true
49-
alert-threshold: "150%"
51+
alert-threshold: "110%"
5052
fail-on-alert: true
53+
54+
- name: Store benchmark result (main)
55+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
56+
uses: benchmark-action/github-action-benchmark@v1
57+
with:
58+
tool: customSmallerIsBetter
59+
output-file-path: bench-result.json
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
auto-push: true
62+
gh-pages-branch: gh-pages
63+
benchmark-data-dir-path: bench

0 commit comments

Comments
 (0)