ci: add action/cache to speed up builds
Some checks failed
Build MIPS Binary / build (push) Has been cancelled

This commit is contained in:
spinline
2026-02-06 21:49:09 +03:00
parent d17bfc88ad
commit c64c95233f

View File

@@ -22,7 +22,46 @@ jobs:
git fetch --depth=1 origin ${{ gitea.sha }} git fetch --depth=1 origin ${{ gitea.sha }}
git checkout FETCH_HEAD git checkout FETCH_HEAD
- name: Cache Cargo & Tools
uses: actions/cache@v3
id: cache-cargo
with:
path: |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-tools-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-tools-
- name: Cache Node.js & Zig
uses: actions/cache@v3
id: cache-tools
with:
path: |
~/.node
~/zig
key: ${{ runner.os }}-tools-node-20-zig-0.13.0
- name: Check Cache & Skip Installs
id: check-cache
run: |
if [ -d "$HOME/.node/bin" ]; then
echo "Node.js found in cache."
echo "NODE_CACHED=true" >> $GITHUB_ENV
echo "$HOME/.node/bin" >> $GITHUB_PATH
fi
if [ -d "$HOME/zig" ]; then
echo "Zig found in cache."
echo "ZIG_CACHED=true" >> $GITHUB_ENV
echo "$HOME/zig" >> $GITHUB_PATH
else
# Ensure path is added for fresh install
echo "$HOME/zig" >> $GITHUB_PATH
fi
- name: Setup Rust - name: Setup Rust
run: | run: |
if ! command -v rustup >/dev/null 2>&1; then if ! command -v rustup >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
@@ -35,6 +74,7 @@ jobs:
rustc --version rustc --version
- name: Setup Node.js - name: Setup Node.js
if: env.NODE_CACHED != 'true'
run: | run: |
# Download and install Node.js manually to ensure correct version and PATH # Download and install Node.js manually to ensure correct version and PATH
NODE_VER="v20.11.1" NODE_VER="v20.11.1"
@@ -60,6 +100,11 @@ jobs:
node -v node -v
npm -v npm -v
- name: Verify Node.js
run: |
node -v
npm -v
- name: Install Trunk & Tools - name: Install Trunk & Tools
run: | run: |
. "$HOME/.cargo/env" . "$HOME/.cargo/env"
@@ -87,6 +132,7 @@ jobs:
trunk build --release trunk build --release
- name: Setup Zig & Cross Setup - name: Setup Zig & Cross Setup
if: env.ZIG_CACHED != 'true'
run: | run: |
# Install Zig for cross-compilation (easier/cleaner than GCC + Cargo wrappers without Docker) # Install Zig for cross-compilation (easier/cleaner than GCC + Cargo wrappers without Docker)
ZIG_VER="0.13.0" ZIG_VER="0.13.0"