Skip to content

Commit f048a68

Browse files
committed
Add workaround for bug in macOS CI cache.
1 parent 3879c49 commit f048a68

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/macos-builds-on-all.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
uses: actions/cache@v2
5858
with:
5959
path: target
60-
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
61-
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
60+
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}-3
61+
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}-3
6262
- name: Install Rustup using ./rustup-init.sh
6363
run: |
6464
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
@@ -92,3 +92,9 @@ jobs:
9292
run: |
9393
cargo install cargo-cache --no-default-features --features ci-autoclean
9494
cargo-cache
95+
- name: Flush cache
96+
# This is a workaround for a bug with GitHub Actions Cache that causes
97+
# corrupt cache entries (particularly in the target directory). See
98+
# https://github.com/actions/cache/issues/403 and
99+
# https://github.com/rust-lang/cargo/issues/8603.
100+
run: sudo /usr/sbin/purge

ci/actions-templates/macos-builds-template.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
uses: actions/cache@v2
5858
with:
5959
path: target
60-
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
61-
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}
60+
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}-3
61+
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }}-3
6262
- name: Install Rustup using ./rustup-init.sh
6363
run: |
6464
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
@@ -92,3 +92,9 @@ jobs:
9292
run: |
9393
cargo install cargo-cache --no-default-features --features ci-autoclean
9494
cargo-cache
95+
- name: Flush cache
96+
# This is a workaround for a bug with GitHub Actions Cache that causes
97+
# corrupt cache entries (particularly in the target directory). See
98+
# https://github.com/actions/cache/issues/403 and
99+
# https://github.com/rust-lang/cargo/issues/8603.
100+
run: sudo /usr/sbin/purge

0 commit comments

Comments
 (0)