]> Untitled Git - bdk/commitdiff
[ci] Generate a different cache key for every job
authorAlekos Filini <alekos.filini@gmail.com>
Thu, 19 Nov 2020 11:20:49 +0000 (12:20 +0100)
committerAlekos Filini <alekos.filini@gmail.com>
Thu, 19 Nov 2020 12:59:19 +0000 (13:59 +0100)
.github/workflows/cont_integration.yml

index fa4430b5d1b990af6031570422fae826039c39b4..e13718ea57a018f231e3bd5a6cbb62ef02c8b3e2 100644 (file)
@@ -32,6 +32,8 @@ jobs:
     steps:
       - name: checkout
         uses: actions/checkout@v2
+      - name: Generate cache key
+        run: echo "${{ matrix.rust }} ${{ matrix.features }}" | tee .cache_key
       - name: cache
         uses: actions/cache@v2
         with:
@@ -39,7 +41,7 @@ jobs:
             ~/.cargo/registry
             ~/.cargo/git
             target
-          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
+          key: ${{ runner.os }}-cargo-${{ hashFiles('.cache_key') }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
       - name: Set default toolchain
         run: rustup default ${{ matrix.rust }}
       - name: Set profile
@@ -75,7 +77,7 @@ jobs:
             ~/.cargo/registry
             ~/.cargo/git
             target
-          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
+          key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
       - name: Install rustup
         run: curl https://sh.rustup.rs -sSf | sh -s -- -y
       - name: Set default toolchain
@@ -103,7 +105,7 @@ jobs:
             ~/.cargo/registry
             ~/.cargo/git
             target
-          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
+          key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
         # Install a recent version of clang that supports wasm32
       - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1
       - run: sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-10 main" || exit 1
@@ -131,4 +133,4 @@ jobs:
       - name: Add clippy
         run: rustup component add rustfmt
       - name: Check fmt
-        run: cargo fmt --all -- --check
\ No newline at end of file
+        run: cargo fmt --all -- --check