From b83ee957d1f7785378320e1e1ef1bdcb049852f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89verton=20Toffanetto?= Date: Tue, 9 Jun 2026 06:05:11 -0300 Subject: [PATCH] ci: stabilize Electron dependency installs (#1409) * ci: stabilize Electron dependency installs Skip unused Electron binary downloads in non-desktop CI jobs and retry Electron installs in desktop tests to avoid external CDN 504 failures during npm ci. * ci: preserve npm retry exit code Preserve the final npm ci exit code in the non-Windows Electron retry path so CI diagnostics retain the original failure code. * ci: preserve retry exit code under errexit Keep npm ci inside the retry conditional so bash errexit does not bypass retries, while preserving the final npm exit code for diagnostics. --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f354e2269..99c5cbb77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,10 @@ env: jobs: format: runs-on: ubuntu-latest + env: + # This job never executes Electron. Skipping the hosted binary avoids + # unrelated npm ci failures when Electron's CDN returns 504. + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 @@ -36,6 +40,8 @@ jobs: lint: runs-on: ubuntu-latest + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 @@ -58,6 +64,8 @@ jobs: typecheck: runs-on: ubuntu-latest + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 @@ -88,6 +96,8 @@ jobs: os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} name: server-tests (${{ matrix.os }}) + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 with: @@ -131,8 +141,35 @@ jobs: node-version: "22" cache: "npm" - - name: Install dependencies - run: npm ci + - name: Install dependencies with Electron retry + if: runner.os != 'Windows' + run: | + for attempt in 1 2 3; do + if npm ci; then + exit 0 + else + exit_code=$? + fi + if [ "$attempt" -eq 3 ]; then + exit $exit_code + fi + sleep $((attempt * 20)) + done + + - name: Install dependencies with Electron retry + if: runner.os == 'Windows' + shell: pwsh + run: | + for ($attempt = 1; $attempt -le 3; $attempt++) { + npm ci + if ($LASTEXITCODE -eq 0) { + exit 0 + } + if ($attempt -eq 3) { + exit $LASTEXITCODE + } + Start-Sleep -Seconds (20 * $attempt) + } - name: Build server stack run: npm run build:server @@ -142,6 +179,8 @@ jobs: app-tests: runs-on: ubuntu-latest + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 @@ -164,6 +203,8 @@ jobs: sdk-tests: runs-on: ubuntu-latest + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 @@ -189,6 +230,8 @@ jobs: playwright: runs-on: ubuntu-latest + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 @@ -229,6 +272,8 @@ jobs: relay-tests: runs-on: ubuntu-latest + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4 @@ -253,6 +298,8 @@ jobs: shard: [1, 2, 3] runs-on: ubuntu-latest name: cli-tests (shard ${{ matrix.shard }}/3) + env: + ELECTRON_SKIP_BINARY_DOWNLOAD: "1" steps: - uses: actions/checkout@v4