Skip to content

Commit 3b52cb4

Browse files
committed
ci: do not rerun jobs that did not fail when retrying jobs on github actions [skip circle] [skip appveyor]
1 parent f337f66 commit 3b52cb4

File tree

2 files changed

+99
-13
lines changed

2 files changed

+99
-13
lines changed

.github/workflows/build-and-release.yaml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,18 @@ jobs:
5757
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
5858
NODE_LIBCURL_CPP_STD: c++11
5959
steps:
60+
- id: timestamp
61+
run: echo "::set-output name=timestamp::$(timestamp +%s)"
62+
- name: Restore the previous run result
63+
uses: actions/cache@v2
64+
with:
65+
path: |
66+
run_result
67+
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
68+
restore-keys: |
69+
${{ github.run_id }}-${{ github.job }}-
70+
- id: run_result
71+
run: cat run_result 2>/dev/null || echo 'default'
6072
- name: Checkout
6173
uses: actions/checkout@main
6274
- name: Setup Node.js
@@ -109,15 +121,17 @@ jobs:
109121
if: startsWith(github.ref, 'refs/tags')
110122
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
111123
- name: 'Publish Binary'
124+
if: steps.run_result.outputs.run_result != 'success'
112125
run: |
113126
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
114127
- name: Upload artifacts
115-
if: always()
128+
if: always() && steps.run_result.outputs.run_result != 'success'
116129
uses: actions/upload-artifact@v2
117130
with:
118131
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}
119132
path: ./logs/
120133
retention-days: 5
134+
- run: echo "::set-output name=run_result::success" > run_result
121135

122136
build-and-release-electron:
123137
runs-on: ${{ matrix.os }}
@@ -144,6 +158,18 @@ jobs:
144158
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
145159
ELECTRON_VERSION: ${{ matrix.electron-version }}
146160
steps:
161+
- id: timestamp
162+
run: echo "::set-output name=timestamp::$(timestamp +%s)"
163+
- name: Restore the previous run result
164+
uses: actions/cache@v2
165+
with:
166+
path: |
167+
run_result
168+
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
169+
restore-keys: |
170+
${{ github.run_id }}-${{ github.job }}-
171+
- id: run_result
172+
run: cat run_result 2>/dev/null || echo 'default'
147173
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
148174
- name: Checkout
149175
uses: actions/checkout@main
@@ -198,15 +224,17 @@ jobs:
198224
if: startsWith(github.ref, 'refs/tags')
199225
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
200226
- name: 'Publish Binary'
227+
if: steps.run_result.outputs.run_result != 'success'
201228
run: |
202229
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
203230
- name: Upload artifacts
204-
if: always()
231+
if: always() && steps.run_result.outputs.run_result != 'success'
205232
uses: actions/upload-artifact@v2
206233
with:
207234
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}
208235
path: ./logs/
209236
retention-days: 5
237+
- run: echo "::set-output name=run_result::success" > run_result
210238

211239
build-and-release-nwjs:
212240
runs-on: ${{ matrix.os }}
@@ -231,6 +259,18 @@ jobs:
231259
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
232260
NWJS_VERSION: ${{ matrix.nwjs-version }}
233261
steps:
262+
- id: timestamp
263+
run: echo "::set-output name=timestamp::$(timestamp +%s)"
264+
- name: Restore the previous run result
265+
uses: actions/cache@v2
266+
with:
267+
path: |
268+
run_result
269+
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
270+
restore-keys: |
271+
${{ github.run_id }}-${{ github.job }}-
272+
- id: run_result
273+
run: cat run_result 2>/dev/null || echo 'default'
234274
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
235275
- name: Checkout
236276
uses: actions/checkout@main
@@ -277,12 +317,14 @@ jobs:
277317
if: startsWith(github.ref, 'refs/tags')
278318
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
279319
- name: 'Publish Binary'
320+
if: steps.run_result.outputs.run_result != 'success'
280321
run: |
281322
GIT_COMMIT=${{ github.sha }} GIT_TAG=$GIT_TAG ./scripts/ci/build.sh
282323
- name: Upload artifacts
283-
if: always()
324+
if: always() && steps.run_result.outputs.run_result != 'success'
284325
uses: actions/upload-artifact@v2
285326
with:
286327
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.nwjs-version }}
287328
path: ./logs/
288329
retention-days: 5
330+
- run: echo "::set-output name=run_result::success" > run_result

.github/workflows/build-lint-test.yaml

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ jobs:
5151
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
5252
NODE_LIBCURL_CPP_STD: c++11
5353
steps:
54+
- id: timestamp
55+
run: echo "::set-output name=timestamp::$(timestamp +%s)"
56+
- name: Restore the previous run result
57+
uses: actions/cache@v2
58+
with:
59+
path: |
60+
run_result
61+
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
62+
restore-keys: |
63+
${{ github.run_id }}-${{ github.job }}-
64+
- id: run_result
65+
run: cat run_result 2>/dev/null || echo 'default'
5466
- name: Checkout
5567
uses: actions/checkout@main
5668
- name: Setup Node.js
@@ -99,35 +111,39 @@ jobs:
99111
key: v4-build-lint-test-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}
100112
restore-keys: |
101113
v4-build-lint-test-${{ runner.os }}-libcurl-deps-cache-node-${{ matrix.node }}
102-
- name: 'Install all the stuff'
114+
- name: 'Build node-libcurl'
115+
if: steps.run_result.outputs.run_result != 'success'
103116
run: |
104117
RUN_TESTS=false \
105118
RUN_PREGYP_CLEAN=false \
106119
PUBLISH_BINARY=false \
107120
./scripts/ci/build.sh
108-
# We could have used lerna to run only on changed here...
109121
- name: 'Run lint'
122+
if: matrix.run-lint-and-tsc && steps.run_result.outputs.run_result != 'success'
110123
run: yarn lint
111-
if: matrix.run-lint-and-tsc
112124
- name: 'Run tsc'
125+
if: matrix.run-lint-and-tsc && steps.run_result.outputs.run_result != 'success'
113126
run: yarn build:dist
114-
if: matrix.run-lint-and-tsc
127+
# we do run tests in all matrix jobs
115128
- name: 'Run tests'
129+
if: steps.run_result.outputs.run_result != 'success'
116130
run: yarn test:coverage
131+
# but coverage is only sent for the run-lint-and-tsc job
117132
- name: Upload coverage to Codecov
118-
if: matrix.run-lint-and-tsc
133+
if: matrix.run-lint-and-tsc && steps.run_result.outputs.run_result != 'success'
119134
uses: codecov/codecov-action@v1
120135
with:
121136
token: ${{ secrets.CODECOV_TOKEN }}
122137
file: ./coverage/**
123138
fail_ci_if_error: false
124139
- name: Upload artifacts
125-
if: always()
140+
if: always() && steps.run_result.outputs.run_result != 'success'
126141
uses: actions/upload-artifact@v2
127142
with:
128143
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.node }}
129144
path: ./logs/
130145
retention-days: 3
146+
- run: echo "::set-output name=run_result::success" > run_result
131147

132148
build-and-test-electron:
133149
runs-on: ${{ matrix.os }}
@@ -154,6 +170,18 @@ jobs:
154170
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
155171
ELECTRON_VERSION: ${{ matrix.electron-version }}
156172
steps:
173+
- id: timestamp
174+
run: echo "::set-output name=timestamp::$(timestamp +%s)"
175+
- name: Restore the previous run result
176+
uses: actions/cache@v2
177+
with:
178+
path: |
179+
run_result
180+
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
181+
restore-keys: |
182+
${{ github.run_id }}-${{ github.job }}-
183+
- id: run_result
184+
run: cat run_result 2>/dev/null || echo 'default'
157185
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
158186
if: matrix.node-libcurl-cpp-std
159187
- name: Checkout
@@ -208,19 +236,21 @@ jobs:
208236
- name: 'Set GIT_TAG'
209237
if: startsWith(github.ref, 'refs/tags')
210238
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
211-
- name: 'Publish Binary'
239+
- name: 'Build node-libcurl'
240+
if: steps.run_result.outputs.run_result != 'success'
212241
run: |
213242
RUN_TESTS=true \
214243
RUN_PREGYP_CLEAN=false \
215244
PUBLISH_BINARY=false \
216245
./scripts/ci/build.sh
217246
- name: Upload artifacts
218-
if: always()
247+
if: always() && steps.run_result.outputs.run_result != 'success'
219248
uses: actions/upload-artifact@v2
220249
with:
221250
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.electron-version }}
222251
path: ./logs/
223252
retention-days: 5
253+
- run: echo "::set-output name=run_result::success" > run_result
224254

225255
build-and-test-nwjs:
226256
runs-on: ${{ matrix.os }}
@@ -245,6 +275,18 @@ jobs:
245275
LATEST_LIBCURL_RELEASE: ${{ matrix.libcurl-release }}
246276
NWJS_VERSION: ${{ matrix.nwjs-version }}
247277
steps:
278+
- id: timestamp
279+
run: echo "::set-output name=timestamp::$(timestamp +%s)"
280+
- name: Restore the previous run result
281+
uses: actions/cache@v2
282+
with:
283+
path: |
284+
run_result
285+
key: ${{ github.run_id }}-${{ github.job }}-${{ steps.timestamp.outputs.timestamp }}
286+
restore-keys: |
287+
${{ github.run_id }}-${{ github.job }}-
288+
- id: run_result
289+
run: cat run_result 2>/dev/null || echo 'default'
248290
- run: echo "NODE_LIBCURL_CPP_STD=${{ matrix.node-libcurl-cpp-std }}" >> $GITHUB_ENV
249291
- name: Checkout
250292
uses: actions/checkout@main
@@ -290,16 +332,18 @@ jobs:
290332
- name: 'Set GIT_TAG'
291333
if: startsWith(github.ref, 'refs/tags')
292334
run: echo "GIT_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
293-
- name: 'Publish Binary'
335+
- name: 'Build node-libcurl'
336+
if: steps.run_result.outputs.run_result != 'success'
294337
run: |
295338
RUN_TESTS=false \
296339
RUN_PREGYP_CLEAN=false \
297340
PUBLISH_BINARY=false \
298341
./scripts/ci/build.sh
299342
- name: Upload artifacts
300-
if: always()
343+
if: always() && steps.run_result.outputs.run_result != 'success'
301344
uses: actions/upload-artifact@v2
302345
with:
303346
name: build-logs-${{ matrix.os }}-${{ matrix.libcurl-release }}-${{ matrix.nwjs-version }}
304347
path: ./logs/
305348
retention-days: 5
349+
- run: echo "::set-output name=run_result::success" > run_result

0 commit comments

Comments
 (0)