11name : CI
22
3- # NOTE: This GitHub Actions defintion _only_ works if this folder is the base of your GitHub repo - if you're using the whole steps
4- # repo and this is in 09-with-tests and not the base, this file has no effect and you should use the .github folder one directory up
5- #
6- # Sorry it's confusing but GitHub does not allow to put the .github folder anywhere but the base directory
7-
83on :
94 push :
105 branches : [main]
@@ -25,19 +20,13 @@ jobs:
2520 with :
2621 node-version : ' 22'
2722 cache : ' npm'
28- cache-dependency-path : 09-with-tests/package-lock.json
2923
3024 - name : Install dependencies
3125 run : npm ci
3226
3327 - name : Run Biome check (lint + format)
3428 run : npm run lint
3529
36- - name : ' Notify Vercel'
37- uses : ' vercel/repository-dispatch/actions/status@v1'
38- with :
39- name : " Vercel - fullstack-next-wiki: lint-and-format"
40-
4130 unit-tests :
4231 name : Unit Tests
4332 runs-on : ubuntu-latest
@@ -51,61 +40,15 @@ jobs:
5140 with :
5241 node-version : ' 22'
5342 cache : ' npm'
54- cache-dependency-path : 09-with-tests/package-lock.json
55-
56- - name : Get Neon branch name
57- id : neon-branch-name
58- run : echo "BRANCH_NAME=unit-${{ github.run_id }}" >> "$GITHUB_ENV"
59-
60- - name : Get branch expiration date as an env variable (2 weeks from now)
61- id : get-expiration-date
62- run :
63- echo "EXPIRES_AT=$(date -u --date '+14 days' +'%Y-%m-%dT%H:%M:%SZ')"
64- >> "$GITHUB_ENV"
65-
66- - name : Create Neon Branch
67- uses : neondatabase/create-branch-action@v6
68- id : create-neon-branch
69- with :
70- project_id : ${{ secrets.NEON_PROJECT_ID }}
71- branch_name : ${{ env.BRANCH_NAME }}
72- api_key : ${{ secrets.NEON_API_KEY }}
73- expires_at : ${{ env.EXPIRES_AT }}
7443
7544 - name : Install dependencies
7645 run : npm ci
7746
7847 - name : Run unit tests
7948 run : npm run test
8049 env :
81- DATABASE_URL : ${{ steps.create-neon-branch.outputs.db_url }}
8250 NODE_ENV : test
83- NEON_PROJECT_ID : ${{ secrets.NEON_PROJECT_ID }}
84- NEON_API_KEY : ${{ secrets.NEON_API_KEY }}
85- NEON_BRANCH_NAME : ${{ env.BRANCH_NAME }}
86- TEST_USER_EMAIL : ${{ secrets.TEST_USER_EMAIL }}
87- TEST_USER_PASSWORD : ${{ secrets.TEST_USER_PASSWORD }}
88- NEXT_PUBLIC_STACK_PROJECT_ID : ${{ secrets.NEXT_PUBLIC_STACK_PROJECT_ID }}
89- NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY : ${{ secrets.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY }}
90- STACK_SECRET_SERVER_KEY : ${{ secrets.STACK_SECRET_SERVER_KEY }}
91- UPSTASH_REDIS_REST_URL : ${{ secrets.UPSTASH_REDIS_REST_URL }}
92- UPSTASH_REDIS_REST_TOKEN : ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
93- BLOB_READ_WRITE_TOKEN : ${{ secrets.BLOB_READ_WRITE_TOKEN }}
94- BLOB_BASE_URL : ${{ secrets.BLOB_BASE_URL }}
95- RESEND_API_KEY : ${{ secrets.RESEND_API_KEY }}
96-
97- - name : Delete Neon Branch
98- if : always()
99- uses : neondatabase/delete-branch-action@v3
100- with :
101- project_id : ${{ secrets.NEON_PROJECT_ID }}
102- branch : ${{ env.BRANCH_NAME }}
103- api_key : ${{ secrets.NEON_API_KEY }}
104-
105- - name : ' Notify Vercel'
106- uses : ' vercel/repository-dispatch/actions/status@v1'
107- with :
108- name : " Vercel - fullstack-next-wiki: unit"
51+ PLAYWRIGHT : 1
10952
11053 e2e-tests :
11154 name : E2E Tests
@@ -120,26 +63,6 @@ jobs:
12063 with :
12164 node-version : ' 22'
12265 cache : ' npm'
123- cache-dependency-path : 09-with-tests/package-lock.json
124-
125- - name : Get Neon branch name
126- id : neon-branch-name
127- run : echo "BRANCH_NAME=e2e-${{ github.run_id }}" >> "$GITHUB_ENV"
128-
129- - name : Get branch expiration date as an env variable (2 weeks from now)
130- id : get-expiration-date
131- run :
132- echo "EXPIRES_AT=$(date -u --date '+14 days' +'%Y-%m-%dT%H:%M:%SZ')"
133- >> "$GITHUB_ENV"
134-
135- - name : Create Neon Branch
136- uses : neondatabase/create-branch-action@v6
137- id : create-neon-branch
138- with :
139- project_id : ${{ secrets.NEON_PROJECT_ID }}
140- branch_name : ${{ env.BRANCH_NAME }}
141- api_key : ${{ secrets.NEON_API_KEY }}
142- expires_at : ${{ env.EXPIRES_AT }}
14366
14467 - name : Install dependencies
14568 run : npm ci
@@ -151,30 +74,31 @@ jobs:
15174 run : npm run test:e2e:ci
15275 env :
15376 NODE_ENV : test
154- DATABASE_URL : ${{ steps.create-neon-branch.outputs.db_url }}
15577 NEON_PROJECT_ID : ${{ secrets.NEON_PROJECT_ID }}
15678 NEON_API_KEY : ${{ secrets.NEON_API_KEY }}
157- NEON_BRANCH_NAME : ${{ env.BRANCH_NAME }}
15879 TEST_USER_EMAIL : ${{ secrets.TEST_USER_EMAIL }}
15980 TEST_USER_PASSWORD : ${{ secrets.TEST_USER_PASSWORD }}
16081 NEXT_PUBLIC_STACK_PROJECT_ID : ${{ secrets.NEXT_PUBLIC_STACK_PROJECT_ID }}
16182 NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY : ${{ secrets.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY }}
16283 STACK_SECRET_SERVER_KEY : ${{ secrets.STACK_SECRET_SERVER_KEY }}
16384 UPSTASH_REDIS_REST_URL : ${{ secrets.UPSTASH_REDIS_REST_URL }}
16485 UPSTASH_REDIS_REST_TOKEN : ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
86+ ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
87+ DATABASE_URL : placeholder # Will be replaced by test setup
16588 BLOB_READ_WRITE_TOKEN : ${{ secrets.BLOB_READ_WRITE_TOKEN }}
166- BLOB_BASE_URL : ${{ secrets.BLOB_BASE_URL }}
167- RESEND_API_KEY : ${{ secrets.RESEND_API_KEY }}
16889
169- - name : Delete Neon Branch
90+ - name : Upload Playwright report
17091 if : always()
171- uses : neondatabase/delete-branch-action@v3
92+ uses : actions/upload-artifact@v4
17293 with :
173- project_id : ${{ secrets.NEON_PROJECT_ID }}
174- branch : ${{ env.BRANCH_NAME }}
175- api_key : ${{ secrets.NEON_API_KEY }}
94+ name : playwright-report
95+ path : playwright-report/
96+ retention-days : 7
17697
177- - name : ' Notify Vercel'
178- uses : ' vercel/repository-dispatch/actions/status@v1'
98+ - name : Upload test results
99+ if : always()
100+ uses : actions/upload-artifact@v4
179101 with :
180- name : " Vercel - fullstack-next-wiki: e2e"
102+ name : test-results
103+ path : test-results/
104+ retention-days : 7
0 commit comments