Repository navigation
110 lines (89 loc) · 2.97 KB
/
Copy pathci.yml
File metadata and controls
110 lines (89 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Unit tests
run: yarn test:unit
cloudflare:
# SSC-31: production is a static export plus a thin Worker. A server
# action, force-dynamic page, or new dynamic route without
# generateStaticParams breaks the export; catch it here, not at deploy.
name: Cloudflare static build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build static shell
run: yarn cf:build
env:
# Any well-formed key; the build only embeds it.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: pk_test_Y2xlcmsuZXhhbXBsZS5jb20k
- name: Bundle the app Worker
run: npx wrangler deploy --dry-run --outdir .wrangler/dry-run
e2e:
name: E2E Tests
runs-on: ubuntu-latest
services:
pocketbase:
image: ghcr.io/muchobien/pocketbase:latest
env:
PB_ADMIN_EMAIL: ci@example.com
PB_ADMIN_PASSWORD: "Ci-TestPassword123!"
ports:
- 8095:8090
options: >-
--health-cmd "wget --spider -q http://localhost:8090/api/health || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Import PocketBase schema
run: |
POCKETBASE_URL=http://localhost:8095 \
POCKETBASE_ADMIN_EMAIL=ci@example.com \
POCKETBASE_ADMIN_PASSWORD="Ci-TestPassword123!" \
node --experimental-strip-types scripts/pocketbase/import-schema.ts
- name: Build
run: yarn build
env:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.CI_NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
NEXT_PUBLIC_POCKETBASE_URL: http://localhost:8095
- name: E2E tests
run: yarn test:e2e:headless
env:
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ${{ secrets.CI_NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY: ${{ secrets.CI_CLERK_SECRET_KEY }}
NEXT_PUBLIC_POCKETBASE_URL: http://localhost:8095
POCKETBASE_URL: http://localhost:8095
POCKETBASE_ADMIN_EMAIL: ci@example.com
POCKETBASE_ADMIN_PASSWORD: "Ci-TestPassword123!"
CYPRESS_baseUrl: http://localhost:3000