1919
2020env :
2121 CARGO_TERM_COLOR : always
22+ DOCKER_BUILDKIT : 1
23+ # the branch or tag on which this workflow is triggered
24+ # `head_ref` will only be set if the triggering event is `pull_request`
25+ REF_VERSION : ${{ github.head_ref || github.ref_name }}
2226
2327concurrency :
2428 group : ${{ github.workflow }}-${{ github.ref }}
7377 - name : Run cargo fmt check
7478 run : make fmtcheck
7579
76- - name : Install taplo
77- run : cargo install taplo-cli --locked
80+ - name : Install pre-built taplo
81+ run : |
82+ mkdir -p $HOME/.local/bin
83+ wget -q https://github.com/tamasfe/taplo/releases/latest/download/taplo-linux-x86_64.gz
84+ gzip -d taplo-linux-x86_64.gz
85+ cp taplo-linux-x86_64 $HOME/.local/bin/taplo
86+ chmod a+x $HOME/.local/bin/taplo
87+ echo "$HOME/.local/bin" >> $GITHUB_PATH
7888
7989 - name : Run taplo fmt check
8090 run : make taplocheck
@@ -145,6 +155,10 @@ jobs:
145155 run : |
146156 [ -z "$(docker images --filter=dangling=true -q)" ] || docker rmi -f $(docker images --filter=dangling=true -q)
147157
158+ - name : Fail-fast; cancel other jobs
159+ if : failure()
160+ 161+
148162 run-ts-tests :
149163 runs-on : ubuntu-latest
150164 needs : build-docker
@@ -204,7 +218,7 @@ jobs:
204218 default : true
205219
206220 - name : Run unittests
207- run : cargo test --release -p pallet-* --lib
221+ run : cargo test --locked -- release -p pallet-* --lib
208222
209223 - name : Fail-fast; cancel other jobs
210224 if : failure()
@@ -228,7 +242,7 @@ jobs:
228242 default : true
229243
230244 - name : Run benchmarks
231- run : cargo test --release -p pallet-* --lib --features runtime-benchmarks
245+ run : cargo test --locked -- release -p pallet-* --lib --features runtime-benchmarks
232246
233247 - name : Fail-fast; cancel other jobs
234248 if : failure()
@@ -241,16 +255,17 @@ jobs:
241255 # This is required when setting github merge rules to protected branch,
242256 # where you can only select one of `run-cargo-runtime-tests` and `run-cargo-runtime-tests(litmus)`.
243257 # If you put if-check on the job level, it can't fit every possible case.
258+ #
259+ # Tried https://github.com/Swatinem/rust-cache too but it didn't work so well
244260 run-cargo-runtime-tests :
245261 runs-on : ubuntu-latest
246262 needs : [check-cargo-fmt, check-file-change]
247263 env :
248- RUST_BACKTRACE : full
249264 RUSTC_WRAPPER : sccache
250265 SCCACHE_CACHE_SIZE : 10G
251266 SCCACHE_DIR : /home/runner/.cache/sccache
252- CARGO_INCREMENTAL : 0
253267 strategy :
268+ fail-fast : true
254269 matrix :
255270 chain :
256271 - litmus
@@ -273,10 +288,9 @@ jobs:
273288 # use sccache to accelerate binary compilation
274289 # see https://www.infinyon.com/blog/2021/04/github-actions-best-practices/
275290 - name : Install sccache
276- if : needs.check-file-change.outputs.src == 'true'
277291 env :
278292 LINK : https://github.com/mozilla/sccache/releases/download
279- SCCACHE_VERSION : v0.2.15
293+ SCCACHE_VERSION : v0.3.0
280294 run : |
281295 SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
282296 mkdir -p $HOME/.local/bin
@@ -287,29 +301,31 @@ jobs:
287301
288302 - name : Cache cargo registry
289303 if : needs.check-file-change.outputs.src == 'true'
290- uses : actions/cache@v2
304+ uses : actions/cache@v3
291305 continue-on-error : false
292306 with :
293307 path : |
294308 ~/.cargo/registry
295309 ~/.cargo/git
296- key : cargo-${{ hashFiles('**/Cargo.lock') }}
310+ key : cargo-${{ env.REF_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
297311 restore-keys : |
312+ cargo-${{ env.REF_VERSION }}-
298313 cargo-
299314
300315 - name : Cache sccache
301316 if : needs.check-file-change.outputs.src == 'true'
302- uses : actions/cache@v2
317+ uses : actions/cache@v3
303318 continue-on-error : false
304319 with :
305320 path : /home/runner/.cache/sccache
306- key : sccache-${{ hashFiles('**/Cargo.lock') }}
321+ key : sccache-${{ env.REF_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
307322 restore-keys : |
323+ sccache-${{ env.REF_VERSION }}-
308324 sccache-
309325
310326 - name : Run runtime integration tests
311327 if : needs.check-file-change.outputs.src == 'true'
312- run : cargo test --release -p ${{ matrix.chain }}-parachain-runtime --lib
328+ run : cargo test --locked -- release -p ${{ matrix.chain }}-parachain-runtime --lib
313329
314330 - name : Print sccache stats
315331 if : needs.check-file-change.outputs.src == 'true'
@@ -343,7 +359,7 @@ jobs:
343359 docker load -i litentry-parachain.tar
344360
345361 - name : Dockerhub login
346- uses : docker/login-action@v1
362+ uses : docker/login-action@v2
347363 with :
348364 username : ${{ secrets.DOCKERHUB_USERNAME }}
349365 password : ${{ secrets.DOCKERHUB_PASSWORD }}
0 commit comments