From 463907965a27579b9d7974414ff38d14899d2271 Mon Sep 17 00:00:00 2001 From: teor Date: Thu, 8 Sep 2022 00:32:41 +1000 Subject: [PATCH] fix(ci): Simplify GitHub actions caches (#5104) * Disable fmt cache and create shared clippy cache * Make Cargo.lock check use the shared clippy cache * Add a TODO for Windows Rust cache path * Fix quoting for Windows path * Use correct sharedKey spelling --- .../workflows/continous-integration-os.yml | 25 ++++++++++++------- .github/workflows/lint.yml | 7 +++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/continous-integration-os.yml b/.github/workflows/continous-integration-os.yml index 5ab5c8ec..e8c0cc32 100644 --- a/.github/workflows/continous-integration-os.yml +++ b/.github/workflows/continous-integration-os.yml @@ -91,6 +91,19 @@ jobs: override: true - uses: Swatinem/rust-cache@v1 + # TODO: change Rust cache target directory on Windows, + # or remove this workaround once the build is more efficient (#3005). + #with: + # workspaces: ". -> C:\\zebra-target" + + - name: Change target output directory on Windows + # Windows doesn't have enough space on the D: drive, so we redirect the build output to the + # larger C: drive. + # TODO: Remove this workaround once the build is more efficient (#3005). + if: matrix.os == 'windows-latest' + run: | + mkdir "C:\\zebra-target" + echo "CARGO_TARGET_DIR=C:\\zebra-target" | Out-File -FilePath "$env:GITHUB_ENV" -Encoding utf8 -Append - name: cargo fetch uses: actions-rs/cargo@v1.0.3 @@ -123,15 +136,6 @@ jobs: echo "PROPTEST_CASES=1" >> $GITHUB_ENV echo "PROPTEST_MAX_SHRINK_ITERS=1024" >> $GITHUB_ENV - - name: Change target output directory on Windows - # Windows doesn't have enough space on the D: drive, so we redirect the build output to the - # larger C: drive. - # TODO: Remove this workaround once the build is more efficient (#3005). - if: matrix.os == 'windows-latest' - run: | - mkdir C:\zebra-target - echo "CARGO_TARGET_DIR=C:\zebra-target" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - # Modified from: # https://github.com/zcash/librustzcash/blob/c48bb4def2e122289843ddb3cb2984c325c03ca0/.github/workflows/ci.yml#L20-L33 # @@ -218,6 +222,9 @@ jobs: override: true - uses: Swatinem/rust-cache@v1 + with: + # TODO: change to shared-key when we switch to Swatinem/rust-cache@v2 + sharedKey: "clippy-cargo-lock" - name: Check Cargo.lock is up to date uses: actions-rs/cargo@v1.0.3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1dfc15a9..7b3d8a62 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -83,6 +83,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: Swatinem/rust-cache@v1 + with: + # TODO: change to shared-key when we switch to Swatinem/rust-cache@v2 + sharedKey: "clippy-cargo-lock" - name: Run clippy action to produce annotations uses: actions-rs/clippy-check@v1.0.7 @@ -127,7 +130,9 @@ jobs: components: rustfmt override: true - - uses: Swatinem/rust-cache@v1 + # We don't cache `fmt` outputs because the job is quick, + # and we want to use the limited GitHub actions cache space for slower jobs. + #- uses: Swatinem/rust-cache@v1 - uses: actions-rs/cargo@v1.0.3 with: