-
Notifications
You must be signed in to change notification settings - Fork 6
524 lines (462 loc) · 23.4 KB
/
Copy pathci.yml
File metadata and controls
524 lines (462 loc) · 23.4 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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
name: CI
on:
push:
branches:
- main
- develop
- 2.0-dev
pull_request:
# Run CI for any incoming PR regardless of the base branch so
# feature branches targeting `develop` (e.g. v1.7 prep) also
# exercise the full pipeline.
workflow_dispatch:
schedule:
- cron: '0 5 * * 1'
permissions:
contents: read
# Collapse superseded runs. On a pull request, a new push cancels the still-
# running CI for the previous commit on the same PR — the common case where
# rapid iteration would otherwise queue several full matrix builds. Pushes to
# the integration branches (main / develop / 2.0-dev) are never cancelled, so
# every merged commit keeps a complete, recorded CI run.
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
architecture-and-documentation-guards:
name: Architecture and Documentation Guards
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
env:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Temurin JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: maven
- name: Run core architecture and documentation guards
# Every name here must live in graph-compose-core: the run is scoped to
# that module, and Surefire only fails on an empty selection — a name
# that matches nothing while its siblings match is dropped in silence.
# CiGuardListGuardTest asserts each name resolves under core/src/test.
# Guards owned by other modules (PdfRenderInterfaceGuardTest in
# render-pdf, DocumentationExamplesTest and DocumentationSnippetCompileTest
# in qa) run in build-and-test below, which now also covers docs-only PRs.
run: |
./mvnw -B -ntp clean \
"-Dtest=EnginePdfBoundaryTest,DocumentationCoverageTest,CanonicalSurfaceGuardTest,PackageMapGuardTest,VersionConsistencyGuardTest" \
test -pl :graph-compose-core
changes:
# Path-based change detection for selective CI on pull requests. Emits the
# reverse-dependency flags the heavy jobs gate on: `code` (any build input),
# `docs` (markdown the guard suites read and compile), `core` (the root
# graph-compose-core module — drives japicmp), `perf`
# (modules the smoke benchmark exercises), and `jvm` (published library modules
# + toolchain — drives the JDK matrix width). Pushes/dispatch bypass these gates.
name: Detect changed paths
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
docs: ${{ steps.filter.outputs.docs }}
core: ${{ steps.filter.outputs.core }}
perf: ${{ steps.filter.outputs.perf }}
jvm: ${{ steps.filter.outputs.jvm }}
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Detect changed module paths
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
code:
- '**/*.java'
- '**/pom.xml'
- '**/src/main/resources/**'
- '**/src/test/resources/**'
# The examples module renders figures from the committed perf
# baseline, so a baseline-only refresh changes generated output.
- 'baselines/**'
- '.mvn/**'
- 'mvnw'
- 'mvnw.cmd'
- '.github/workflows/ci.yml'
# Markdown is a build input even though it compiles nothing:
# DocumentationSnippetCompileTest compiles the literal java fences in
# docs/, and the guard suites read README / CONTRIBUTING / docs. Kept
# separate from `code` so a docs-only change runs the reactor (which
# carries those guards) without also running examples-generation,
# which installs eight modules and renders the full example catalogue
# to prove nothing about prose. Deliberately absent from `jvm` too, so
# a docs-only PR uses the baseline JDK alone rather than the matrix.
docs:
- '**/*.md'
core:
- 'core/src/**'
- 'core/pom.xml'
perf:
- 'core/src/**'
- 'render-pdf/**'
- 'templates/**'
- 'benchmarks/**'
- 'core/pom.xml'
# Published library modules + build toolchain. A change here runs the
# full JDK matrix (it ships to users across JVMs); a PR touching only
# the non-published test/build infra (qa, coverage, examples,
# benchmarks, docs) runs the baseline JDK alone.
jvm:
- 'core/src/**'
- 'render-pdf/**'
- 'render-docx/**'
- 'render-pptx/**'
- 'templates/**'
- 'wrapper/**'
- 'testing/**'
- 'fonts/**'
- 'emoji/**'
- 'bundle/**'
- 'core/pom.xml'
- '.mvn/**'
- 'mvnw'
- 'mvnw.cmd'
- '.github/workflows/ci.yml'
build-and-test:
name: Build and run tests (JDK ${{ matrix.java }})
# Selective CI: on a pull request, skip the heavy reactor build + JDK matrix
# when nothing this reactor slice can check has changed. Markdown counts —
# this slice carries the qa guards that compile the published snippets, so a
# docs-only PR runs here (on the baseline JDK alone, since `jvm` stays false)
# rather than merging without any compiler having read the change. Pushes to
# the integration branches and manual dispatch always run the full gate.
if: github.event_name != 'schedule' && (github.event_name != 'pull_request' || needs.changes.outputs.code == 'true' || needs.changes.outputs.docs == 'true')
needs: [architecture-and-documentation-guards, changes]
runs-on: ubuntu-latest
strategy:
# Don't cancel sibling matrix jobs on the first failure — a
# regression on one JDK is informative even if other JDKs are
# still running.
fail-fast: false
matrix:
# 17 = baseline, 21 = previous baseline still supported, 25 = current LTS
# (validates the byte-buddy / Mockito 5.23 bumps that #10 motivated).
# Full three-JDK matrix on a push/dispatch or when a published library
# module / the toolchain changed (`jvm`); a PR that touches only the
# non-published test/build infra runs the baseline JDK alone.
java: ${{ fromJSON((github.event_name != 'pull_request' || needs.changes.outputs.jvm == 'true') && '["17","21","25"]' || '["17"]') }}
env:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Temurin JDK ${{ matrix.java }}
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: maven
- name: Build and run tests
# Reactor slice: the engine, the render-docx semantic backend, the
# render-pptx fixed-layout backend,
# the graph-compose wrapper + graph-compose-bundle (the published empty-jar
# aggregates — covered here so a packaging break is caught on every push, not
# only via the examples job), the extracted graph-compose-testing module, the
# graph-compose-qa cross-module suites (which need the testing module + the
# engine test-jar on the classpath and so cannot live in the engine's own test
# scope — this is where DocumentationSnippetCompileTest, the guard that
# compiles the literal markdown fences in docs/, and DocumentationExamplesTest
# actually run), and the graph-compose-coverage aggregator (JaCoCo over core +
# render-pdf + templates, counting the qa exec, now with a NON-REGRESSION
# RATCHET — this step fails if aggregate INSTRUCTION or BRANCH coverage drops
# below the floor in coverage/pom.xml). -am pulls the fonts / emoji upstreams;
# only examples / benchmarks are excluded (their own CI jobs cover them).
run: ./mvnw -B -ntp clean verify -pl :graph-compose-core,:graph-compose-render-pdf,:graph-compose-render-docx,:graph-compose-render-pptx,:graph-compose-templates,:graph-compose-testing,:graph-compose,:graph-compose-bundle,:graph-compose-qa,:graph-compose-coverage -am
- name: Generate Javadoc
# Run only on the baseline JDK — Javadoc output is identical
# across JVMs and one pass is enough to catch broken @link
# references. Scoped to the engine (its public API is the doclint
# gate); a bare reactor pass would also lint the dev-only benchmarks.
if: matrix.java == '17'
run: ./mvnw -B -ntp javadoc:javadoc -pl :graph-compose-core
- name: Upload aggregate coverage report
# The cross-module JaCoCo report (core + render-pdf + templates coverage,
# counting the qa suites) is published as an artifact for inspection. The
# non-regression gate itself is enforced by the `verify` step above; this just
# captures the numbers. One JDK is enough — coverage is identical across JVMs.
if: matrix.java == '17'
uses: actions/upload-artifact@v7
with:
# Cross-module aggregate (core + render-pdf + templates, counting the qa
# suites). The artifact name is kept for continuity with earlier runs.
name: coverage-core-aggregate-${{ github.run_id }}
path: coverage/target/site/jacoco-aggregate/**
if-no-files-found: error
examples-generation:
name: Examples Generation Smoke Test
# Gated on `code` alone, deliberately narrower than build-and-test above:
# rendering the example catalogue costs eight module installs and proves
# nothing about a markdown change, so a docs-only PR skips it.
if: github.event_name != 'schedule' && (github.event_name != 'pull_request' || needs.changes.outputs.code == 'true')
needs: [build-and-test, changes]
runs-on: ubuntu-latest
env:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Temurin JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: maven
- name: Install graph-compose-fonts (consumed by the examples / benchmarks modules)
# The engine itself does not depend on the fonts artifact, but the
# examples and benchmarks modules render with the bundled families, so
# install graph-compose-fonts into the local repo before building them.
run: ./mvnw -B -ntp -f fonts/pom.xml -DskipTests install
- name: Install graph-compose-emoji (consumed by the examples module)
# The emoji example renders colour emoji from the bundled Noto SVG set.
# Like graph-compose-fonts it carries its own version line, so the reactor
# slice never builds it; installing from source pins the examples to this
# tree's asset set rather than the cached jar at the same coordinate.
run: ./mvnw -B -ntp -f emoji/pom.xml -DskipTests install
- name: Install root artifact (graph-compose-core)
run: ./mvnw -B -ntp -DskipTests install -pl :graph-compose-core
- name: Install graph-compose-render-pdf (the PDF backend the wrapper brings)
# The graph-compose wrapper depends on render-pdf so a bare graph-compose
# renders PDF; install it after the core (its only dependency) and before
# the wrapper.
run: ./mvnw -B -ntp -f render-pdf/pom.xml -DskipTests install
- name: Install graph-compose (the compat wrapper, consumed by the examples module)
# examples depends on the graph-compose coordinate — the empty jar wrapper
# over graph-compose-core + render-pdf. Install it after those so the
# examples build resolves it (and the engine + PDF backend transitively).
run: ./mvnw -B -ntp -f wrapper/pom.xml -DskipTests install
- name: Install graph-compose-render-docx (consumed by the examples module)
# The DOCX export example depends on the render-docx backend module at
# ${graphcompose.version} — the reactor's -SNAPSHOT, which no repository
# can supply. Install it after the engine (its graph-compose dependency)
# so the examples build resolves it.
run: ./mvnw -B -ntp -f render-docx/pom.xml -DskipTests install
- name: Install graph-compose-testing (consumed by the examples module)
# LayoutSnapshotRegressionExample uses LayoutSnapshotJson and EngineDeckData
# reads benchmark JSON through the jackson it brings; the examples pin the
# testing module to the reactor's -SNAPSHOT, so install it after the engine
# (its graph-compose dependency) before the examples build resolves it.
run: ./mvnw -B -ntp -f testing/pom.xml -DskipTests install
- name: Install graph-compose-render-pptx (consumed by the examples module)
# The Engine Deck PPTX example renders the flagship deck through the
# fixed-layout PPTX backend, pinned to the reactor's -SNAPSHOT version.
# Install it after the wrapper (its core + render-pdf compile dependencies) AND the
# testing module — -DskipTests skips execution but Maven still
# resolves render-pptx's test-scope graph-compose-testing dependency.
run: ./mvnw -B -ntp -f render-pptx/pom.xml -DskipTests install
- name: Install graph-compose-templates (consumed by the examples module)
# The flagship + template examples render the built-in CV/invoice/proposal
# presets, which now ship in graph-compose-templates.
run: ./mvnw -B -ntp -f templates/pom.xml -DskipTests install
- name: Compile examples module
run: ./mvnw -B -ntp -f examples/pom.xml clean compile
- name: Run examples tests
# The examples module carries its own tests (flagship layout-snapshot
# baselines, the examples-local theme helpers, the README banner
# renderer). Run them here so a change that shifts a flagship render
# cannot land with a stale committed baseline.
run: ./mvnw -B -ntp -f examples/pom.xml test
- name: Run GenerateAllExamples
run: |
./mvnw -B -ntp -f examples/pom.xml exec:java \
"-Dexec.mainClass=com.demcha.examples.GenerateAllExamples"
- name: Upload generated PDFs
if: always()
uses: actions/upload-artifact@v7
with:
name: examples-pdfs-${{ github.run_id }}
path: examples/target/generated-pdfs/**
if-no-files-found: error
binary-compat:
name: Binary Compatibility (japicmp vs pom baseline)
# japicmp diffs the graph-compose-core public surface, so it only matters
# when the core module (`core/src/**` or `core/pom.xml`) changed.
if: github.event_name == 'pull_request' && needs.changes.outputs.core == 'true'
needs: [architecture-and-documentation-guards, changes]
runs-on: ubuntu-latest
env:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Temurin JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: maven
- name: Compare public API against baseline
# The `japicmp` profile resolves the baseline release pinned
# by the `japicmp.baseline` property in core/pom.xml (the
# published graph-compose-core on Maven Central) and diffs it
# against the freshly-built artifact. Fails the job on any binary-
# incompatible modification to the public surface. Source-
# incompatible changes are reported only (phased policy).
run: ./mvnw -B -ntp -DskipTests -P japicmp verify -pl :graph-compose-core
- name: Upload japicmp report
if: always()
uses: actions/upload-artifact@v7
with:
name: japicmp-report-${{ github.run_id }}
path: core/target/japicmp/**
if-no-files-found: ignore
perf-smoke:
name: Performance Smoke Check
# The smoke benchmark only exercises core + render-pdf + templates (built via
# the benchmarks module), so skip it when none of those changed.
if: github.event_name == 'pull_request' && needs.changes.outputs.perf == 'true'
needs: [architecture-and-documentation-guards, changes]
runs-on: ubuntu-latest
env:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Temurin JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: maven
- name: Install graph-compose-fonts (consumed by the examples / benchmarks modules)
# The engine itself does not depend on the fonts artifact, but the
# examples and benchmarks modules render with the bundled families, so
# install graph-compose-fonts into the local repo before building them.
run: ./mvnw -B -ntp -f fonts/pom.xml -DskipTests install
- name: Install root artifact
run: ./mvnw -B -ntp -DskipTests install -pl :graph-compose-core
- name: Install graph-compose-render-pdf (consumed by the benchmarks module)
# benchmarks call buildPdf and reference the PDF backend types directly, so
# it depends on render-pdf; install it after the core, before the benchmarks
# build resolves it.
run: ./mvnw -B -ntp -f render-pdf/pom.xml -DskipTests install
- name: Install graph-compose-templates (consumed by the benchmarks module)
run: ./mvnw -B -ntp -f templates/pom.xml -DskipTests install
- name: Compile benchmarks module
run: ./mvnw -B -ntp -f benchmarks/pom.xml clean compile
- name: Run deterministic benchmark gates
# Fast, machine-independent unit/gate tests (image-cache reuse,
# render-operator coalescing, measurement counts, scenario/threshold
# coverage, diff tooling). Catches structural regressions the timing
# smoke run cannot: these are exact integers, so unlike a millisecond
# ceiling they separate a slower engine from a slower machine.
run: ./mvnw -B -ntp -f benchmarks/pom.xml test
- name: Run coarse performance smoke benchmark
run: |
./mvnw -B -ntp -f benchmarks/pom.xml -DskipTests \
exec:java \
"-Dexec.mainClass=com.demcha.compose.CurrentSpeedBenchmark" \
"-Dgraphcompose.benchmark.profile=smoke"
- name: Upload smoke benchmark artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: benchmark-smoke-${{ github.run_id }}
path: benchmarks/target/benchmarks/current-speed/**
if-no-files-found: ignore
- name: Upload benchmark gate reports
if: always()
uses: actions/upload-artifact@v7
with:
name: benchmark-gate-reports-${{ github.run_id }}
path: benchmarks/target/surefire-reports/**
if-no-files-found: ignore
ci-gate:
name: CI Gate
# Single stable status check aggregating the selective jobs above. Green when
# every job that ran succeeded; a job legitimately skipped by the path filter
# counts as success. Point branch protection at "CI Gate" (plus the always-run
# "Architecture and Documentation Guards") instead of the individual, sometimes
# -skipped matrix legs so a docs-only PR is never left waiting on a check that
# never reports.
if: always() && github.event_name != 'schedule'
needs: [architecture-and-documentation-guards, build-and-test, examples-generation, binary-compat, perf-smoke]
runs-on: ubuntu-latest
steps:
- name: Fail if any required job failed
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "A required CI job failed or was cancelled: ${{ join(needs.*.result, ', ') }}"
exit 1
benchmark-diff:
name: Weekly Benchmark Diff
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
env:
JAVA_TOOL_OPTIONS: -Djava.awt.headless=true
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Set up Temurin JDK 17
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
cache: maven
- name: Restore benchmark history cache
uses: actions/cache@v6
with:
path: benchmarks/target/benchmarks/current-speed
key: benchmark-current-speed-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
benchmark-current-speed-${{ github.ref_name }}-
benchmark-current-speed-
- name: Install graph-compose-fonts (consumed by the examples / benchmarks modules)
# The engine itself does not depend on the fonts artifact, but the
# examples and benchmarks modules render with the bundled families, so
# install graph-compose-fonts into the local repo before building them.
run: ./mvnw -B -ntp -f fonts/pom.xml -DskipTests install
- name: Install root artifact
run: ./mvnw -B -ntp -DskipTests install -pl :graph-compose-core
- name: Install graph-compose-render-pdf (consumed by the benchmarks module)
# benchmarks call buildPdf and reference the PDF backend types directly, so
# it depends on render-pdf; install it after the core, before the benchmarks
# build resolves it.
run: ./mvnw -B -ntp -f render-pdf/pom.xml -DskipTests install
- name: Install graph-compose-templates (consumed by the benchmarks module)
run: ./mvnw -B -ntp -f templates/pom.xml -DskipTests install
- name: Compile benchmarks module
run: ./mvnw -B -ntp -f benchmarks/pom.xml clean compile
- name: Run full benchmark suite
run: |
./mvnw -B -ntp -f benchmarks/pom.xml -DskipTests \
exec:java \
"-Dexec.mainClass=com.demcha.compose.CurrentSpeedBenchmark" \
"-Dgraphcompose.benchmark.profile=full" \
"-Dgraphcompose.benchmark.enforceGate=false"
- name: Count available benchmark runs
id: benchmark-runs
run: |
count=0
if [ -d benchmarks/target/benchmarks/current-speed ]; then
count=$(find benchmarks/target/benchmarks/current-speed -maxdepth 1 -name 'run-*.json' | wc -l | tr -d ' ')
fi
echo "count=$count" >> "$GITHUB_OUTPUT"
- name: Diff newest benchmark reports
if: steps.benchmark-runs.outputs.count != '0' && steps.benchmark-runs.outputs.count != '1'
run: |
./mvnw -B -ntp -f benchmarks/pom.xml -DskipTests \
exec:java \
"-Dexec.mainClass=com.demcha.compose.BenchmarkDiffTool" \
"-Dexec.args=current-speed"
- name: Upload benchmark artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: benchmark-full-${{ github.run_id }}
path: |
benchmarks/target/benchmarks/current-speed/**
benchmarks/target/benchmarks/diffs/current-speed/**
if-no-files-found: ignore