From 869f169aff32d2df2b7bf972c7b6d540ddd6138b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirek=20Wr=C3=B3bel?= Date: Thu, 15 Oct 2026 05:42:33 +0200 Subject: [PATCH] Share one tool cache between CI and release builds, fall back to the last tools after a mise.toml change, and cache the Windows tools on their own --- .gitea/workflows/ci.yaml | 7 ++++++- .gitea/workflows/release.yaml | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index ebee0c2..cbe04d0 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -14,6 +14,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + # The same tool cache as in release.yaml: the same key and the same folders, or + # neither job can use what the other saved. - name: Restore tool cache uses: actions/cache@v4 with: @@ -24,7 +26,10 @@ jobs: ~/.rustup ~/.local/bin/mise ~/.local/share/mise - key: tools-check-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} + key: tools-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} + # After a change to mise.toml, start from the last tools; mise installs only what changed. + restore-keys: | + tools- - name: Restore build cache uses: actions/cache@v4 with: diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index a935d7d..fd52176 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -24,10 +24,11 @@ jobs: CARGO_BUILD_JOBS: "2" steps: - uses: actions/checkout@v4 + # The same tool cache as in ci.yaml: the same key and the same folders, or + # neither job can use what the other saved. - name: Restore tool cache uses: actions/cache@v4 with: - # ~/.cache/cargo-xwin holds the Windows SDK files cargo-xwin downloads. path: | ~/.cargo/bin ~/.cargo/registry @@ -35,8 +36,22 @@ jobs: ~/.rustup ~/.local/bin/mise ~/.local/share/mise + key: tools-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} + # After a change to mise.toml, start from the last tools; mise installs only what changed. + restore-keys: | + tools- + # What only the Windows build needs. It is restored after the tool cache, so these + # folders are added to it. ~/.cache/cargo-xwin holds the Windows SDK files cargo-xwin downloads. + - name: Restore Windows tool cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/cargo-xwin + ~/.rustup/toolchains/*/lib/rustlib/x86_64-pc-windows-msvc ~/.cache/cargo-xwin - key: tools-release-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} + key: windows-tools-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} + restore-keys: | + windows-tools- - name: Restore build cache uses: actions/cache@v4 with: