Skip to content

Commit 304145b

Browse files
committed
ci: add client e2e tests to CI workflow (#492)
# Add client e2e tests to CI workflow This PR adds end-to-end tests for the client package to our CI workflow. The changes include: 1. Adding a new `client-e2e` job to the GitHub Actions workflow that: - Checks if the client package is affected by changes - Pre-starts Supabase for testing - Runs the client e2e tests when needed 2. Updating the dependency chain to include the new `client-e2e` job: - The `deploy-website` job now depends on `client-e2e` - The `deploy-demo` job now depends on `client-e2e` 3. Refactoring the client package's testing configuration: - Renamed `test:integration` to `e2e` for consistency - Removed the unused `test:vitest` command - Updated the `test` target to depend on `test:unit` instead of `test:vitest` These changes ensure that client e2e tests are properly run as part of our CI process before deployments.
1 parent d0f7ca4 commit 304145b

2 files changed

Lines changed: 38 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,44 @@ jobs:
143143
if: steps.check.outputs.affected == 'true'
144144
run: pnpm nx run cli:e2e
145145

146+
# ─────────────────────────────────────── 2c. CLIENT E2E ──────────────────────────────────────
147+
client-e2e:
148+
runs-on: ubuntu-latest
149+
env:
150+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
151+
steps:
152+
- uses: actions/checkout@v4
153+
with:
154+
fetch-depth: 0
155+
156+
- uses: ./.github/actions/setup
157+
with:
158+
github-token: ${{ secrets.GITHUB_TOKEN }}
159+
atlas-cloud-token: ${{ secrets.ATLAS_CLOUD_TOKEN }}
160+
161+
- name: Check if client is affected
162+
id: check
163+
run: |
164+
if pnpm nx show projects --affected --base=origin/main --head=HEAD | grep -q "^client$"; then
165+
echo "affected=true" >> $GITHUB_OUTPUT
166+
echo "client is affected, running e2e tests"
167+
else
168+
echo "affected=false" >> $GITHUB_OUTPUT
169+
echo "client not affected, skipping e2e tests"
170+
fi
171+
172+
- name: Pre-start Supabase
173+
if: steps.check.outputs.affected == 'true'
174+
run: ./scripts/ci-prestart-supabase.sh client
175+
176+
- name: Run client e2e tests
177+
if: steps.check.outputs.affected == 'true'
178+
run: pnpm nx run client:e2e
179+
146180
# ────────────────────────────────── 3. DEPLOY WEBSITE (PREVIEW) ───────────────────────────
147181
deploy-website:
148182
if: github.event_name == 'pull_request'
149-
needs: [build-and-test, edge-worker-e2e, cli-e2e]
183+
needs: [build-and-test, edge-worker-e2e, cli-e2e, client-e2e]
150184
runs-on: ubuntu-latest
151185
environment: preview
152186
env:
@@ -188,7 +222,7 @@ jobs:
188222
# ────────────────────────────────── 4. DEPLOY DEMO ───────────────────────────
189223
deploy-demo:
190224
if: false # temporarily disabled
191-
needs: [build-and-test, edge-worker-e2e, cli-e2e]
225+
needs: [build-and-test, edge-worker-e2e, cli-e2e, client-e2e]
192226
runs-on: ubuntu-latest
193227
environment: ${{ github.event_name == 'pull_request' && 'preview' || 'production' }}
194228
env:

pkgs/client/project.json

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"parallel": false
140140
}
141141
},
142-
"test:integration": {
142+
"e2e": {
143143
"executor": "nx:run-commands",
144144
"local": true,
145145
"cache": false,
@@ -164,25 +164,10 @@
164164
"parallel": false
165165
}
166166
},
167-
"test:vitest": {
168-
"executor": "nx:run-commands",
169-
"local": true,
170-
"cache": false,
171-
"dependsOn": ["supabase:prepare", "build"],
172-
"options": {
173-
"cwd": "{projectRoot}",
174-
"commands": [
175-
"../../scripts/supabase-start-locked.sh .",
176-
"psql 'postgresql://postgres:postgres@localhost:50522/postgres' -c 'SELECT pgflow_tests.reset_db()'",
177-
"vitest run __tests__/ --config vitest.e2e.config.ts --poolOptions.threads.singleThread"
178-
],
179-
"parallel": false
180-
}
181-
},
182167
"test": {
183168
"executor": "nx:noop",
184169
"inputs": ["default", "^production"],
185-
"dependsOn": ["test:vitest", "test:types"]
170+
"dependsOn": ["test:unit", "test:types"]
186171
},
187172
"benchmark": {
188173
"executor": "nx:run-commands",

0 commit comments

Comments
 (0)