-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (93 loc) · 3.49 KB
/
Copy pathci.yml
File metadata and controls
110 lines (93 loc) · 3.49 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: [master]
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
verify:
name: Lint, typecheck & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: npm
- run: npm ci --ignore-scripts
- run: npm run format:check
- run: npm run lint
- run: npm run typecheck
- run: npm test
- run: npm run build:web
env:
NEXT_TELEMETRY_DISABLED: "1"
- name: Migrations are in sync with the schema
run: |
npm run db:generate -- --name drift-check
git status --porcelain apps/api/drizzle | grep . && { echo "::error::Schema changes without a migration. Run npm run db:generate."; exit 1; } || true
- name: Audit production dependencies
run: npm audit --omit=dev --audit-level=low
postgres:
name: Integration tests on PostgreSQL
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
env:
POSTGRES_USER: platform
POSTGRES_PASSWORD: platform
POSTGRES_DB: platform_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U platform -d platform_test"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24
cache: npm
- run: npm ci --ignore-scripts
- run: npx tsc -b packages/scoring packages/contracts
- run: npx vitest run --project api --no-file-parallelism
env:
TEST_DATABASE_URL: postgres://platform:platform@127.0.0.1:5432/platform_test
compose:
name: Validate compose files and images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Placeholder env
run: sed -E 's/^([A-Z0-9_]+)=$/\1=placeholder/' .env.example > .env
- run: docker compose -f docker-compose.yml config --quiet
- run: docker compose -f docker-compose.yml -f docker-compose.local.yml config --quiet
- name: Every referenced variable is documented in .env.example
run: |
status=0
for var in $(grep -hv '^[[:space:]]*#' docker-compose*.yml | grep -oE '\$\{[A-Z0-9_]+' | tr -d '${' | sort -u); do
grep -qE "^${var}=" .env.example || { echo "::error::${var} missing from .env.example"; status=1; }
done
exit "$status"
- name: Build images
run: docker compose -f docker-compose.yml build
- name: Scan images for vulnerabilities
run: |
for image in platform-api platform-discord; do
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy:0.66.0 image --exit-code 1 --ignore-unfixed --severity CRITICAL,HIGH,MEDIUM "$image"
done