-
Notifications
You must be signed in to change notification settings - Fork 5
187 lines (153 loc) · 5.21 KB
/
Copy pathci.yml
File metadata and controls
187 lines (153 loc) · 5.21 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
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
rust:
name: rust (fmt + clippy + test)
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://mm:mm@127.0.0.1:5432/mm
REDIS_URL: redis://127.0.0.1:6379/0
DEV_AUTH_TOKEN: dev-ci-token
RUST_LOG: warn
CARGO_TERM_COLOR: always
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: mm
POSTGRES_PASSWORD: mm
POSTGRES_DB: mm
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U mm -d mm"
--health-interval 3s
--health-timeout 2s
--health-retries 10
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 3s
--health-timeout 2s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain (from rust-toolchain.toml)
uses: dtolnay/rust-toolchain@stable
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Cache sqlx-cli binary
id: cache-sqlx
uses: actions/cache@v4
with:
path: ~/.cargo/bin/sqlx
key: sqlx-cli-${{ runner.os }}-v0.8-postgres-rustls
- name: Install sqlx-cli
if: steps.cache-sqlx.outputs.cache-hit != 'true'
run: cargo install sqlx-cli --no-default-features --features postgres,rustls --locked
- name: cargo fmt --check
run: cargo fmt --all -- --check
- name: Run sqlx migrations
working-directory: crates/gateway
run: sqlx migrate run
# Prime target/ with a single `cargo test --no-run` so the dep build
# graph (incl. test-cfg) lands in cache exactly once. clippy below uses
# `--no-deps` so it ignores dependency lints (we don't gate on those
# anyway) and just re-lints the gateway crate against the same rmeta
# the test step will reuse. Net effect: ~2-4 min off cold CI runs.
- name: cargo test --no-run (prime cache)
run: cargo test --workspace --all-targets --no-run
- name: cargo clippy (workspace only)
run: cargo clippy --workspace --all-targets --no-deps -- -D warnings
- name: cargo test
run: cargo test --workspace
python:
name: python (ruff + pytest)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: latest
enable-cache: true
- name: Install Python 3.11
run: uv python install 3.11
- name: uv sync (frozen)
run: uv sync --frozen
- name: ruff check
run: uv tool run ruff check .
- name: pytest
run: uv run pytest apps/agent-worker -q
web:
name: web (typecheck + build)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
# Version pinned via root package.json `packageManager`; passing it
# here would collide (ERR_PNPM_BAD_PM_VERSION).
uses: pnpm/action-setup@v4
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: vue-tsc typecheck
run: pnpm --filter web typecheck
- name: vite build
run: pnpm --filter web build
contracts-drift:
name: contracts-drift (non-blocking)
runs-on: ubuntu-latest
# Non-blocking: datamodel-code-generator is installed ad-hoc (not in uv.lock),
# so codegen could drift on transitive updates. See README "Known limitations".
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: latest
enable-cache: true
- name: Install Python 3.11
run: uv python install 3.11
- name: uv sync (frozen)
run: uv sync --frozen
- name: Install pnpm
# Version pinned via root package.json `packageManager`; passing it
# here would collide (ERR_PNPM_BAD_PM_VERSION).
uses: pnpm/action-setup@v4
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: pnpm install
run: pnpm install --frozen-lockfile
- name: Install datamodel-code-generator
run: uv tool install 'datamodel-code-generator[http]'
- name: Regenerate contracts
run: |
datamodel-codegen \
--input packages/contracts/openapi.yaml \
--input-file-type openapi \
--output packages/py-contracts/src/mm_contracts/generated.py \
--output-model-type pydantic_v2.BaseModel \
--target-python-version 3.11
pnpm exec openapi-typescript packages/contracts/openapi.yaml -o packages/ts-contracts/src/generated.ts
- name: Fail if generated contracts drifted
run: git diff --exit-code packages/py-contracts packages/ts-contracts