Skip to content

Commit

Permalink
[ci] Remove shared key for cache and add cache for migrations (#142)
Browse files Browse the repository at this point in the history
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 #134

---------

Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
  • Loading branch information
alvicsam and fellowship-merge-bot[bot] authored Jan 17, 2024
1 parent 7515fc0 commit 418a2a9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# drop permissions for default token
permissions: {}

jobs:
runtime-matrix:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -51,13 +54,19 @@ jobs:
chmod +x ./try-runtime
- name: Install Protoc
uses: arduino/setup-protoc@v1
uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0
with:
version: "3.6.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Add wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown

- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "fellowship-cache-migrations"

- name: Build ${{ matrix.runtime.name }}
run: |
cargo build --profile production -p ${{ matrix.runtime.package }} --features try-runtime -q --locked
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ name: "Clippy"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
workflow_dispatch:

# cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
clippy:
runs-on: ubuntu-22.04
Expand All @@ -28,7 +33,7 @@ jobs:
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "fellowship-cache"
shared-key: "fellowship-cache-clippy"

- name: Clippy
run: cargo +nightly clippy --all-targets --locked -q
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ name: "Test all features"

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]
workflow_dispatch:

# cancel previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -51,7 +56,7 @@ jobs:
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "fellowship-cache"
shared-key: "fellowship-cache-tests"

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

0 comments on commit 418a2a9

Please sign in to comment.