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
This commit is contained in:
teor 2022-09-08 00:32:41 +10:00 committed by GitHub
parent 4810f44564
commit 463907965a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 10 deletions

View File

@ -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

View File

@ -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: