Repository navigation
359 lines (303 loc) · 10.7 KB
/
Copy pathci.yml
File metadata and controls
359 lines (303 loc) · 10.7 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
name: CI
# Security: Do not replace `pull_request` with `pull_request_target` to expose secrets or
# GITHUB_TOKEN write access to PR code. pull_request_target runs untrusted fork PR code with
# base-branch privileges.
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
TZ: UTC
CI: true
OC_ENV: ci
NODE_ENV: test
AWS_KEY: user
AWS_SECRET: password
AWS_S3_BUCKET: opencollective-e2e
AWS_S3_REGION: us-east-1
AWS_S3_API_VERSION: latest
AWS_S3_ENDPOINT: http://localhost:9000
AWS_S3_SSL_ENABLED: false
AWS_S3_FORCE_PATH_STYLE: true
jobs:
lint:
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
- name: Restore ESLint cache
uses: actions/cache@v6
with:
path: .eslintcache
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-eslint-${{ hashFiles('eslint.config.mjs', 'package-lock.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ secrets.CACHE_VERSION }}-eslint-${{ hashFiles('eslint.config.mjs', 'package-lock.json') }}-
- run: npm run lint:check
prettier:
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
- name: Restore Prettier cache
uses: actions/cache@v6
with:
path: .prettiercache
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-prettier-${{ hashFiles('.prettierrc', 'package-lock.json') }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ secrets.CACHE_VERSION }}-prettier-${{ hashFiles('.prettierrc', 'package-lock.json') }}-
- run: npm run prettier:check
typescript:
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
- name: Restore TypeScript incremental cache
uses: actions/cache@v6
with:
path: tsconfig.tsbuildinfo
# Exact commit only: restoring tsbuildinfo from another SHA corrupts incremental state and can crash tsc (stack overflow on TS 6).
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-tsc-${{ hashFiles('tsconfig.json', 'package-lock.json') }}-${{ github.sha }}
- run: npm run type:check
depcheck:
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
- run: npm run depcheck
ts-unused-exports:
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
- name: Check unused exports
run: npm run ts-unused-exports
build:
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
- name: Build
run: npm run build
test:
runs-on: ubuntu-26.04
timeout-minutes: 30
env:
PG_DATABASE: opencollective_test
services:
redis:
image: valkey/valkey:9.1
ports:
- 6379:6379
postgres:
image: postgres:16.15
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 5
rustfs:
image: rustfs/rustfs:1.0.0-rc.6@sha256:97171b3d72cd47dc81000f92ea84de25608bfc35a94c965501afaeb5d99f6035
ports:
- 9000:9000
options: --name=rustfs --health-cmd "curl -f http://localhost:9000/health/ready"
env:
RUSTFS_ACCESS_KEY: user
RUSTFS_SECRET_KEY: password
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
# The ubuntu-26.04 image ships PostgreSQL 18 client tools, whose pg_restore emits
# `SET transaction_timeout` that the PostgreSQL 16 service rejects. Run them from the postgres:16 image.
- run: npm run db:restore:test
env:
USE_DOCKER: true
- name: Test
if: github.event_name != 'push' || github.ref != 'refs/heads/main'
run: npm run test:ci -- --ignore "test/server/graphql/**"
- name: Test with coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npm run test:coverage -- --ignore "test/server/graphql/**"
- name: Report coverage
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: Unit
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: Unit
files: test-results.xml
report_type: test_results
test-graphql:
runs-on: ubuntu-26.04
timeout-minutes: 30
env:
PG_DATABASE: opencollective_test
services:
redis:
image: valkey/valkey:9.1
ports:
- 6379:6379
postgres:
image: postgres:16.15
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 5
opensearch:
image: opensearchproject/opensearch:3
ports:
- 9200:9200
env:
discovery.type: single-node
DISABLE_INSTALL_DEMO_CONFIG: 'true'
DISABLE_SECURITY_PLUGIN: 'true'
options: >-
--health-cmd="curl --silent --fail http://localhost:9200/_cluster/health || exit 1"
--health-interval=10s
--health-timeout=15s
--health-retries=30
rustfs:
image: rustfs/rustfs:1.0.0-rc.6@sha256:97171b3d72cd47dc81000f92ea84de25608bfc35a94c965501afaeb5d99f6035
ports:
- 9000:9000
options: --name=rustfs --health-cmd "curl -f http://localhost:9000/health/ready"
env:
RUSTFS_ACCESS_KEY: user
RUSTFS_SECRET_KEY: password
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
# The ubuntu-26.04 image ships PostgreSQL 18 client tools, whose pg_restore emits
# `SET transaction_timeout` that the PostgreSQL 16 service rejects. Run them from the postgres:16 image.
- run: npm run db:restore:test
env:
USE_DOCKER: true
- name: Test
if: github.event_name != 'push' || github.ref != 'refs/heads/main'
run: npm run test:ci test/server/graphql
- name: Test with coverage
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npm run test:coverage test/server/graphql
- name: Report coverage
if: ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: GraphQL
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: test-results.xml
report_type: test_results
schema-update:
runs-on: ubuntu-26.04
timeout-minutes: 30
services:
redis:
image: valkey/valkey:9.1
ports:
- 6379:6379
postgres:
image: postgres:16.15
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup project
uses: ./.github/actions/setup-project
with:
CACHE_VERSION: ${{ secrets.CACHE_VERSION }}
- name: Generate & check schemas
run: ./scripts/check-schemas.sh
graphql-inspector:
name: GraphQL Inspector
runs-on: ubuntu-26.04
# The action publishes its results as check runs (with annotations) and reads PR labels for the
# approve-label override. Workflows triggered by Dependabot get a read-only GITHUB_TOKEN by
# default, so the write scope must be requested explicitly. This job never installs or runs
# code from the PR (it only diffs the committed schema files), so the token is only ever
# handled by the SHA-pinned action below.
permissions:
contents: read
checks: write
pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: GraphQL Inspector (V1)
uses: graphql-hive/graphql-inspector@c0ecb19ad21de709b80ed897041a4976c079c718 # v4.0.0
with:
name: 'GraphQL Inspector - Schema v1'
github-token: ${{ secrets.GITHUB_TOKEN }}
schema: 'main:server/graphql/schemaV1.graphql'
fail-on-breaking: false
- name: GraphQL Inspector (V2)
uses: graphql-hive/graphql-inspector@c0ecb19ad21de709b80ed897041a4976c079c718 # v4.0.0
with:
name: 'GraphQL Inspector - Schema v2'
github-token: ${{ secrets.GITHUB_TOKEN }}
schema: 'main:server/graphql/schemaV2.graphql'
fail-on-breaking: false