From ff2270a64d32e61e1bfba9cb2e66aca9e537098f Mon Sep 17 00:00:00 2001 From: druppy Date: Sat, 24 Oct 2026 21:27:35 +0200 Subject: [PATCH] Cache rustup+registry+target, reach cache server via LAN IP, fail on pipe errors --- .gitea/workflows/sandbox.yml | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/sandbox.yml b/.gitea/workflows/sandbox.yml index 9163f45..142fb5e 100644 --- a/.gitea/workflows/sandbox.yml +++ b/.gitea/workflows/sandbox.yml @@ -10,30 +10,37 @@ jobs: defaults: run: working-directory: sandbox + shell: bash steps: - uses: actions/checkout@v4 - name: Where am I? run: | echo "runner : ${RUNNER_NAME}" - echo "os : $(grep PRETTY_NAME /etc/os-release | cut -d'"' -f2)" - echo "uid : $(id -u) cgroup: $(head -c 40 /proc/self/cgroup)" - command -v git >/dev/null && echo "git : $(git --version)" + echo "uid : $(id -u) cgroup: $(cut -d/ -f3 /proc/self/cgroup 2>/dev/null || echo n/a)" + echo "cache : ${ACTIONS_CACHE_URL:-unset}" - - name: Toolchain - run: | - command -v cargo >/dev/null || { apt-get update -qq && apt-get install -y -qq --no-install-recommends rustc cargo >/dev/null; } - cargo --version - - - name: Cache cargo deps and target + # Restore first, so a warm cache also skips the toolchain download. + - name: Cache rust toolchain, registry and target uses: actions/cache@v4 with: path: | - ~/.cargo/registry - ~/.cargo/git + ~/.cargo + ~/.rustup sandbox/target key: cargo-${{ hashFiles('sandbox/Cargo.lock') }} restore-keys: cargo- + - name: Toolchain + run: | + set -euo pipefail + if ! command -v cargo >/dev/null && [ ! -x "$HOME/.cargo/bin/cargo" ]; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable + fi + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + cargo --version + - name: Test - run: cargo test 2>&1 | tail -6 + run: | + set -o pipefail # without this a failing build looks green + cargo test 2>&1 | tail -4