Skip to content

Commit c6d903e

Browse files
committed
init cache
1 parent 7bbf31e commit c6d903e

1 file changed

Lines changed: 25 additions & 12 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: Benchmark
2-
on: [ pull_request, push, workflow_dispatch ]
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
39

410
permissions:
511
contents: write
@@ -14,36 +20,43 @@ jobs:
1420
runs-on: ubuntu-latest
1521

1622
steps:
17-
- name: Checkout repository.
23+
- name: Checkout repository
1824
uses: actions/checkout@v4
1925

20-
- name: Install UV.
26+
- name: Install UV
2127
uses: astral-sh/setup-uv@v6
2228

23-
- name: Install dependencies.
29+
- name: Install dependencies
2430
run: uv sync --group testing
2531

26-
- name: Compile.
32+
- name: Compile
2733
run: uv pip install -v -e .
2834
env:
2935
RUST_BACKTRACE: 1
3036

31-
- name: Run Benchmarks.
37+
- name: Run Benchmarks
3238
run: uv run pytest . -m benchmark_main --benchmark-enable --benchmark-json=output.json
3339

34-
- name: Upload benchmark artifact
35-
uses: actions/upload-artifact@v4
40+
- name: Seed benchmark cache for main (one-time)
41+
run: |
42+
mkdir -p benchmark-data
43+
cp output.json benchmark-data/output.json
44+
env:
45+
SEEDED_BENCHMARK_KEY: benchmark-${{ runner.os }}-refs/heads/main
46+
47+
- name: Download previous benchmark data
48+
uses: actions/cache@v4
3649
with:
37-
name: benchmark-output
38-
path: output.json
50+
path: ./benchmark-data
51+
key: benchmark-${{ runner.os }}-${{ github.ref }}
3952

4053
- name: Benchmark results
4154
uses: benchmark-action/github-action-benchmark@v1
4255
with:
4356
tool: 'pytest'
4457
output-file-path: output.json
45-
external-data-json-path: POOP.json
46-
# to make a commit comment
58+
external-data-json-path: ./benchmark-data/output.json
4759
github-token: ${{ secrets.GITHUB_TOKEN }}
4860
summary-always: true
4961
skip-fetch-gh-pages: true
62+
save-data-file: ${{ github.event_name != 'pull_request' }}

0 commit comments

Comments
 (0)