Skip to content

Commit 18a7953

Browse files
authored
fix: improve flaky CI runs (#215)
* move saving of previous benchmarks results further in the workflow files so that there is a smaller window when other action might push new changes
1 parent 65ff1d7 commit 18a7953

2 files changed

Lines changed: 114 additions & 103 deletions

File tree

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

Lines changed: 77 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
- uses: actions/checkout@v4
17-
with:
18-
repository: benchmark-action/github-action-benchmark-results
19-
ref: 'gh-pages'
20-
path: 'dist/other-repo'
2116
- uses: actions/setup-node@v4
2217
with:
2318
node-version: 20
2419
cache: 'npm'
2520
- run: npm ci
2621
- run: npm run build
27-
- name: Save previous data.js
28-
run: |
29-
cp ./dist/other-repo/dev/bench/data.js before_data.js
3022
- run: rustup toolchain update nightly && rustup default nightly
3123
- name: Run benchmark
3224
run: cd examples/rust && cargo +nightly bench | tee output.txt
25+
26+
- uses: actions/checkout@v4
27+
with:
28+
repository: benchmark-action/github-action-benchmark-results
29+
ref: 'gh-pages'
30+
path: 'dist/other-repo'
31+
- name: Save previous data.js
32+
run: |
33+
cp ./dist/other-repo/dev/bench/data.js before_data.js
34+
3335
- name: Store benchmark result
3436
uses: ./
3537
with:
@@ -46,11 +48,6 @@ jobs:
4648
runs-on: ubuntu-latest
4749
steps:
4850
- uses: actions/checkout@v4
49-
- uses: actions/checkout@v4
50-
with:
51-
repository: benchmark-action/github-action-benchmark-results
52-
ref: 'gh-pages'
53-
path: 'dist/other-repo'
5451
- uses: actions/setup-node@v4
5552
with:
5653
node-version: 20
@@ -60,11 +57,18 @@ jobs:
6057
go-version: "stable"
6158
- run: npm ci
6259
- run: npm run build
60+
- name: Run benchmark
61+
run: cd examples/go && go test -bench 'BenchmarkFib' | tee output.txt
62+
63+
- uses: actions/checkout@v4
64+
with:
65+
repository: benchmark-action/github-action-benchmark-results
66+
ref: 'gh-pages'
67+
path: 'dist/other-repo'
6368
- name: Save previous data.js
6469
run: |
6570
cp ./dist/other-repo/dev/bench/data.js before_data.js
66-
- name: Run benchmark
67-
run: cd examples/go && go test -bench 'BenchmarkFib' | tee output.txt
71+
6872
- name: Store benchmark result
6973
uses: ./
7074
with:
@@ -81,22 +85,24 @@ jobs:
8185
runs-on: ubuntu-latest
8286
steps:
8387
- uses: actions/checkout@v4
84-
- uses: actions/checkout@v4
85-
with:
86-
repository: benchmark-action/github-action-benchmark-results
87-
ref: 'gh-pages'
88-
path: 'dist/other-repo'
8988
- uses: actions/setup-node@v4
9089
with:
9190
node-version: 20
9291
cache: 'npm'
9392
- run: npm ci
9493
- run: npm run build
94+
- name: Run benchmark
95+
run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt
96+
97+
- uses: actions/checkout@v4
98+
with:
99+
repository: benchmark-action/github-action-benchmark-results
100+
ref: 'gh-pages'
101+
path: 'dist/other-repo'
95102
- name: Save previous data.js
96103
run: |
97104
cp ./dist/other-repo/dev/bench/data.js before_data.js
98-
- name: Run benchmark
99-
run: cd examples/benchmarkjs && npm install && node bench.js | tee output.txt
105+
100106
- name: Store benchmark result
101107
uses: ./
102108
with:
@@ -113,11 +119,6 @@ jobs:
113119
runs-on: ubuntu-latest
114120
steps:
115121
- uses: actions/checkout@v4
116-
- uses: actions/checkout@v4
117-
with:
118-
repository: benchmark-action/github-action-benchmark-results
119-
ref: 'gh-pages'
120-
path: 'dist/other-repo'
121122
- uses: actions/setup-node@v4
122123
with:
123124
node-version: 20
@@ -127,14 +128,21 @@ jobs:
127128
python-version: 3.9
128129
- run: npm ci
129130
- run: npm run build
130-
- name: Save previous data.js
131-
run: |
132-
cp ./dist/other-repo/dev/bench/data.js before_data.js
133131
- name: Run benchmark
134132
run: |
135133
cd examples/pytest
136134
pip install -r requirements.txt
137135
pytest bench.py --benchmark-json output.json
136+
137+
- uses: actions/checkout@v4
138+
with:
139+
repository: benchmark-action/github-action-benchmark-results
140+
ref: 'gh-pages'
141+
path: 'dist/other-repo'
142+
- name: Save previous data.js
143+
run: |
144+
cp ./dist/other-repo/dev/bench/data.js before_data.js
145+
138146
- name: Store benchmark result
139147
uses: ./
140148
with:
@@ -151,20 +159,12 @@ jobs:
151159
runs-on: ubuntu-20.04
152160
steps:
153161
- uses: actions/checkout@v4
154-
- uses: actions/checkout@v4
155-
with:
156-
repository: benchmark-action/github-action-benchmark-results
157-
ref: 'gh-pages'
158-
path: 'dist/other-repo'
159162
- uses: actions/setup-node@v4
160163
with:
161164
node-version: 20
162165
cache: 'npm'
163166
- run: npm ci
164167
- run: npm run build
165-
- name: Save previous data.js
166-
run: |
167-
cp ./dist/other-repo/dev/bench/data.js before_data.js
168168
- name: Cache Benchmark library
169169
uses: actions/cache@v4
170170
with:
@@ -174,6 +174,16 @@ jobs:
174174
run: |
175175
cd examples/cpp
176176
make json
177+
178+
- uses: actions/checkout@v4
179+
with:
180+
repository: benchmark-action/github-action-benchmark-results
181+
ref: 'gh-pages'
182+
path: 'dist/other-repo'
183+
- name: Save previous data.js
184+
run: |
185+
cp ./dist/other-repo/dev/bench/data.js before_data.js
186+
177187
- name: Store benchmark result
178188
uses: ./
179189
with:
@@ -190,27 +200,29 @@ jobs:
190200
runs-on: ubuntu-20.04
191201
steps:
192202
- uses: actions/checkout@v4
193-
- uses: actions/checkout@v4
194-
with:
195-
repository: benchmark-action/github-action-benchmark-results
196-
ref: 'gh-pages'
197-
path: 'dist/other-repo'
198203
- uses: actions/setup-node@v4
199204
with:
200205
node-version: 20
201206
cache: 'npm'
202207
- run: npm ci
203208
- run: npm run build
204-
- name: Save previous data.js
205-
run: |
206-
cp ./dist/other-repo/dev/bench/data.js before_data.js
207209
- name: Run benchmark
208210
run: |
209211
cd examples/catch2
210212
mkdir build && cd build
211213
cmake -DCMAKE_BUILD_TYPE=Release ..
212214
cmake --build . --config Release
213215
./Catch2_bench > ../benchmark_result.txt
216+
217+
- uses: actions/checkout@v4
218+
with:
219+
repository: benchmark-action/github-action-benchmark-results
220+
ref: 'gh-pages'
221+
path: 'dist/other-repo'
222+
- name: Save previous data.js
223+
run: |
224+
cp ./dist/other-repo/dev/bench/data.js before_data.js
225+
214226
- name: Store benchmark result
215227
uses: ./
216228
with:
@@ -227,20 +239,12 @@ jobs:
227239
runs-on: ubuntu-latest
228240
steps:
229241
- uses: actions/checkout@v4
230-
- uses: actions/checkout@v4
231-
with:
232-
repository: benchmark-action/github-action-benchmark-results
233-
ref: 'gh-pages'
234-
path: 'dist/other-repo'
235242
- uses: actions/setup-node@v4
236243
with:
237244
node-version: 20
238245
cache: 'npm'
239246
- run: npm ci
240247
- run: npm run build
241-
- name: Save previous data.js
242-
run: |
243-
cp ./dist/other-repo/dev/bench/data.js before_data.js
244248
- uses: julia-actions/setup-julia@v1
245249
with:
246250
version: '1'
@@ -252,6 +256,16 @@ jobs:
252256
using Pkg;
253257
Pkg.instantiate();
254258
include("fib.jl")'
259+
260+
- uses: actions/checkout@v4
261+
with:
262+
repository: benchmark-action/github-action-benchmark-results
263+
ref: 'gh-pages'
264+
path: 'dist/other-repo'
265+
- name: Save previous data.js
266+
run: |
267+
cp ./dist/other-repo/dev/bench/data.js before_data.js
268+
255269
- name: Store benchmark result
256270
uses: ./
257271
with:
@@ -268,11 +282,6 @@ jobs:
268282
runs-on: ubuntu-latest
269283
steps:
270284
- uses: actions/checkout@v4
271-
- uses: actions/checkout@v4
272-
with:
273-
repository: benchmark-action/github-action-benchmark-results
274-
ref: 'gh-pages'
275-
path: 'dist/other-repo'
276285
- uses: actions/setup-dotnet@v3
277286
with:
278287
dotnet-version: '6.0.101' # SDK Version to use. keep in line with examples/benchmarkdotnet/global.json
@@ -282,11 +291,18 @@ jobs:
282291
cache: 'npm'
283292
- run: npm ci
284293
- run: npm run build
294+
- name: Run benchmark
295+
run: cd examples/benchmarkdotnet && dotnet run --exporters json --filter '*'
296+
297+
- uses: actions/checkout@v4
298+
with:
299+
repository: benchmark-action/github-action-benchmark-results
300+
ref: 'gh-pages'
301+
path: 'dist/other-repo'
285302
- name: Save previous data.js
286303
run: |
287304
cp ./dist/other-repo/dev/bench/data.js before_data.js
288-
- name: Run benchmark
289-
run: cd examples/benchmarkdotnet && dotnet run --exporters json --filter '*'
305+
290306
- name: Store benchmark result
291307
uses: ./
292308
with:
@@ -303,11 +319,6 @@ jobs:
303319
runs-on: ubuntu-latest
304320
steps:
305321
- uses: actions/checkout@v4
306-
- uses: actions/checkout@v4
307-
with:
308-
repository: benchmark-action/github-action-benchmark-results
309-
ref: 'gh-pages'
310-
path: 'dist/other-repo'
311322
- uses: actions/setup-node@v4
312323
with:
313324
node-version: 20

0 commit comments

Comments
 (0)