-
Notifications
You must be signed in to change notification settings - Fork 7
246 lines (236 loc) · 8.75 KB
/
Copy pathci.yml
File metadata and controls
246 lines (236 loc) · 8.75 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
# 手动触发:pull_request 自动触发偶发不跑时,可在 Actions 页对任意分支重跑 CI。
workflow_dispatch:
# PR 同分支新 push 取消旧 run(main 推送不取消,保证每个 commit 都跑)
# Cancel in-progress runs on new pushes to the same PR branch; main pushes never cancel.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
consistency:
name: Cross-file consistency check / 跨文件一致性检验
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run check-consistency.sh
run: bash scripts/check-consistency.sh
- name: Validate self-host Compose
run: |
bash scripts/selfhost.sh init
test "$(stat --format=%a infra/.env.selfhost)" = "600"
! grep -Eq '__[A-Z_]+__' infra/.env.selfhost
ENV_FILE=.env.selfhost docker compose -f infra/docker-compose.prod.yml -f infra/docker-compose.selfhost.yml --env-file infra/.env.selfhost config --quiet
rm infra/.env.selfhost
selfhost-smoke:
name: self-host · build + health smoke
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Initialize self-host environment
run: |
bash scripts/selfhost.sh init
test "$(stat --format=%a infra/.env.selfhost)" = "600"
! grep -Eq '__[A-Z_]+__' infra/.env.selfhost
- name: Build and start self-host stack
run: |
docker compose -f infra/docker-compose.prod.yml -f infra/docker-compose.selfhost.yml --env-file infra/.env.selfhost build
docker compose -f infra/docker-compose.prod.yml -f infra/docker-compose.selfhost.yml --env-file infra/.env.selfhost up -d --wait --wait-timeout 600
- name: Create self-host user
run: |
printf 'smoke-password' | docker compose -f infra/docker-compose.prod.yml -f infra/docker-compose.selfhost.yml --env-file infra/.env.selfhost run --rm -T paper \
uv run python scripts/create_user.py --email smoke@example.invalid --subject console:smoke --password-stdin
- name: Diagnose failed self-host smoke
if: failure()
run: |
docker compose -f infra/docker-compose.prod.yml -f infra/docker-compose.selfhost.yml --env-file infra/.env.selfhost ps
docker compose -f infra/docker-compose.prod.yml -f infra/docker-compose.selfhost.yml --env-file infra/.env.selfhost logs
- name: Remove self-host stack
if: always()
run: docker compose -f infra/docker-compose.prod.yml -f infra/docker-compose.selfhost.yml --env-file infra/.env.selfhost down -v --remove-orphans
orchestration-typecheck:
name: orchestration · typecheck + test
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/orchestration
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 11
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: packages/orchestration/pnpm-lock.yaml
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm typecheck
- name: Unit tests
run: pnpm test
orchestration-agent-eval:
name: orchestration · agent eval
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: packages/orchestration
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 11
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: packages/orchestration/pnpm-lock.yaml
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: Run offline agent evals
run: pnpm eval:pr -- --report "$RUNNER_TEMP/agent-eval-pr.json"
- name: Upload agent eval report
if: always()
uses: actions/upload-artifact@v4
with:
name: agent-eval-pr
path: ${{ runner.temp }}/agent-eval-pr.json
if-no-files-found: warn
retention-days: 14
web-typecheck:
name: web · typecheck + build
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/web
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 11.1.2
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: apps/web/pnpm-lock.yaml
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm typecheck
- name: Unit tests
run: pnpm test
- name: Static export build
run: pnpm build
- name: Static export checks
run: pnpm test:export
dashboard-typecheck:
name: dashboard · typecheck + build
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/dashboard
steps:
- uses: actions/checkout@v4
# 钉 11.1.2(= packageManager):`version: 11` 取最新 11.x 不认 package.json 的
# pnpm.onlyBuiltDependencies → @swc/core/sharp/@parcel-watcher build script 被判
# ignored 后 install exit 1。11.1.2 认该字段(全新 store 实测 exit 0)。
- uses: pnpm/action-setup@v4
with:
version: 11.1.2
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: pnpm
cache-dependency-path: apps/dashboard/pnpm-lock.yaml
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm typecheck
- name: Unit tests
run: pnpm test
- name: Build (Next.js dynamic app)
run: pnpm build
python-services-lint:
name: python services · ruff + mypy
runs-on: ubuntu-latest
strategy:
matrix:
service: [data, paper, research, factor, evolver]
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Sync dependencies
working-directory: services/${{ matrix.service }}
run: uv sync --frozen
- name: Ruff
working-directory: services/${{ matrix.service }}
run: uv run ruff check .
- name: Mypy (best-effort, allow failure)
working-directory: services/${{ matrix.service }}
run: uv run mypy . || true
python-e1-tests:
name: E1 · ${{ matrix.service }} pytest
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
service: [paper, evolver]
services:
timescaledb:
image: timescale/timescaledb:2.27.2-pg17
env:
POSTGRES_USER: quant
POSTGRES_PASSWORD: devpass
POSTGRES_DB: inalpha_migration_ci_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U quant -d inalpha_migration_ci_test"
--health-interval 5s
--health-timeout 5s
--health-retries 20
env:
DATABASE_URL: postgresql+psycopg://quant:devpass@localhost:5432/inalpha_test
INALPHA_MIGRATION_TEST_DATABASE_URL: postgresql+psycopg://quant:devpass@localhost:5432/inalpha_migration_ci_test
EVOLVER_TEST_DATABASE_URL: postgresql+psycopg://quant:devpass@localhost:5432/inalpha_migration_ci_test
JWT_SECRET: test-secret-do-not-use-in-prod-please-and-thank-you
DATA_SERVICE_URL: http://data-mock.test
PAPER_POOL_DISABLED: "1"
INALPHA_LIVE_RUNNER_RESUME_ON_STARTUP: "false"
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Sync dependencies
working-directory: services/${{ matrix.service }}
run: uv sync --frozen
- name: Apply schema for Evolver tests
if: matrix.service == 'evolver'
working-directory: infra/migrations
run: uv run --project ../../services/evolver alembic upgrade head
env:
DATABASE_URL: postgresql+psycopg://quant:devpass@localhost:5432/inalpha_migration_ci_test
- name: Run service tests
working-directory: services/${{ matrix.service }}
run: uv run pytest -q tests
- name: Verify migration round trip
if: matrix.service == 'evolver'
working-directory: services/evolver
run: uv run pytest -q ../../infra/migrations/tests/test_migration_0038.py