Repository navigation
339 lines (270 loc) · 10 KB
/
Copy pathci.yml
File metadata and controls
339 lines (270 loc) · 10 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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
DOTNET_NOLOGO: "true"
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
jobs:
# -------------------------------------------------------------
# 1. Rust Workspace: Formatter, Clippy & Workspace Tests
# -------------------------------------------------------------
rust-check:
name: Rust (Format, Clippy & Tests)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Prepare Python generated-consumer environment
run: |
uv venv --python python .venv
uv pip install --python .venv/bin/python -e "./crates/polyxml-python[dev]"
echo "$PWD/.venv/bin" >> "$GITHUB_PATH"
- name: Set up generated-consumer Node.js
uses: actions/setup-node@v7
with:
node-version: "22"
- name: Install generated-consumer TypeScript compiler
run: npm install --global typescript@5.9.3
- name: Set up generated-consumer Java
uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: "25"
- name: Set up generated-consumer Go
uses: actions/setup-go@v7
with:
go-version: "1.26.x"
- name: Verify Multi-Language Version Parity
run: python scripts/sync_version.py --check
- name: Check Formatting
run: cargo fmt --all --check
- name: Clippy Linter
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Initialize .NET Environment
run: |
dotnet --info
dotnet new console -o /tmp/dotnet-init --force
dotnet build /tmp/dotnet-init
rm -rf /tmp/dotnet-init
- name: Run Core & C-ABI Tests
run: cargo test -p polyxml -p polyxml-c --verbose
- name: Verify Pinned UBL 2.4 C# Corpus
run: python scripts/verify_ubl_csharp.py
- name: Build C-ABI Shared Library (Artifact)
run: cargo build --release -p polyxml-c
- name: Upload Native Lib
uses: actions/upload-artifact@v7
with:
name: polyxml-native-linux
path: target/release/libpolyxml.so
# -------------------------------------------------------------
# 2. Python Matrix: 100% Coverage on Linux, macOS, Windows
# -------------------------------------------------------------
python-check:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
needs: rust-check
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.python-version == '3.15' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.12", "3.13", "3.14", "3.15"]
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build PolyXML CLI Binary
run: cargo build -p polyxml-cli
- name: Build and Install PolyXML Python Extension
working-directory: crates/polyxml-python
run: uv pip install --system -e ".[dev]"
- name: Ruff Linter
working-directory: crates/polyxml-python
run: ruff check python/ tests/
- name: Pytest with 100% Coverage Enforcement
working-directory: crates/polyxml-python
run: pytest --cov=polyxml --cov-branch --cov-fail-under=100 -v
# -------------------------------------------------------------
# 3. C++20 Bindings: CMake Build & CTest
# -------------------------------------------------------------
cpp-check:
name: C++20 Bindings
needs: rust-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Native Library
run: cargo build --release -p polyxml-c
- name: Configure CMake
working-directory: bindings/cpp
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build C++ Test
working-directory: bindings/cpp
run: cmake --build build --config Release
- name: Run C++ Test Suite
working-directory: bindings/cpp/build
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/target/release
run: ./test_polyxml
# -------------------------------------------------------------
# 4. Go Bindings: Cgo Build & Test
# -------------------------------------------------------------
go-check:
name: Go Bindings
needs: rust-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version: "1.22"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Native Library
run: cargo build --release -p polyxml-c
- name: Check Go module header
run: cmp crates/polyxml-c/include/polyxml.h bindings/go/polyxml.h
- name: Check Go module fixture
run: cmp tests/fixtures/atom_feed.xml bindings/go/testdata/atom_feed.xml
- name: Run Go Tests
working-directory: bindings/go
env:
CGO_LDFLAGS: "-L${{ github.workspace }}/target/release -lpolyxml"
LD_LIBRARY_PATH: "${{ github.workspace }}/target/release"
run: go test -v ./...
# -------------------------------------------------------------
# 5. Node.js / TypeScript: NAPI Build & Test
# -------------------------------------------------------------
node-check:
name: Node.js ${{ matrix.node-version }}
needs: rust-check
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install NAPI CLI
run: npm install -g @napi-rs/cli
- name: Build NAPI Addon
working-directory: crates/polyxml-js
run: napi build --platform --release
- name: Run Node.js Tests
working-directory: crates/polyxml-js
run: npm test
# -------------------------------------------------------------
# 6. WebAssembly: build and exercise the publishable package
# -------------------------------------------------------------
wasm-check:
name: WebAssembly package
runs-on: ubuntu-latest
env:
PLAYWRIGHT_HOST_PLATFORM_OVERRIDE: ubuntu24.04-x64
steps:
- uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 22
- name: Install Rust and Wasm target
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
- name: Install wasm-pack
run: cargo install wasm-pack --version 0.15.0 --locked
- name: Build Wasm npm package
run: ./crates/polyxml-wasm/build.sh
- name: Test Wasm package
run: node --test crates/polyxml-wasm/test/*.test.mjs
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Test Wasm package with Bun
run: bun test crates/polyxml-wasm/test/wasm.test.mjs
- name: Validate npm package contents
run: npm pack --dry-run ./crates/polyxml-wasm/pkg
- name: Install browser benchmark dependencies
run: npm ci --prefix benchmarks/typescript-wasm
- name: Smoke test Node and Bun benchmarks
run: |
node --expose-gc benchmarks/typescript-wasm/bench.mjs micro
bun benchmarks/typescript-wasm/bench.mjs micro
- name: Install headless Chromium
run: npm exec --prefix benchmarks/typescript-wasm -- playwright install chromium-headless-shell
- name: Smoke test browser Wasm runtime
run: node benchmarks/typescript-wasm/browser-runner.mjs micro
# -------------------------------------------------------------
# 7. Java Bindings: OpenJDK 22 & Maven Test (Panama FFI)
# -------------------------------------------------------------
java-check:
name: Java 22 (Panama FFI)
needs: rust-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up Java 22
uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: "22"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Native Library
run: cargo build --release -p polyxml-c
- name: Run Maven Tests
working-directory: bindings/java
env:
LD_LIBRARY_PATH: ${{ github.workspace }}/target/release
run: mvn test -DargLine="--enable-native-access=ALL-UNNAMED -Djava.library.path=${{ github.workspace }}/target/release"
java-spring-check:
name: Java 25 / Spring Boot 4 generated models
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- name: Set up Java 25
uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: "25"
cache: maven
cache-dependency-path: tests/java-spring/pom.xml
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
- name: Test generated JSON/XML models through Spring HTTP converters
run: ./scripts/verify_spring_boot.sh