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