Skip to content

Commit 208bd73

Browse files
committed
fix(ci): drop before_data.js setup steps from all CI workflow jobs
Remove the separate checkout / cp steps that captured data.js before the action ran. The validate script now reads HEAD~1 and HEAD via git show, so no pre-action snapshot is needed and the race window is eliminated.
1 parent 39d7c9d commit 208bd73

2 files changed

Lines changed: 22 additions & 186 deletions

File tree

.github/workflows/ci-results-repo.yml

Lines changed: 11 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ jobs:
2525
- name: Run benchmark
2626
run: cd examples/benchmarkdotnet && dotnet run --exporters json --filter '*'
2727

28-
- uses: actions/checkout@v4
29-
with:
30-
repository: benchmark-action/github-action-benchmark-results
31-
ref: 'gh-pages'
32-
path: 'dist/other-repo'
33-
- name: Save previous data.js
34-
run: |
35-
cp ./dist/other-repo/dev/bench/data.js before_data.js
36-
3728
- name: Store benchmark result
3829
uses: ./
3930
with:
@@ -43,7 +34,7 @@ jobs:
4334
fail-on-alert: true
4435
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
4536
github-token: ${{ secrets.GITHUB_TOKEN }}
46-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Benchmark.Net Benchmark' './benchmark-data-repository'
37+
- run: npx tsx scripts/ci_validate_modification.ts 'Benchmark.Net Benchmark' './benchmark-data-repository'
4738

4839
benchmarkjs:
4940
name: Run JavaScript benchmark example - github.com/benchmark-action/github-action-benchmark-results
@@ -59,15 +50,6 @@ jobs:
5950
- name: Run benchmark
6051
run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt
6152

62-
- uses: actions/checkout@v4
63-
with:
64-
repository: benchmark-action/github-action-benchmark-results
65-
ref: 'gh-pages'
66-
path: 'dist/other-repo'
67-
- name: Save previous data.js
68-
run: |
69-
cp ./dist/other-repo/dev/bench/data.js before_data.js
70-
7153
- name: Store benchmark result
7254
uses: ./
7355
with:
@@ -77,7 +59,7 @@ jobs:
7759
fail-on-alert: true
7860
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
7961
github-token: ${{ secrets.GITHUB_TOKEN }}
80-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Benchmark.js Benchmark' './benchmark-data-repository'
62+
- run: npx tsx scripts/ci_validate_modification.ts 'Benchmark.js Benchmark' './benchmark-data-repository'
8163

8264
catch2-v2-framework:
8365
name: Run Catch2 C++ Benchmark Framework example (v2.x) - github.com/benchmark-action/github-action-benchmark-results
@@ -98,15 +80,6 @@ jobs:
9880
cmake --build . --config Release
9981
./Catch2_bench > ../benchmark_result.txt
10082
101-
- uses: actions/checkout@v4
102-
with:
103-
repository: benchmark-action/github-action-benchmark-results
104-
ref: 'gh-pages'
105-
path: 'dist/other-repo'
106-
- name: Save previous data.js
107-
run: |
108-
cp ./dist/other-repo/dev/bench/data.js before_data.js
109-
11083
- name: Store benchmark result
11184
uses: ./
11285
with:
@@ -116,7 +89,7 @@ jobs:
11689
fail-on-alert: true
11790
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
11891
github-token: ${{ secrets.GITHUB_TOKEN }}
119-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Catch2 Benchmark' './benchmark-data-repository'
92+
- run: npx tsx scripts/ci_validate_modification.ts 'Catch2 Benchmark' './benchmark-data-repository'
12093

12194
catch2-v3-framework:
12295
name: Run Catch2 C++ Benchmark Framework example (v3.x) - github.com/benchmark-action/github-action-benchmark-results
@@ -137,15 +110,6 @@ jobs:
137110
cmake --build . --config Release
138111
./Catch2_bench > ../benchmark_result.txt
139112
140-
- uses: actions/checkout@v4
141-
with:
142-
repository: benchmark-action/github-action-benchmark-results
143-
ref: 'gh-pages'
144-
path: 'dist/other-repo'
145-
- name: Save previous data.js
146-
run: |
147-
cp ./dist/other-repo/dev/bench/data.js before_data.js
148-
149113
- name: Store benchmark result
150114
uses: ./
151115
with:
@@ -155,7 +119,7 @@ jobs:
155119
fail-on-alert: true
156120
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
157121
github-token: ${{ secrets.GITHUB_TOKEN }}
158-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Catch2 Benchmark (v3)' './benchmark-data-repository'
122+
- run: npx tsx scripts/ci_validate_modification.ts 'Catch2 Benchmark (v3)' './benchmark-data-repository'
159123

160124
cpp-framework:
161125
name: Run Google C++ Benchmark Framework example - github.com/benchmark-action/github-action-benchmark-results
@@ -178,15 +142,6 @@ jobs:
178142
cd examples/cpp
179143
make json
180144
181-
- uses: actions/checkout@v4
182-
with:
183-
repository: benchmark-action/github-action-benchmark-results
184-
ref: 'gh-pages'
185-
path: 'dist/other-repo'
186-
- name: Save previous data.js
187-
run: |
188-
cp ./dist/other-repo/dev/bench/data.js before_data.js
189-
190145
- name: Store benchmark result
191146
uses: ./
192147
with:
@@ -196,7 +151,7 @@ jobs:
196151
fail-on-alert: true
197152
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
198153
github-token: ${{ secrets.GITHUB_TOKEN }}
199-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'C++ Benchmark' './benchmark-data-repository'
154+
- run: npx tsx scripts/ci_validate_modification.ts 'C++ Benchmark' './benchmark-data-repository'
200155

201156
go:
202157
name: Run Go benchmark example - github.com/benchmark-action/github-action-benchmark-results
@@ -215,15 +170,6 @@ jobs:
215170
- name: Run benchmark
216171
run: cd examples/go && go test -bench 'BenchmarkFib' | tee output.txt
217172

218-
- uses: actions/checkout@v4
219-
with:
220-
repository: benchmark-action/github-action-benchmark-results
221-
ref: 'gh-pages'
222-
path: 'dist/other-repo'
223-
- name: Save previous data.js
224-
run: |
225-
cp ./dist/other-repo/dev/bench/data.js before_data.js
226-
227173
- name: Store benchmark result
228174
uses: ./
229175
with:
@@ -233,7 +179,7 @@ jobs:
233179
fail-on-alert: true
234180
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
235181
github-token: ${{ secrets.GITHUB_TOKEN }}
236-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Go Benchmark' './benchmark-data-repository'
182+
- run: npx tsx scripts/ci_validate_modification.ts 'Go Benchmark' './benchmark-data-repository'
237183

238184
java-jmh:
239185
name: Run JMH Java Benchmark Framework example
@@ -255,14 +201,6 @@ jobs:
255201
cd examples/java
256202
mvn clean verify
257203
java -jar target/benchmarks.jar -wi 1 -i 3 -f 1 -rf json
258-
- uses: actions/checkout@v4
259-
with:
260-
repository: benchmark-action/github-action-benchmark-results
261-
ref: 'gh-pages'
262-
path: 'dist/other-repo'
263-
- name: Save previous data.js
264-
run: |
265-
cp ./dist/other-repo/dev/bench/data.js before_data.js
266204
- name: Store benchmark result
267205
uses: ./
268206
with:
@@ -272,7 +210,7 @@ jobs:
272210
fail-on-alert: true
273211
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
274212
github-token: ${{ secrets.GITHUB_TOKEN }}
275-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'JMH Benchmark' './benchmark-data-repository'
213+
- run: npx tsx scripts/ci_validate_modification.ts 'JMH Benchmark' './benchmark-data-repository'
276214

277215
julia-benchmark:
278216
name: Run Julia benchmark example - github.com/benchmark-action/github-action-benchmark-results
@@ -297,15 +235,6 @@ jobs:
297235
Pkg.instantiate();
298236
include("fib.jl")'
299237
300-
- uses: actions/checkout@v4
301-
with:
302-
repository: benchmark-action/github-action-benchmark-results
303-
ref: 'gh-pages'
304-
path: 'dist/other-repo'
305-
- name: Save previous data.js
306-
run: |
307-
cp ./dist/other-repo/dev/bench/data.js before_data.js
308-
309238
- name: Store benchmark result
310239
uses: ./
311240
with:
@@ -315,7 +244,7 @@ jobs:
315244
fail-on-alert: true
316245
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
317246
github-token: ${{ secrets.GITHUB_TOKEN }}
318-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Julia benchmark' './benchmark-data-repository'
247+
- run: npx tsx scripts/ci_validate_modification.ts 'Julia benchmark' './benchmark-data-repository'
319248

320249
pytest-benchmark:
321250
name: Run Pytest benchmark example - github.com/benchmark-action/github-action-benchmark-results
@@ -337,15 +266,6 @@ jobs:
337266
pip install -r requirements.txt
338267
pytest bench.py --benchmark-json output.json
339268
340-
- uses: actions/checkout@v4
341-
with:
342-
repository: benchmark-action/github-action-benchmark-results
343-
ref: 'gh-pages'
344-
path: 'dist/other-repo'
345-
- name: Save previous data.js
346-
run: |
347-
cp ./dist/other-repo/dev/bench/data.js before_data.js
348-
349269
- name: Store benchmark result
350270
uses: ./
351271
with:
@@ -355,7 +275,7 @@ jobs:
355275
fail-on-alert: true
356276
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
357277
github-token: ${{ secrets.GITHUB_TOKEN }}
358-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Python Benchmark with pytest-benchmark' './benchmark-data-repository'
278+
- run: npx tsx scripts/ci_validate_modification.ts 'Python Benchmark with pytest-benchmark' './benchmark-data-repository'
359279

360280
rust:
361281
name: Run Rust benchmark example - github.com/benchmark-action/github-action-benchmark-results
@@ -372,15 +292,6 @@ jobs:
372292
- name: Run benchmark
373293
run: cd examples/rust && cargo +nightly bench | tee output.txt
374294

375-
- uses: actions/checkout@v4
376-
with:
377-
repository: benchmark-action/github-action-benchmark-results
378-
ref: 'gh-pages'
379-
path: 'dist/other-repo'
380-
- name: Save previous data.js
381-
run: |
382-
cp ./dist/other-repo/dev/bench/data.js before_data.js
383-
384295
- name: Store benchmark result
385296
uses: ./
386297
with:
@@ -390,7 +301,7 @@ jobs:
390301
fail-on-alert: true
391302
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
392303
github-token: ${{ secrets.GITHUB_TOKEN }}
393-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Rust Benchmark' './benchmark-data-repository'
304+
- run: npx tsx scripts/ci_validate_modification.ts 'Rust Benchmark' './benchmark-data-repository'
394305

395306
rust-criterion-rs-framework:
396307
name: Run Criterion.rs benchmark example - github.com/benchmark-action/github-action-benchmark-results
@@ -407,15 +318,6 @@ jobs:
407318
- name: Run benchmark
408319
run: cd examples/criterion-rs && cargo +nightly bench -- --output-format bencher | tee output.txt
409320

410-
- uses: actions/checkout@v4
411-
with:
412-
repository: benchmark-action/github-action-benchmark-results
413-
ref: 'gh-pages'
414-
path: 'dist/other-repo'
415-
- name: Save previous data.js
416-
run: |
417-
cp ./dist/other-repo/dev/bench/data.js before_data.js
418-
419321
- name: Store benchmark result
420322
uses: ./
421323
with:
@@ -425,7 +327,7 @@ jobs:
425327
fail-on-alert: true
426328
gh-repository: 'github.com/benchmark-action/github-action-benchmark-results'
427329
github-token: ${{ secrets.GITHUB_TOKEN }}
428-
- run: npx tsx scripts/ci_validate_modification.ts before_data.js 'Criterion.rs Benchmark' './benchmark-data-repository'
330+
- run: npx tsx scripts/ci_validate_modification.ts 'Criterion.rs Benchmark' './benchmark-data-repository'
429331

430332
only-alert-with-cache:
431333
name: Run alert check with actions/cache

0 commit comments

Comments
 (0)