-
Notifications
You must be signed in to change notification settings - Fork 0
310 lines (258 loc) · 11.2 KB
/
Copy pathci.yml
File metadata and controls
310 lines (258 loc) · 11.2 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
name: CI
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
python-reference:
name: Python Reference Checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Run spec fixtures
run: make test-spec
- name: Run Python CLI tests
run: make test-python
- name: Validate Python module syntax
run: python -m compileall diffly-python
- name: Run CLI smoke test
run: |
python diffly-python/diffly.py \
--a diffly-spec/fixtures/keyed_basic_add_remove_change/a.csv \
--b diffly-spec/fixtures/keyed_basic_add_remove_change/b.csv \
--key id > /tmp/diffly-smoke.jsonl
- name: Run positional CLI smoke test (default mode)
run: |
python diffly-python/diffly.py \
--a diffly-spec/fixtures/positional_basic_add_remove_change/a.csv \
--b diffly-spec/fixtures/positional_basic_add_remove_change/b.csv > /tmp/diffly-smoke-positional.jsonl
- name: Run unordered CLI smoke test (--ignore-row-order)
run: |
python diffly-python/diffly.py \
--a diffly-spec/fixtures/positional_ignore_row_order_basic_add_remove/a.csv \
--b diffly-spec/fixtures/positional_ignore_row_order_basic_add_remove/b.csv \
--ignore-row-order > /tmp/diffly-smoke-unordered.jsonl
- name: Run ignore-column-order keyed smoke test
run: |
python diffly-python/diffly.py \
--a diffly-spec/fixtures/keyed_header_sorted_mode_add/a.csv \
--b diffly-spec/fixtures/keyed_header_sorted_mode_add/b.csv \
--key id \
--ignore-column-order > /tmp/diffly-smoke-ignore-column-order.jsonl
- name: Verify smoke output has schema and stats
run: |
python - <<'PY'
import json
from pathlib import Path
lines = [
json.loads(line)
for line in Path("/tmp/diffly-smoke.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert lines, "Smoke output is empty"
assert lines[0].get("type") == "schema", "First event must be schema"
assert lines[-1].get("type") == "stats", "Last event must be stats"
positional_lines = [
json.loads(line)
for line in Path("/tmp/diffly-smoke-positional.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert positional_lines, "Positional smoke output is empty"
assert positional_lines[0].get("type") == "schema", "First positional event must be schema"
assert positional_lines[-1].get("type") == "stats", "Last positional event must be stats"
unordered_lines = [
json.loads(line)
for line in Path("/tmp/diffly-smoke-unordered.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert unordered_lines, "Unordered smoke output is empty"
assert unordered_lines[0].get("type") == "schema", "First unordered event must be schema"
assert unordered_lines[-1].get("type") == "stats", "Last unordered event must be stats"
assert unordered_lines[-1].get("rows_changed") == 0, "Unordered stats rows_changed must be 0"
ignore_column_lines = [
json.loads(line)
for line in Path("/tmp/diffly-smoke-ignore-column-order.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert ignore_column_lines, "Ignore-column-order smoke output is empty"
assert ignore_column_lines[0].get("type") == "schema", "First ignore-column-order event must be schema"
assert ignore_column_lines[-1].get("type") == "stats", "Last ignore-column-order event must be stats"
PY
rust-conformance:
name: Rust Conformance Checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: diffly-rust
- name: Check Rust formatting
run: cargo fmt --manifest-path diffly-rust/Cargo.toml --all --check
- name: Run Rust unit tests
run: cargo test --manifest-path diffly-rust/Cargo.toml
- name: Run Rust conformance runner
run: make test-spec-rust
- name: Run Rust engine conformance runner (multi-partition parity)
run: make test-spec-rust-engine PARTITIONS=4
- name: Run Rust CLI smoke test
run: |
make diff-rust \
A=diffly-spec/fixtures/keyed_basic_add_remove_change/a.csv \
B=diffly-spec/fixtures/keyed_basic_add_remove_change/b.csv \
KEY=id > /tmp/diffly-rust-smoke.jsonl
- name: Run Rust positional CLI smoke test (default mode)
run: |
make diff-rust \
A=diffly-spec/fixtures/positional_basic_add_remove_change/a.csv \
B=diffly-spec/fixtures/positional_basic_add_remove_change/b.csv > /tmp/diffly-rust-smoke-positional.jsonl
- name: Run Rust unordered CLI smoke test (--ignore-row-order)
run: |
make diff-rust \
A=diffly-spec/fixtures/positional_ignore_row_order_basic_add_remove/a.csv \
B=diffly-spec/fixtures/positional_ignore_row_order_basic_add_remove/b.csv \
IGNORE_ROW_ORDER=1 > /tmp/diffly-rust-smoke-unordered.jsonl
- name: Run Rust ignore-column-order keyed smoke test
run: |
make diff-rust \
A=diffly-spec/fixtures/keyed_header_sorted_mode_add/a.csv \
B=diffly-spec/fixtures/keyed_header_sorted_mode_add/b.csv \
KEY=id \
IGNORE_COLUMN_ORDER=1 > /tmp/diffly-rust-smoke-ignore-column-order.jsonl
- name: Verify Rust smoke output has schema and stats
run: |
python3 - <<'PY'
import json
from pathlib import Path
lines = [
json.loads(line)
for line in Path("/tmp/diffly-rust-smoke.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert lines, "Rust smoke output is empty"
assert lines[0].get("type") == "schema", "First event must be schema"
assert lines[-1].get("type") == "stats", "Last event must be stats"
positional_lines = [
json.loads(line)
for line in Path("/tmp/diffly-rust-smoke-positional.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert positional_lines, "Rust positional smoke output is empty"
assert positional_lines[0].get("type") == "schema", "First positional event must be schema"
assert positional_lines[-1].get("type") == "stats", "Last positional event must be stats"
unordered_lines = [
json.loads(line)
for line in Path("/tmp/diffly-rust-smoke-unordered.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert unordered_lines, "Rust unordered smoke output is empty"
assert unordered_lines[0].get("type") == "schema", "First unordered event must be schema"
assert unordered_lines[-1].get("type") == "stats", "Last unordered event must be stats"
assert unordered_lines[-1].get("rows_changed") == 0, "Rust unordered rows_changed must be 0"
ignore_column_lines = [
json.loads(line)
for line in Path("/tmp/diffly-rust-smoke-ignore-column-order.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert ignore_column_lines, "Rust ignore-column-order smoke output is empty"
assert ignore_column_lines[0].get("type") == "schema", "First ignore-column-order event must be schema"
assert ignore_column_lines[-1].get("type") == "stats", "Last ignore-column-order event must be stats"
PY
- name: Run Rust CLI partitioned smoke test
run: |
make diff-rust \
A=diffly-spec/fixtures/keyed_basic_add_remove_change/a.csv \
B=diffly-spec/fixtures/keyed_basic_add_remove_change/b.csv \
KEY=id \
PARTITIONS=4 > /tmp/diffly-rust-smoke-partitioned.jsonl
- name: Verify partitioned smoke output has schema and stats
run: |
python3 - <<'PY'
import json
from pathlib import Path
lines = [
json.loads(line)
for line in Path("/tmp/diffly-rust-smoke-partitioned.jsonl").read_text(encoding="utf-8").splitlines()
if line.strip()
]
assert lines, "Partitioned rust smoke output is empty"
assert lines[0].get("type") == "schema", "First event must be schema"
assert lines[-1].get("type") == "stats", "Last event must be stats"
PY
web-app:
name: Web App Checks
runs-on: ubuntu-latest
needs:
- python-reference
- rust-conformance
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
cache-dependency-path: diffly-web/package-lock.json
- name: Install web dependencies
run: npm --prefix diffly-web ci
- name: Lint web app
run: make web-lint
- name: Typecheck web app
run: make web-typecheck
- name: Build web app
run: npm --prefix diffly-web run build
deploy-firebase-hosting:
name: Deploy Firebase Hosting (prod)
runs-on: ubuntu-latest
needs: web-app
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
cache-dependency-path: diffly-web/package-lock.json
- name: Install web dependencies
run: npm --prefix diffly-web ci
- name: Build web app
run: npm --prefix diffly-web run build
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Deploy to Firebase Hosting
env:
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
run: |
if [ -z "$FIREBASE_PROJECT_ID" ]; then
echo "Missing required secret: FIREBASE_PROJECT_ID"
exit 1
fi
if [ -z "$FIREBASE_TOKEN" ]; then
echo "Missing required secret: FIREBASE_TOKEN"
exit 1
fi
firebase deploy --only hosting --project "$FIREBASE_PROJECT_ID" --token "$FIREBASE_TOKEN"