-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (152 loc) · 5.07 KB
/
Copy pathci.yml
File metadata and controls
184 lines (152 loc) · 5.07 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
name: CI
on:
push:
branches: [dev, main]
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
# Mock secrets are shared by all jobs because `bun install` runs `postinstall`
# (`nuxt prepare`), which throws on missing keys during module init.
env:
# Mock DB port, because quality doesn't use the DB
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/rasg_test?schema=public
NUXT_TELEMETRY_DISABLED: '1'
NODE_ENV: test
AUTH_SECRET: ci-mock-auth-secret-not-for-production
AUTH_ORIGIN: http://localhost:3000
STRIPE_PK: pk_test_ci_mock
STRIPE_SK: sk_test_ci_mock
STRIPE_WEBHOOK_SECRET: whsec_ci_mock
XAI_API_KEY: ci-mock
OPENMODERATOR_API_KEY: ci-mock
CDN_URL: https://cdn.topiqu.com
EMAIL_FROM: ci@example.com
NUXT_MAIL_USER: ci@example.com
AWS_ACCESS_KEY_ID: ci-mock
AWS_SECRET_ACCESS_KEY: ci-mock
AWS_REGION: eu-central-1
AWS_S3_BUCKET_NAME: ci-mock-bucket
jobs:
quality:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
with:
bun-version: 1.3.14
- name: Cache Nuxt build artifacts
uses: actions/cache@v4
with:
path: |
.nuxt
node_modules/.cache
key: nuxt-${{ runner.os }}-${{ hashFiles('package.json', 'bun.lock', 'nuxt.config.ts') }}
restore-keys: |
nuxt-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
# Needed for typecheck
- name: Generate ZenStack / Prisma client
run: bun run zenstack:generate
- name: Lint
run: bun run lint
- name: Check OpenAPI contract
run: bun run openapi:check
- name: Typecheck
run: bun run typecheck
test:
name: Test
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/rasg_unused?schema=public
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/rasg_test?schema=public
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: rasg_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
with:
bun-version: 1.3.14
- name: Cache Nuxt build artifacts
uses: actions/cache@v4
with:
path: |
.nuxt
node_modules/.cache
key: nuxt-${{ runner.os }}-${{ hashFiles('package.json', 'bun.lock', 'nuxt.config.ts') }}
restore-keys: |
nuxt-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Generate ZenStack / Prisma client
run: bun run zenstack:generate
- name: Apply database migrations
run: bun run prisma:deploy
env:
DATABASE_URL: ${{ env.TEST_DATABASE_URL }}
DIRECT_DATABASE_URL: ${{ env.TEST_DATABASE_URL }}
- name: Test
run: bun run test
release-smoke:
name: Production release smoke
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: rasg_release_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
APP_ENV: production
PLAYWRIGHT_USE_BUILD: '1'
TEST_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/rasg_release_test?schema=public
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2.1.3
with:
bun-version: 1.3.14
- name: Verify frozen dependency graph
run: bun --bun install --shamefully-hoist --frozen-lockfile
- name: Generate ZenStack / Prisma client
run: bun run zenstack:generate
- name: Apply database migrations
run: bun run prisma:deploy
env:
DATABASE_URL: ${{ env.TEST_DATABASE_URL }}
DIRECT_DATABASE_URL: ${{ env.TEST_DATABASE_URL }}
- name: Build production output
run: bun run build:docker
- name: Install browser engines
run: bunx playwright install --with-deps chromium webkit
- name: Test production assets and service worker
run: bun run test:e2e:release
- name: Test wallet pagination and scrolling
run: bun run test:e2e token-wallet.spec.ts --project=desktop-light-en --project=mobile-light-en