From 3dd95aa7c20fa56c5d964c51e9a2c1342a801021 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Wed, 31 Jul 2024 13:35:34 +0100 Subject: [PATCH 1/2] Always use rust-cache after selecting toolchain. Otherwise, the cache will only be kept for the default toolchain. --- .github/workflows/appimage.yml | 4 ++-- .github/workflows/rust.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index cde161a3..ebee574a 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -137,13 +137,13 @@ jobs: mv /home/runner/.nvm $HOME mv /home/runner/.rustup $HOME - - uses: Swatinem/rust-cache@v2 - - name: Install toolchain run: | rustup toolchain install stable rustup default stable + - uses: Swatinem/rust-cache@v2 + - name: Build packetry binary run: | cargo build --release diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4f84e0ba..988deebc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,13 +23,13 @@ jobs: packages: libgtk-4-dev build-essential version: 2 - - uses: Swatinem/rust-cache@v2 - - name: Install toolchain run: | rustup toolchain install stable rustup default stable + - uses: Swatinem/rust-cache@v2 + - name: Run clippy run: cargo clippy -- --deny warnings From f7362dbd16e76b14872b6ef9fab3f7878f61f9d5 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Wed, 31 Jul 2024 13:09:10 +0100 Subject: [PATCH 2/2] CI: Enable rust caching for Windows, if vcpkg dependencies unchanged. Our non-Rust dependency versions are fixed on Windows by our choice of vcpkg commit ID, so by using this as a key to the rust-cache action, we can cache safely. --- .github/workflows/rust.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 988deebc..818bb31e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -44,6 +44,7 @@ jobs: runs-on: ${{ matrix.os }} env: + VCPKG_COMMIT: 01f602195983451bc83e72f4214af2cbc495aa94 # 2024.05.24 release VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg/installed steps: @@ -54,6 +55,11 @@ jobs: rustup toolchain install ${{ matrix.rust }} rustup default ${{ matrix.rust }} + - uses: Swatinem/rust-cache@v2 + with: + env-vars: VCPKG_COMMIT + if: runner.os == 'Windows' + - uses: awalsh128/cache-apt-pkgs-action@latest with: packages: libgtk-4-dev build-essential @@ -79,7 +85,7 @@ jobs: - name: Install dependencies (Windows) uses: lukka/run-vcpkg@v11 with: - vcpkgGitCommitId: 01f602195983451bc83e72f4214af2cbc495aa94 # 2024.05.24 release + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }} runVcpkgInstall: true doNotCache: false if: matrix.os == 'windows-latest'