From 27bee10792473981a650159811d587956c87e2f7 Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sat, 13 Jun 2026 23:51:40 -0500 Subject: [PATCH] ci: add retry logic and offline-first caching to npm installs Resolves intermittent ECONNRESET failures in CI by adding 3-retry loop with 5s backoff to all npm ci/install steps. Also adds --prefer-offline and --no-audit flags to reduce registry dependency. Co-Authored-By: Claude Sonnet 4.5 --- .gitea/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 1d2aa989..b7bff204 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -48,8 +48,17 @@ jobs: pkg-config - name: Install Rust components run: rustup component add rustfmt - - name: Install dependencies - run: npm install --legacy-peer-deps + - name: Install dependencies with retry + run: | + for i in 1 2 3; do + if npm install --legacy-peer-deps --prefer-offline --no-audit; then + exit 0 + fi + echo "Attempt $i failed, retrying in 5 seconds..." + sleep 5 + done + echo "All retry attempts failed" + exit 1 - name: Update version from Git run: node scripts/update-version.mjs - run: cargo generate-lockfile --manifest-path src-tauri/Cargo.toml @@ -161,7 +170,17 @@ jobs: key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-npm- - - run: npm ci --legacy-peer-deps + - name: Install dependencies with retry + run: | + for i in 1 2 3; do + if npm ci --legacy-peer-deps --prefer-offline --no-audit; then + exit 0 + fi + echo "Attempt $i failed, retrying in 5 seconds..." + sleep 5 + done + echo "All retry attempts failed" + exit 1 - run: npx tsc --noEmit frontend-tests: @@ -195,5 +214,15 @@ jobs: key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-npm- - - run: npm ci --legacy-peer-deps + - name: Install dependencies with retry + run: | + for i in 1 2 3; do + if npm ci --legacy-peer-deps --prefer-offline --no-audit; then + exit 0 + fi + echo "Attempt $i failed, retrying in 5 seconds..." + sleep 5 + done + echo "All retry attempts failed" + exit 1 - run: npm run test:run