Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/fix-integration-ci-affected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
40 changes: 22 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,7 @@ jobs:
fi
jq --version

- name: Task Status
id: task-status
- name: Validate turbo task
env:
E2E_APP_CLERK_JS_DIR: ${{runner.temp}}
E2E_APP_CLERK_UI_DIR: ${{runner.temp}}
Expand All @@ -367,40 +366,48 @@ jobs:
E2E_PROJECT: ${{ matrix.test-project }}
INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }}
run: |
# Use turbo's built-in --affected flag to detect changes
# This automatically uses GITHUB_BASE_REF in GitHub Actions
TASK_COUNT=$(pnpm turbo run test:integration:${{ matrix.test-name }} --affected --dry=json 2>/dev/null | jq '.tasks | length' 2>/dev/null || echo "0")
# Validate the turbo task exists. Turbo's --affected flag is a no-op for
# root-level tasks (//#) — they are always returned as affected. The previous
# --affected check only served to silently skip tests when the task was missing
# from turbo.json, hiding real configuration errors.
TASK_NAME="test:integration:${{ matrix.test-name }}"
TURBO_STDERR=$(mktemp)
if ! TURBO_JSON=$(pnpm turbo run "$TASK_NAME" --dry=json 2>"$TURBO_STDERR"); then
echo "::error::Turbo task '$TASK_NAME' failed validation"
cat "$TURBO_STDERR"
exit 1
fi

if [ "$TASK_COUNT" -gt 0 ]; then
AFFECTED=1
else
AFFECTED=0
if ! TASK_COUNT=$(jq -er '.tasks | length' <<< "$TURBO_JSON"); then
echo "::error::Turbo task '$TASK_NAME' returned invalid JSON or missing .tasks"
printf '%s\n' "$TURBO_JSON"
exit 1
fi

if [ "$TASK_COUNT" -eq 0 ]; then
echo "::error::Turbo task '$TASK_NAME' returned 0 tasks"
exit 1
fi

echo "affected=${AFFECTED}"
echo "affected=${AFFECTED}" >> $GITHUB_OUTPUT
echo "Task '$TASK_NAME' validated ($TASK_COUNT tasks in graph)"

- name: Build packages
if: ${{ steps.task-status.outputs.affected == '1' }}
run: pnpm turbo build $TURBO_ARGS --only

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

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

- name: Install @clerk/clerk-js in os temp
if: ${{ steps.task-status.outputs.affected == '1' }}
working-directory: ${{runner.temp}}
run: |
mkdir clerk-js && cd clerk-js
pnpm init
pkglab add @clerk/clerk-js

- name: Install @clerk/ui in os temp
if: ${{ steps.task-status.outputs.affected == '1' }}
working-directory: ${{runner.temp}}
run: |
mkdir clerk-ui && cd clerk-ui
Expand All @@ -412,7 +419,6 @@ jobs:
run: cd packages/astro && pnpm copy:components

- name: Write all ENV certificates to files in integration/certs
if: ${{ steps.task-status.outputs.affected == '1' }}
uses: actions/github-script@v7
env:
INTEGRATION_CERTS: "${{secrets.INTEGRATION_CERTS}}"
Expand All @@ -430,12 +436,10 @@ jobs:
}

- name: LS certs
if: ${{ steps.task-status.outputs.affected == '1' }}
working-directory: ./integration/certs
run: ls -la && pwd

- name: Run Integration Tests
if: ${{ steps.task-status.outputs.affected == '1' }}
id: integration-tests
timeout-minutes: 25
run: pnpm turbo test:integration:${{ matrix.test-name }} $TURBO_ARGS
Expand Down
5 changes: 5 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@
"inputs": ["integration/**"],
"outputLogs": "new-only"
},
"//#test:integration:fastify": {
"env": ["CLEANUP", "DEBUG", "E2E_*", "INTEGRATION_INSTANCE_KEYS"],
"inputs": ["integration/**"],
"outputLogs": "new-only"
},
"//#test:integration:hono": {
"env": ["CLEANUP", "DEBUG", "E2E_*", "INTEGRATION_INSTANCE_KEYS"],
"inputs": ["integration/**"],
Expand Down
Loading