perf: add pnpm --prefer-offline and smart Rust checking

- Add --prefer-offline to pnpm install to avoid network calls
- Skip cargo check when no Rust files (.rs, .toml, Cargo.lock) changed
- Should provide modest speedup for commits without Rust changes
This commit is contained in:
2026-01-16 18:28:04 +01:00
parent 59f24388a4
commit 6b14131930

View File

@@ -115,9 +115,9 @@ build_frontend() {
[ "$VERBOSE" -eq 1 ] && echo "[BUILD_DEBUG] Running pnpm install..." || true [ "$VERBOSE" -eq 1 ] && echo "[BUILD_DEBUG] Running pnpm install..." || true
if [ "$VERBOSE" -eq 1 ]; then if [ "$VERBOSE" -eq 1 ]; then
pnpm install --frozen-lockfile </dev/null pnpm install --frozen-lockfile --prefer-offline </dev/null
else else
pnpm install --frozen-lockfile </dev/null >/dev/null 2>&1 pnpm install --frozen-lockfile --prefer-offline </dev/null >/dev/null 2>&1
fi || { fi || {
echo "❌ pnpm install failed" echo "❌ pnpm install failed"
return 1 return 1
@@ -194,13 +194,19 @@ check_commit() {
[ "$VERBOSE" -eq 1 ] && echo "[CHECK_DEBUG] No rfc-edge-frontend directory found, skipping frontend build" || true [ "$VERBOSE" -eq 1 ] && echo "[CHECK_DEBUG] No rfc-edge-frontend directory found, skipping frontend build" || true
fi fi
# Check if Rust files changed in this commit
if git diff --name-only "${commit}^..${commit}" 2>/dev/null | grep -qE '\.(rs|toml)$|Cargo\.lock'; then
[ "$VERBOSE" -eq 1 ] && echo "[CHECK_DEBUG] Rust files changed, running cargo check" || true
echo "→ Running cargo check…" echo "→ Running cargo check…"
[ "$VERBOSE" -eq 1 ] && echo "[CHECK_DEBUG] Starting cargo check" || true
if ! cargo check --quiet; then if ! cargo check --quiet; then
echo "❌ Cargo check failed" echo "❌ Cargo check failed"
exit 1 exit 1
fi fi
[ "$VERBOSE" -eq 1 ] && echo "[CHECK_DEBUG] Cargo check completed successfully" || true [ "$VERBOSE" -eq 1 ] && echo "[CHECK_DEBUG] Cargo check completed successfully" || true
else
[ "$VERBOSE" -eq 1 ] && echo "[CHECK_DEBUG] No Rust files changed, skipping cargo check" || true
echo "→ Skipping cargo check (no Rust changes)"
fi
echo "✓ OK" echo "✓ OK"
) >"$log" 2>&1 ) >"$log" 2>&1