-
Notifications
You must be signed in to change notification settings - Fork 0
188 lines (145 loc) · 4.8 KB
/
Copy pathci.yml
File metadata and controls
188 lines (145 loc) · 4.8 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# Cancel superseded runs on the same PR when new commits are pushed — rapid
# re-pushes otherwise run every stacked CI to completion and waste Actions
# minutes. main is never cancelled (each push gets its own group via run_id):
# its CI success gates the Fly deploy chain, so we never want a main run killed.
concurrency:
group: ci-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
game-core:
name: game-core — typecheck & test
runs-on: ubuntu-latest
# Cap runaway jobs (GitHub's default is 6h) so a hung install/test can't
# silently drain the Actions budget. This job normally finishes in ~2 min.
timeout-minutes: 10
defaults:
run:
working-directory: packages/game-core
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: packages/game-core/package-lock.json
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Format check
run: npm run format:check
- name: Run tests with coverage
run: npm run test:coverage
binder-routing:
name: binder-routing — typecheck & test
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: packages/binder-routing
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: packages/binder-routing/package-lock.json
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Format check
run: npm run format:check
- name: Run tests with coverage
run: npm run test:coverage
frontend:
name: Frontend — typecheck & test
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: frontend/package-lock.json
# Build the shared file: dependency before installing the consumer:
# game-core's dist is gitignored, so a fresh checkout has none and the
# consumer's `npm ci` would otherwise run game-core's build with no
# devDeps. Building it here makes the dist-guarded prepare a no-op.
- name: Build shared game-core
working-directory: packages/game-core
run: npm ci && npm run build
- name: Build shared binder-routing
working-directory: packages/binder-routing
run: npm ci && npm run build
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Format check
run: npm run format:check
- name: Run tests with coverage
run: npm run test:coverage
backend:
name: Backend — typecheck & test
runs-on: ubuntu-latest
timeout-minutes: 15
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: spellcontrol
POSTGRES_PASSWORD: spellcontrol
POSTGRES_DB: spellcontrol
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U spellcontrol -d spellcontrol"
--health-interval 5s
--health-timeout 3s
--health-retries 10
env:
TEST_DATABASE_URL: postgres://spellcontrol:spellcontrol@localhost:5432/spellcontrol
JWT_SECRET: ci-test-jwt-secret-ci-test-jwt-secret
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: backend/package-lock.json
# See the frontend job: build the shared file: dependency before the
# consumer install so its dist-guarded prepare is a no-op.
- name: Build shared game-core
working-directory: packages/game-core
run: npm ci && npm run build
- name: Build shared binder-routing
working-directory: packages/binder-routing
run: npm ci && npm run build
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Lint
run: npm run lint
- name: Format check
run: npm run format:check
- name: Run tests with coverage
run: npm run test:coverage