From 1bbc70393c862a104fd5349a8324e88b50842f34 Mon Sep 17 00:00:00 2001 From: Jose Quintana <1700322+joseluisq@users.noreply.github.com> Date: Mon, 8 Jan 2024 02:14:39 +0100 Subject: [PATCH] refactor: cache rust toolchain & cargo dirs for ci devel workflow (#300) --- .github/workflows/devel.yml | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/devel.yml b/.github/workflows/devel.yml index a228514..5c82ff9 100644 --- a/.github/workflows/devel.yml +++ b/.github/workflows/devel.yml @@ -28,6 +28,7 @@ jobs: name: test runs-on: ${{ matrix.os }} env: + # Cargo binary CARGO_BIN: cargo # When CARGO_BIN is set to CROSS, this is set to `--target matrix.target` TARGET_FLAGS: "" @@ -41,8 +42,6 @@ jobs: matrix: build: - pinned - - stable - - beta - linux-musl - linux-musl-arm64 - linux-musl-i686 @@ -66,16 +65,11 @@ jobs: - windows-msvc-arm64 - windows-pc-gnu include: - # Specific Rust channels + # Specific Rust channels. + # We test against the latest and minimum Rust stable version. - build: pinned os: ubuntu-22.04 rust: 1.70.0 - - build: stable - os: ubuntu-22.04 - rust: stable - - build: beta - os: ubuntu-22.04 - rust: beta # Some of our release builds are generated by a nightly compiler to take # advantage of the latest optimizations/compile time improvements. - build: linux-musl @@ -165,10 +159,24 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 + - name: Cache Rust Cargo/Toolchain + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ~/.rustup + **/target + key: rust-${{ matrix.build }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + rust-${{ matrix.build }}-${{ matrix.target }}- + - name: Install Linux/BSD tools if: ${{ !contains(matrix.os, 'windows') }} run: scripts/ci/install_tools.sh --target=${{ matrix.target }} @@ -187,7 +195,7 @@ jobs: if [[ "${{ matrix.build }}" == "linux-android-armv7" ]] || [[ "${{ matrix.build }}" == "linux-android-arm64" ]]; then echo "CARGO_BIN=scripts/ci/cargo.sh" >> $GITHUB_ENV else - cargo install cross@^0.2 + cargo install --force cross@^0.2 echo "CARGO_BIN=cross" >> $GITHUB_ENV fi @@ -247,7 +255,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 -- libgit2 1.7.2