ci: improve caching, use taiki-e/install-action where possible, add sccache, optimize dependency setup

This commit is contained in:
Ryan Walters
2025-08-20 09:37:53 -05:00
parent 50f53eccf1
commit 047ee8b1e4
2 changed files with 28 additions and 10 deletions

View File

@@ -7,6 +7,9 @@ on:
env:
CARGO_TERM_COLOR: always
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: "2G"
jobs:
build:
@@ -18,6 +21,23 @@ jobs:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install sccache
uses: taiki-e/install-action@sccache
- name: Configure sccache
uses: actions/github-script@v7
with:
script: |
core.exportVariable("ACTIONS_RESULTS_URL", process.env.ACTIONS_RESULTS_URL || "");
core.exportVariable("ACTIONS_RUNTIME_TOKEN", process.env.ACTIONS_RUNTIME_TOKEN || "");
- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
- name: Setup pnpm
uses: pnpm/action-setup@v4
@@ -31,16 +51,14 @@ jobs:
cache: "pnpm"
- name: Install JS deps
run: pnpm install --frozen-lockfile
run: pnpm install --frozen-lockfile --prefer-offline
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
sudo apt-get install -y --no-install-recommends \
build-essential \
libxdo-dev \
libssl-dev \
libglib2.0-dev \
libwebkit2gtk-4.1-dev \
libayatana-appindicator3-dev \
@@ -63,3 +81,7 @@ jobs:
- name: Run tests
run: cargo test --manifest-path src-tauri/Cargo.toml --all-features
- name: sccache stats
if: always()
run: sccache --show-stats

View File

@@ -51,17 +51,13 @@ jobs:
patchelf
- name: Install cargo-udeps
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-udeps
uses: taiki-e/install-action@cargo-udeps
- name: Check for unused dependencies
run: cargo +nightly udeps --manifest-path src-tauri/Cargo.toml --all-targets
- name: Install cargo-machete
uses: taiki-e/cache-cargo-install-action@v2
with:
tool: cargo-machete
uses: taiki-e/install-action@cargo-machete
- name: Check for unused Cargo.toml dependencies
run: cargo machete src-tauri/