-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (166 loc) · 5.12 KB
/
Copy pathci.yml
File metadata and controls
200 lines (166 loc) · 5.12 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
# Dummy environment variables for build/test
DATABASE_URL: "postgresql://user:password@localhost:5432/testdb"
DIRECT_URL: "postgresql://user:password@localhost:5432/testdb"
NEXTAUTH_URL: "http://127.0.0.1:3000"
AUTH_SECRET: "dummy_secret_for_ci"
AUTH_GOOGLE_ID: "dummy_google_id"
AUTH_GOOGLE_SECRET: "dummy_google_secret"
GCS_BUCKET_NAME: "dummy-bucket"
GCS_PROJECT_ID: "dummy-project"
SMTP_NOREPLY_HOST: "smtp.example.com"
SMTP_NOREPLY_PORT: "465"
SMTP_NOREPLY_USER: "noreply@deniko.net"
SMTP_NOREPLY_PASSWORD: "dummy_password"
SMTP_NOREPLY_FROM: "noreply@deniko.net"
SMTP_SUPPORT_HOST: "smtp.example.com"
SMTP_SUPPORT_PORT: "465"
SMTP_SUPPORT_USER: "support@deniko.net"
SMTP_SUPPORT_PASSWORD: "dummy_password"
SMTP_SUPPORT_FROM: "support@deniko.net"
UPSTASH_REDIS_REST_URL: "https://dummy.upstash.io"
UPSTASH_REDIS_REST_TOKEN: "dummy_token"
INTERNAL_API_BASE_URL: "http://127.0.0.1:4000"
INTERNAL_API_SECRET: "dev-secret-key"
NEXT_PUBLIC_NOINDEX: "true"
NEXT_PUBLIC_SITE_URL: "http://127.0.0.1:3000"
NEXT_PUBLIC_GA_ID: "G-DUMMY"
# Skip env validation during build
SKIP_ENV_VALIDATION: "true"
CI: "true"
jobs:
verify:
name: Verify (Lint, Typecheck, Test)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: testdb
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Push Database Schema
run: pnpm --filter @deniko/db db:push
- name: Lint
run: pnpm lint
- name: Typecheck
run: pnpm typecheck
- name: Run Tests
run: pnpm test:all
build:
name: Build
needs: verify
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build Project
run: pnpm build
- name: Upload Web Artifacts
uses: actions/upload-artifact@v6
with:
name: web-build
path: |
apps/web/.next
apps/web/public
apps/web/package.json
apps/web/next.config.ts
apps/web/lighthouserc.js
- name: Upload API Artifacts
uses: actions/upload-artifact@v6
with:
name: api-build
path: |
apps/api/dist
apps/api/package.json
audit:
name: Audit (Lighthouse)
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Download Web Artifacts
uses: actions/download-artifact@v7
with:
name: web-build
path: apps/web
- name: Download API Artifacts
uses: actions/download-artifact@v7
with:
name: api-build
path: apps/api
- name: Install Lighthouse CLI
run: npm install -g @lhci/cli
- name: Start Server & Run Lighthouse
run: |
# Start API server
pnpm --filter @deniko/api start:ci > api-server.log 2>&1 &
API_PID=$!
echo "API Server started with PID $API_PID"
# Wait for API server
echo "Waiting for API server on port 4000..."
npx wait-on --timeout 60000 tcp:127.0.0.1:4000 || (echo "API Server failed to start. Logs:" && cat api-server.log && exit 1)
# Start Web server
pnpm --filter deniko start:ci &
WEB_PID=$!
echo "Web Server started with PID $WEB_PID"
# Wait for Web server health check
echo "Waiting for Web server health check..."
npx wait-on --timeout 600000 http-get://127.0.0.1:3000/api/health
# Run Lighthouse
lhci autorun
kill "$WEB_PID" "$API_PID"
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
docker:
name: Docker Verify
needs: verify
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Web Docker Image
run: docker build -f apps/web/Dockerfile .
- name: Build API Docker Image
run: docker build -f apps/api/Dockerfile .