Skip to content

Commit 0bd10a3

Browse files
authored
fix(ci): replace broken --affected check with task validation for integration tests (#8078)
1 parent ee3a213 commit 0bd10a3

3 files changed

Lines changed: 29 additions & 18 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.github/workflows/ci.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,7 @@ jobs:
356356
fi
357357
jq --version
358358
359-
- name: Task Status
360-
id: task-status
359+
- name: Validate turbo task
361360
env:
362361
E2E_APP_CLERK_JS_DIR: ${{runner.temp}}
363362
E2E_APP_CLERK_UI_DIR: ${{runner.temp}}
@@ -367,40 +366,48 @@ jobs:
367366
E2E_PROJECT: ${{ matrix.test-project }}
368367
INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }}
369368
run: |
370-
# Use turbo's built-in --affected flag to detect changes
371-
# This automatically uses GITHUB_BASE_REF in GitHub Actions
372-
TASK_COUNT=$(pnpm turbo run test:integration:${{ matrix.test-name }} --affected --dry=json 2>/dev/null | jq '.tasks | length' 2>/dev/null || echo "0")
369+
# Validate the turbo task exists. Turbo's --affected flag is a no-op for
370+
# root-level tasks (//#) — they are always returned as affected. The previous
371+
# --affected check only served to silently skip tests when the task was missing
372+
# from turbo.json, hiding real configuration errors.
373+
TASK_NAME="test:integration:${{ matrix.test-name }}"
374+
TURBO_STDERR=$(mktemp)
375+
if ! TURBO_JSON=$(pnpm turbo run "$TASK_NAME" --dry=json 2>"$TURBO_STDERR"); then
376+
echo "::error::Turbo task '$TASK_NAME' failed validation"
377+
cat "$TURBO_STDERR"
378+
exit 1
379+
fi
373380
374-
if [ "$TASK_COUNT" -gt 0 ]; then
375-
AFFECTED=1
376-
else
377-
AFFECTED=0
381+
if ! TASK_COUNT=$(jq -er '.tasks | length' <<< "$TURBO_JSON"); then
382+
echo "::error::Turbo task '$TASK_NAME' returned invalid JSON or missing .tasks"
383+
printf '%s\n' "$TURBO_JSON"
384+
exit 1
385+
fi
386+
387+
if [ "$TASK_COUNT" -eq 0 ]; then
388+
echo "::error::Turbo task '$TASK_NAME' returned 0 tasks"
389+
exit 1
378390
fi
379391
380-
echo "affected=${AFFECTED}"
381-
echo "affected=${AFFECTED}" >> $GITHUB_OUTPUT
392+
echo "Task '$TASK_NAME' validated ($TASK_COUNT tasks in graph)"
382393
383394
- name: Build packages
384-
if: ${{ steps.task-status.outputs.affected == '1' }}
385395
run: pnpm turbo build $TURBO_ARGS --only
386396

387397
- name: Publish to local registry
388-
if: ${{ steps.task-status.outputs.affected == '1' }}
389398
run: pkglab pub --force
390399

391400
- name: Edit .npmrc [link-workspace-packages=false]
392401
run: sed -i -E 's/link-workspace-packages=(deep|true)/link-workspace-packages=false/' .npmrc
393402

394403
- name: Install @clerk/clerk-js in os temp
395-
if: ${{ steps.task-status.outputs.affected == '1' }}
396404
working-directory: ${{runner.temp}}
397405
run: |
398406
mkdir clerk-js && cd clerk-js
399407
pnpm init
400408
pkglab add @clerk/clerk-js
401409
402410
- name: Install @clerk/ui in os temp
403-
if: ${{ steps.task-status.outputs.affected == '1' }}
404411
working-directory: ${{runner.temp}}
405412
run: |
406413
mkdir clerk-ui && cd clerk-ui
@@ -412,7 +419,6 @@ jobs:
412419
run: cd packages/astro && pnpm copy:components
413420

414421
- name: Write all ENV certificates to files in integration/certs
415-
if: ${{ steps.task-status.outputs.affected == '1' }}
416422
uses: actions/github-script@v7
417423
env:
418424
INTEGRATION_CERTS: "${{secrets.INTEGRATION_CERTS}}"
@@ -430,12 +436,10 @@ jobs:
430436
}
431437
432438
- name: LS certs
433-
if: ${{ steps.task-status.outputs.affected == '1' }}
434439
working-directory: ./integration/certs
435440
run: ls -la && pwd
436441

437442
- name: Run Integration Tests
438-
if: ${{ steps.task-status.outputs.affected == '1' }}
439443
id: integration-tests
440444
timeout-minutes: 25
441445
run: pnpm turbo test:integration:${{ matrix.test-name }} $TURBO_ARGS

turbo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@
216216
"inputs": ["integration/**"],
217217
"outputLogs": "new-only"
218218
},
219+
"//#test:integration:fastify": {
220+
"env": ["CLEANUP", "DEBUG", "E2E_*", "INTEGRATION_INSTANCE_KEYS"],
221+
"inputs": ["integration/**"],
222+
"outputLogs": "new-only"
223+
},
219224
"//#test:integration:hono": {
220225
"env": ["CLEANUP", "DEBUG", "E2E_*", "INTEGRATION_INSTANCE_KEYS"],
221226
"inputs": ["integration/**"],

0 commit comments

Comments
 (0)