Cache tools and Rust build output in CI and release builds
This commit is contained in:
@@ -14,6 +14,25 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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
|
- name: Install tools
|
||||||
run: scripts/ci-setup.sh
|
run: scripts/ci-setup.sh
|
||||||
- name: Unit tests
|
- name: Unit tests
|
||||||
|
|||||||
@@ -24,6 +24,27 @@ jobs:
|
|||||||
CARGO_BUILD_JOBS: "2"
|
CARGO_BUILD_JOBS: "2"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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
|
- name: Install tools
|
||||||
run: scripts/ci-setup.sh --windows
|
run: scripts/ci-setup.sh --windows
|
||||||
- name: Take the version from the tag
|
- name: Take the version from the tag
|
||||||
|
|||||||
+5
-2
@@ -16,6 +16,9 @@ fi
|
|||||||
$SUDO apt-get update -q
|
$SUDO apt-get update -q
|
||||||
$SUDO apt-get install -yq --no-install-recommends "${packages[@]}"
|
$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.
|
# Rust: not pinned in mise.toml, because mise needs rustup for it.
|
||||||
if ! command -v cargo >/dev/null; then
|
if ! command -v cargo >/dev/null; then
|
||||||
curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
|
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
|
if [[ "${1:-}" == "--windows" ]]; then
|
||||||
rustup target add x86_64-pc-windows-msvc
|
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
|
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/bin" >> "$GITHUB_PATH"
|
||||||
echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH"
|
echo "$HOME/.local/share/mise/shims" >> "$GITHUB_PATH"
|
||||||
export PATH="$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH"
|
export PATH="$HOME/.local/bin:$HOME/.local/share/mise/shims:$PATH"
|
||||||
|
|||||||
Reference in New Issue
Block a user