diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 5af2493..ebee0c2 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -14,6 +14,25 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Restore tool cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin + ~/.cargo/registry + ~/.cargo/git + ~/.rustup + ~/.local/bin/mise + ~/.local/share/mise + key: tools-check-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} + - name: Restore build cache + uses: actions/cache@v4 + with: + path: src-tauri/target + key: target-check-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ github.sha }} + restore-keys: | + target-check-${{ hashFiles('src-tauri/Cargo.lock') }}- + target-check- - name: Install tools run: scripts/ci-setup.sh - name: Unit tests diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 92ba27b..bdd3e93 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -24,6 +24,27 @@ jobs: CARGO_BUILD_JOBS: "2" steps: - uses: actions/checkout@v4 + - 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 + ~/.cargo/git + ~/.rustup + ~/.local/bin/mise + ~/.local/share/mise + ~/.cache/cargo-xwin + key: tools-release-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} + - name: Restore build cache + uses: actions/cache@v4 + with: + path: src-tauri/target + key: target-release-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ github.sha }} + restore-keys: | + target-release-${{ hashFiles('src-tauri/Cargo.lock') }}- + target-release- - name: Install tools run: scripts/ci-setup.sh --windows - name: Take the version from the tag diff --git a/scripts/ci-setup.sh b/scripts/ci-setup.sh index 4021439..49d8ff9 100755 --- a/scripts/ci-setup.sh +++ b/scripts/ci-setup.sh @@ -16,6 +16,9 @@ fi $SUDO apt-get update -q $SUDO apt-get install -yq --no-install-recommends "${packages[@]}" +# Rust, cargo-xwin and mise may already be here from the CI cache. +export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH" + # Rust: not pinned in mise.toml, because mise needs rustup for it. if ! command -v cargo >/dev/null; then curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal @@ -25,10 +28,10 @@ export PATH="$HOME/.cargo/bin:$PATH" if [[ "${1:-}" == "--windows" ]]; then rustup target add x86_64-pc-windows-msvc - cargo install --locked cargo-xwin + command -v cargo-xwin >/dev/null || cargo install --locked cargo-xwin fi -curl -fsSL https://mise.run | MISE_VERSION=v2026.9.1 sh +command -v mise >/dev/null || curl -fsSL https://mise.run | MISE_VERSION=v2026.9.1 sh echo "$HOME/.local/bin" >> "$GITHUB_PATH" echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH" export PATH="$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH"