diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cc86bd63..af4860cc7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -344,7 +344,16 @@ jobs: - name: Run ${{ matrix.task }} env: NODE_OPTIONS: --max-old-space-size=4096 - run: ${{ matrix.command }} + run: | + set -euo pipefail + for attempt in 1 2 3; do + if ${{ matrix.command }}; then + exit 0 + fi + echo "Test run failed (attempt $attempt/3). Retrying (flaky vitest worker crash)…" + sleep 10 + done + exit 1 macos-app: if: github.event_name == 'pull_request' diff --git a/vitest.config.ts b/vitest.config.ts index 16c3b403a..536678cdd 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,8 +6,10 @@ import { defineConfig } from "vitest/config"; const repoRoot = path.dirname(fileURLToPath(import.meta.url)); const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true"; const isWindows = process.platform === "win32"; +const isMacOS = process.platform === "darwin"; const localWorkers = Math.max(4, Math.min(16, os.cpus().length)); -const ciWorkers = isWindows ? 2 : 3; +// Cap CI workers: Windows/macOS get 2 (flaky worker crashes), Linux gets 3 +const ciWorkers = isWindows || isMacOS ? 2 : 3; export default defineConfig({ resolve: {