Merge pull request #88 from fsolla/cursor/pool-i52-9987c331-517d

OPS9 — CI fail-fast: cancel workflow when any parallel job fails
This commit is contained in:
Francisco Solla 2026-08-01 03:27:22 -03:00 committed by GitHub
commit ae3e88a970
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 68 additions and 10 deletions

View file

@ -0,0 +1,7 @@
name: Cancel workflow on failure
description: Cancels the entire workflow run when invoked after a job failure (fail-fast).
runs:
using: composite
steps:
- name: Cancel workflow run
uses: styfle/cancel-workflow-action@0.12.1

View file

@ -18,6 +18,11 @@ concurrency:
group: ci-pr-${{ github.event.pull_request.number }} group: ci-pr-${{ github.event.pull_request.number }}
cancel-in-progress: true cancel-in-progress: true
permissions:
contents: read
actions: write
pull-requests: read
env: env:
DATABASE_URL: postgresql://teqo:teqo@localhost:5432/teqo_test DATABASE_URL: postgresql://teqo:teqo@localhost:5432/teqo_test
PAYLOAD_SECRET: test-only-secret-not-used-in-production PAYLOAD_SECRET: test-only-secret-not-used-in-production
@ -55,6 +60,9 @@ jobs:
echo "test_mode=$(echo "$result" | jq -r .test.mode)" >> "$GITHUB_OUTPUT" echo "test_mode=$(echo "$result" | jq -r .test.mode)" >> "$GITHUB_OUTPUT"
echo "e2e_mode=$(echo "$result" | jq -r .e2e.mode)" >> "$GITHUB_OUTPUT" echo "e2e_mode=$(echo "$result" | jq -r .e2e.mode)" >> "$GITHUB_OUTPUT"
echo "e2e_specs=$(echo "$result" | jq -r '[.e2e.specs[] | "tests/e2e/" + . + ".e2e.spec.ts"] | join(" ")')" >> "$GITHUB_OUTPUT" echo "e2e_specs=$(echo "$result" | jq -r '[.e2e.specs[] | "tests/e2e/" + . + ".e2e.spec.ts"] | join(" ")')" >> "$GITHUB_OUTPUT"
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -70,6 +78,9 @@ jobs:
- name: Check test file locations - name: Check test file locations
run: node scripts/check-test-locations.mjs run: node scripts/check-test-locations.mjs
- run: pnpm lint - run: pnpm lint
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
format: format:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -83,6 +94,9 @@ jobs:
cache: pnpm cache: pnpm
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- run: pnpm format:check - run: pnpm format:check
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
typecheck: typecheck:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -98,6 +112,9 @@ jobs:
cache: pnpm cache: pnpm
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- run: pnpm typecheck - run: pnpm typecheck
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
knip: knip:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -113,6 +130,9 @@ jobs:
cache: pnpm cache: pnpm
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- run: pnpm exec knip - run: pnpm exec knip
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
cycles: cycles:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -128,6 +148,9 @@ jobs:
cache: pnpm cache: pnpm
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- run: pnpm check:cycles - run: pnpm check:cycles
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
unit: unit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -152,6 +175,9 @@ jobs:
- name: Unit tests (changed since PR base) - name: Unit tests (changed since PR base)
if: needs.scope.outputs.test_mode == 'changed' if: needs.scope.outputs.test_mode == 'changed'
run: pnpm test:unit -- --changed origin/${{ github.base_ref }} --passWithNoTests run: pnpm test:unit -- --changed origin/${{ github.base_ref }} --passWithNoTests
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
int: int:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -201,6 +227,9 @@ jobs:
- name: Integration tests (changed since PR base) - name: Integration tests (changed since PR base)
if: needs.scope.outputs.test_mode == 'changed' if: needs.scope.outputs.test_mode == 'changed'
run: pnpm test:int -- --changed origin/${{ github.base_ref }} --passWithNoTests run: pnpm test:int -- --changed origin/${{ github.base_ref }} --passWithNoTests
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -240,6 +269,9 @@ jobs:
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- name: Build (against the local service database) - name: Build (against the local service database)
run: pnpm build run: pnpm build
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
e2e: e2e:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -295,13 +327,13 @@ jobs:
- name: E2E tests (manifest-selected specs) - name: E2E tests (manifest-selected specs)
if: needs.scope.outputs.e2e_mode == 'selected' if: needs.scope.outputs.e2e_mode == 'selected'
run: pnpm test:e2e -- ${{ needs.scope.outputs.e2e_specs }} run: pnpm test:e2e -- ${{ needs.scope.outputs.e2e_specs }}
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
migration-lock: migration-lock:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 5 timeout-minutes: 5
permissions:
contents: read
pull-requests: read
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v5
- name: Count open PRs touching schema files - name: Count open PRs touching schema files
@ -317,6 +349,9 @@ jobs:
echo "::error::More than one open PR touches src/migrations/ or payload-types.ts. Merge or close the other first." echo "::error::More than one open PR touches src/migrations/ or payload-types.ts. Merge or close the other first."
exit 1 exit 1
fi fi
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
checks: checks:
name: checks name: checks

View file

@ -13,6 +13,10 @@ concurrency:
group: main-verify group: main-verify
cancel-in-progress: false cancel-in-progress: false
permissions:
contents: read
actions: write
env: env:
DATABASE_URL: postgresql://teqo:teqo@localhost:5432/teqo_test DATABASE_URL: postgresql://teqo:teqo@localhost:5432/teqo_test
PAYLOAD_SECRET: test-only-secret-not-used-in-production PAYLOAD_SECRET: test-only-secret-not-used-in-production
@ -37,6 +41,9 @@ jobs:
- run: pnpm exec knip - run: pnpm exec knip
- run: pnpm check:cycles - run: pnpm check:cycles
- run: pnpm test:unit - run: pnpm test:unit
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
int: int:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -66,6 +73,9 @@ jobs:
- run: pnpm migrate - run: pnpm migrate
- run: pnpm db:seed:minimal - run: pnpm db:seed:minimal
- run: pnpm test:int - run: pnpm test:int
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -94,6 +104,9 @@ jobs:
- run: pnpm install --frozen-lockfile - run: pnpm install --frozen-lockfile
- name: Build (against the local service database) - name: Build (against the local service database)
run: pnpm build run: pnpm build
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
e2e: e2e:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -130,6 +143,9 @@ jobs:
NEXT_DIST_DIR: .next/e2e NEXT_DIST_DIR: .next/e2e
- name: E2E tests (full suite) - name: E2E tests (full suite)
run: pnpm test:e2e run: pnpm test:e2e
- name: Cancel workflow on failure
if: failure()
uses: ./.github/actions/cancel-workflow-on-failure
checks: checks:
name: checks name: checks

View file

@ -56,13 +56,13 @@ Labels: `ready|in-progress|blocked|done|in-prod`, `prio:*`, `kind:*`, `needs:*`.
## CI por alvo ## CI por alvo
| Workflow | Trigger | Banco | Passos | | Workflow | Trigger | Banco | Passos |
| ------------------------------ | -------------------------------------- | ------------------- | ------------------------------------------------------------------------- | | ------------------------------ | -------------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `ci-pr.yml` | PR → `main` | service Postgres 17 | Fase 1 barata → fase 2 cara; skips via `ci-scope.mjs`; rollup `checks` | | `ci-pr.yml` | PR → `main` | service Postgres 17 | Fase 1 barata → fase 2 cara; skips via `ci-scope.mjs`; fail-fast cancela o run no 1º job vermelho; rollup `checks` |
| `ci.yml` | push / dispatch `main` | service Postgres | Full sempre → `deploy` (`vercel deploy --prod`) → `requeue` se HEAD andou | | `ci.yml` | push / dispatch `main` | service Postgres | Full sempre; fail-fast cancela o run no 1º job vermelho → `deploy` (`vercel deploy --prod`) → `requeue` se HEAD andou |
| `issue-done-on-main-merge.yml` | PR merged → `main` | — | `in-progress` → `done` + `in-prod` | | `issue-done-on-main-merge.yml` | PR merged → `main` | — | `in-progress` → `done` + `in-prod` |
| `agent-pr-ready-automerge.yml` | PR `cursor/*` → `main` (open/sync/…) | — | Draft→Ready + `gh pr merge --auto --merge` (safety net; audit incluso) | | `agent-pr-ready-automerge.yml` | PR `cursor/*` → `main` (open/sync/…) | — | Draft→Ready + `gh pr merge --auto --merge` (safety net; audit incluso) |
| `agent-pool.yml` | schedule / PR closed `main` / dispatch | — | Supervisor do pool (`POOL_GITHUB_TOKEN`) | | `agent-pool.yml` | schedule / PR closed `main` / dispatch | — | Supervisor do pool (`POOL_GITHUB_TOKEN`) |
Fast gate: `pnpm gate:fast`. Push: `pnpm push`. Fast gate: `pnpm gate:fast`. Push: `pnpm push`.