Skip to content

Commit 418a2a9

Browse files
[ci] Remove shared key for cache and add cache for migrations (polkadot-fellows#142)
PR removes shared key for rust-cache action. When 2 different workflows use the same shared-key they try to use the same destination for cache which makes it unusable for them (they have race condition who will be the first to write there). Also PR adds cache for migration jobs and cancelling jobs on previous runs. cc polkadot-fellows#134 --------- Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
1 parent 7515fc0 commit 418a2a9

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

.github/workflows/check-migrations.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ concurrency:
1313
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1414
cancel-in-progress: true
1515

16+
# drop permissions for default token
17+
permissions: {}
18+
1619
jobs:
1720
runtime-matrix:
1821
runs-on: ubuntu-latest
@@ -51,13 +54,19 @@ jobs:
5154
chmod +x ./try-runtime
5255
5356
- name: Install Protoc
54-
uses: arduino/setup-protoc@v1
57+
uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0
5558
with:
5659
version: "3.6.1"
60+
repo-token: ${{ secrets.GITHUB_TOKEN }}
5761

5862
- name: Add wasm32-unknown-unknown target
5963
run: rustup target add wasm32-unknown-unknown
6064

65+
- name: Fetch cache
66+
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
67+
with:
68+
shared-key: "fellowship-cache-migrations"
69+
6170
- name: Build ${{ matrix.runtime.name }}
6271
run: |
6372
cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime -q --locked

.github/workflows/clippy.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ name: "Clippy"
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ["main"]
88
workflow_dispatch:
99

10+
# cancel previous runs
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
1015
jobs:
1116
clippy:
1217
runs-on: ubuntu-22.04
@@ -28,7 +33,7 @@ jobs:
2833
- name: Fetch cache
2934
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
3035
with:
31-
shared-key: "fellowship-cache"
36+
shared-key: "fellowship-cache-clippy"
3237

3338
- name: Clippy
3439
run: cargo +nightly clippy --all-targets --locked -q

.github/workflows/test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ name: "Test all features"
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
66
pull_request:
7-
branches: [ "main" ]
7+
branches: ["main"]
88
workflow_dispatch:
99

10+
# cancel previous runs
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
1015
jobs:
1116
test:
1217
runs-on: ubuntu-22.04
@@ -51,7 +56,7 @@ jobs:
5156
- name: Fetch cache
5257
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
5358
with:
54-
shared-key: "fellowship-cache"
59+
shared-key: "fellowship-cache-tests"
5560

5661
- name: Test
5762
run: cargo test --workspace --release --locked -q --features=runtime-metrics,try-runtime

0 commit comments

Comments
 (0)