mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
CI: run dev tests single-worker (#1153)
Runs dev-focused CI test suites with a single Vitest worker to reduce load and avoid external DB sync timeouts.
This commit is contained in:
parent
093eaf08f6
commit
5192875e42
25
.github/workflows/e2e-api-tests.yaml
vendored
25
.github/workflows/e2e-api-tests.yaml
vendored
@ -175,16 +175,27 @@ jobs:
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm test run ${{ matrix.freestyle-mode == 'prod' && '--min-workers=1 --max-workers=1' || '' }}
|
||||
- name: Run tests (excluding external DB sync)
|
||||
run: pnpm test run ${{ matrix.freestyle-mode == 'prod' && '--min-workers=1 --max-workers=1' || '' }} --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run tests again, to make sure they are stable (attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run ${{ matrix.freestyle-mode == 'prod' && '--min-workers=1 --max-workers=1' || '' }}
|
||||
- name: Run external DB sync tests (single worker)
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Run tests again, to make sure they are stable (attempt 2)
|
||||
- name: Run tests again (excluding external DB sync, attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run ${{ matrix.freestyle-mode == 'prod' && '--min-workers=1 --max-workers=1' || '' }}
|
||||
run: pnpm test run ${{ matrix.freestyle-mode == 'prod' && '--min-workers=1 --max-workers=1' || '' }} --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests again (single worker, attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Run tests again (excluding external DB sync, attempt 2)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run ${{ matrix.freestyle-mode == 'prod' && '--min-workers=1 --max-workers=1' || '' }} --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests again (single worker, attempt 2)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Verify data integrity
|
||||
run: pnpm run verify-data-integrity --no-bail
|
||||
|
||||
@ -168,16 +168,27 @@ jobs:
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm test run
|
||||
- name: Run tests (excluding external DB sync)
|
||||
run: pnpm test run --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run tests again, to make sure they are stable (attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run
|
||||
- name: Run external DB sync tests (single worker)
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Run tests again, to make sure they are stable (attempt 2)
|
||||
- name: Run tests again (excluding external DB sync, attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run
|
||||
run: pnpm test run --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests again (single worker, attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Run tests again (excluding external DB sync, attempt 2)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests again (single worker, attempt 2)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Verify data integrity
|
||||
run: pnpm run verify-data-integrity --no-bail
|
||||
|
||||
@ -175,16 +175,27 @@ jobs:
|
||||
sleep 2
|
||||
done
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm test run
|
||||
- name: Run tests (excluding external DB sync)
|
||||
run: pnpm test run --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run tests again, to make sure they are stable (attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run
|
||||
- name: Run external DB sync tests (single worker)
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Run tests again, to make sure they are stable (attempt 2)
|
||||
- name: Run tests again (excluding external DB sync, attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run
|
||||
run: pnpm test run --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests again (single worker, attempt 1)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Run tests again (excluding external DB sync, attempt 2)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests again (single worker, attempt 2)
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
|
||||
run: pnpm test run --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Verify data integrity
|
||||
run: pnpm run verify-data-integrity --no-bail
|
||||
|
||||
@ -40,8 +40,11 @@ jobs:
|
||||
- name: Start dev environment
|
||||
run: pnpm run restart-dev-environment
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run test run --reporter=verbose
|
||||
- name: Run tests (excluding external DB sync)
|
||||
run: pnpm run test run --reporter=verbose --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests (single worker)
|
||||
run: pnpm run test run --reporter=verbose --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Print dev server logs
|
||||
run: cat dev-server.log.untracked.txt
|
||||
|
||||
7
.github/workflows/restart-dev-and-test.yaml
vendored
7
.github/workflows/restart-dev-and-test.yaml
vendored
@ -39,8 +39,11 @@ jobs:
|
||||
- name: Start dev environment
|
||||
run: pnpm run restart-dev-environment
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run test run --reporter=verbose
|
||||
- name: Run tests (excluding external DB sync)
|
||||
run: pnpm run test run --reporter=verbose --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests (single worker)
|
||||
run: pnpm run test run --reporter=verbose --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
- name: Print dev server logs
|
||||
run: cat dev-server.log.untracked.txt
|
||||
|
||||
@ -49,4 +49,8 @@ jobs:
|
||||
tail: true
|
||||
wait-for: 120s
|
||||
log-output-if: true
|
||||
- run: pnpm run test run --reporter=verbose
|
||||
- name: Run tests (excluding external DB sync)
|
||||
run: pnpm run test run --reporter=verbose --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests (single worker)
|
||||
run: pnpm run test run --reporter=verbose --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
6
.github/workflows/setup-tests.yaml
vendored
6
.github/workflows/setup-tests.yaml
vendored
@ -47,4 +47,8 @@ jobs:
|
||||
tail: true
|
||||
wait-for: 120s
|
||||
log-output-if: true
|
||||
- run: pnpm run test run --reporter=verbose
|
||||
- name: Run tests (excluding external DB sync)
|
||||
run: pnpm run test run --reporter=verbose --exclude "**/external-db-sync*.test.ts"
|
||||
|
||||
- name: Run external DB sync tests (single worker)
|
||||
run: pnpm run test run --reporter=verbose --min-workers=1 --max-workers=1 **/external-db-sync*.test.ts
|
||||
|
||||
@ -8,3 +8,12 @@ A: Use the shared `TextAreaField` component's `helperText` prop in `apps/dashboa
|
||||
|
||||
Q: Why did `pnpm typecheck` fail after deleting a Next.js route?
|
||||
A: The generated `.next/types/validator.ts` can keep stale imports for removed routes. Deleting that file (or regenerating Next build output) clears the outdated references so `pnpm typecheck` succeeds again.
|
||||
|
||||
Q: Why can external DB sync tests time out in dev-focused GitHub workflows?
|
||||
A: The first calls to `/api/latest/internal/external-db-sync/sequencer` and `/poller` can be slow in dev mode and hit Undici's headers timeout; prewarming those endpoints with the cron secret, retrying header-timeout failures in the test helper, or running tests single-worker are viable mitigations.
|
||||
|
||||
Q: How can we serialize only the external DB sync Vitest files while keeping the rest parallel?
|
||||
A: Use `poolMatchGlobs` to route the external DB sync test globs to the `forks` pool and set `poolOptions.forks.{minForks,maxForks}=1` in `apps/e2e/vitest.config.ts`; keep the default threads pool for all other tests.
|
||||
|
||||
Q: How can CI keep most tests parallel while isolating external DB sync tests?
|
||||
A: Split workflow test runs into two steps: run the full suite with `--exclude "**/external-db-sync*.test.ts"`, then run only external DB sync tests with `--min-workers=1 --max-workers=1`.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user