Skip to content

Commit 6549e57

Browse files
ci: separate e2e tests from unit tests
Rename tests/ workspace script from "test" to "test:e2e" so turbo test only runs unit tests that can pass without a live server. Add a manual workflow_dispatch trigger for running e2e tests in CI with secrets.
1 parent cad5344 commit 6549e57

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8+
workflow_dispatch:
9+
inputs:
10+
run_e2e:
11+
description: "Run E2E integration tests"
12+
type: boolean
13+
default: false
814

915
concurrency:
1016
group: ${{ github.workflow }}-${{ github.ref_name }}
@@ -63,3 +69,24 @@ jobs:
6369
run: npm run build
6470
env:
6571
SKIP_ENV_VALIDATION: "true"
72+
73+
e2e:
74+
runs-on: ubuntu-latest
75+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.run_e2e }}
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- uses: actions/setup-node@v4
80+
with:
81+
node-version-file: "package.json"
82+
cache: "npm"
83+
84+
- name: Install dependencies
85+
run: npm ci
86+
87+
- name: Run E2E Tests
88+
run: npm run test:e2e
89+
env:
90+
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
91+
CLERK_TEST_USER_ID: ${{ secrets.CLERK_TEST_USER_ID }}
92+
GITHUB_PAT: ${{ secrets.E2E_GITHUB_PAT }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"dev": "turbo dev",
1919
"lint": "turbo lint",
2020
"test": "turbo test",
21+
"test:e2e": "turbo test:e2e",
2122
"db:migrate": "npm run migrate -w db",
2223
"db:migrate:prod": "NODE_ENV=production npm run migrate -w db",
2324
"db:generate": "npm run generate -w db",

tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"dev": "vitest dev --testTimeout=30000",
99
"dev:hi": "vitest dev github.test.ts --testTimeout=30000",
10-
"test": "vitest run"
10+
"test:e2e": "vitest run"
1111
},
1212
"author": "Your Name",
1313
"license": "ISC",

turbo.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
},
4545
"test": {
4646
"dependsOn": ["^build"]
47+
},
48+
"test:e2e": {
49+
"dependsOn": ["^build"],
50+
"cache": false
4751
}
4852
}
4953
}

0 commit comments

Comments
 (0)