Skip to content

Commit a1c6ae3

Browse files
larsbeckclaude
andcommitted
build(conference-scheduling): lint OpenAPI spec with vacuum in CI
Moves the vacuum lint out of the maven build into a dedicated GitHub workflow, following vacuum's documented CI/CD setup. The workflow lints the committed spec of every model shipping a .vacuum-ruleset.yaml, so future converted models are covered automatically. The generated src/build/openapi.json is now committed (force-added past the root .gitignore's "build" pattern) to keep the lint standalone and make spec drift visible in diffs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qae2bExuXdkKjDJjFXynGi
1 parent 94eaa93 commit a1c6ae3

3 files changed

Lines changed: 2981 additions & 135 deletions

File tree

.github/workflows/lint_openapi.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: OpenAPI Lint
2+
3+
on:
4+
push:
5+
branches: [stable, development, '*.x']
6+
paths:
7+
- 'use-cases/**'
8+
- '.github/workflows/lint_openapi.yml'
9+
pull_request:
10+
branches: [stable, development, '*.x']
11+
paths:
12+
- 'use-cases/**'
13+
- '.github/workflows/lint_openapi.yml'
14+
15+
jobs:
16+
vacuum:
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
steps:
20+
- name: Checkout timefold-quickstarts
21+
uses: actions/checkout@v7
22+
23+
# The GitHub token prevents intermittent installation failures caused by
24+
# API rate limiting. It only accesses public repository information.
25+
- name: Install vacuum
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: curl -fsSL https://quobix.com/scripts/install_vacuum.sh | sh
29+
30+
# Lints the committed OpenAPI spec of every model that ships a vacuum ruleset.
31+
- name: Lint OpenAPI specs
32+
run: |
33+
found=0
34+
for ruleset in use-cases/*/.vacuum-ruleset.yaml; do
35+
model_dir="$(dirname "$ruleset")"
36+
spec="$model_dir/src/build/openapi.json"
37+
if [ ! -f "$spec" ]; then
38+
echo "::error::$model_dir has a vacuum ruleset but no committed spec at $spec"
39+
exit 1
40+
fi
41+
found=1
42+
echo "::group::vacuum lint $spec"
43+
vacuum lint --ruleset "$ruleset" --details --fail-severity error "$spec"
44+
echo "::endgroup::"
45+
done
46+
if [ "$found" -eq 0 ]; then
47+
echo "::error::no .vacuum-ruleset.yaml found under use-cases/"
48+
exit 1
49+
fi

use-cases/conference-scheduling/pom.xml

Lines changed: 2 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
<revision>1.0.0-SNAPSHOT</revision>
1818
<error-prone.version>2.50.0</error-prone.version>
1919
<jacoco.version>0.8.15</jacoco.version>
20-
<vacuum.version>0.29.9</vacuum.version>
21-
<vacuum.binary.extension></vacuum.binary.extension>
2220
<maven.compiler.release>21</maven.compiler.release>
2321
</properties>
2422

@@ -244,56 +242,8 @@
244242
</configuration>
245243
</plugin>
246244

247-
<!-- Vacuum is a native Go binary; the npm package is just one of its distribution channels.
248-
Downloading the platform binary directly keeps node/npm out of the maven build. -->
249-
<plugin>
250-
<groupId>io.github.download-maven-plugin</groupId>
251-
<artifactId>download-maven-plugin</artifactId>
252-
<version>2.0.0</version>
253-
<executions>
254-
<execution>
255-
<id>download-vacuum</id>
256-
<phase>generate-resources</phase>
257-
<goals>
258-
<goal>wget</goal>
259-
</goals>
260-
<configuration>
261-
<url>
262-
https://github.com/daveshanley/vacuum/releases/download/v${vacuum.version}/vacuum_${vacuum.version}_${vacuum.os}_${vacuum.arch}.tar.gz</url>
263-
<unpack>true</unpack>
264-
<outputDirectory>${project.build.directory}/vacuum</outputDirectory>
265-
</configuration>
266-
</execution>
267-
</executions>
268-
</plugin>
269-
270-
<plugin>
271-
<groupId>org.codehaus.mojo</groupId>
272-
<artifactId>exec-maven-plugin</artifactId>
273-
<version>3.6.3</version>
274-
<executions>
275-
<execution>
276-
<id>lint-openapi-descriptions</id>
277-
<phase>verify</phase>
278-
<goals>
279-
<goal>exec</goal>
280-
</goals>
281-
<configuration>
282-
<executable>${project.build.directory}/vacuum/vacuum${vacuum.binary.extension}</executable>
283-
<arguments>
284-
<argument>lint</argument>
285-
<argument>--ruleset</argument>
286-
<argument>${project.basedir}/.vacuum-ruleset.yaml</argument>
287-
<argument>--details</argument>
288-
<argument>--fail-severity</argument>
289-
<argument>error</argument>
290-
<argument>${project.basedir}/src/build/openapi.json</argument>
291-
</arguments>
292-
</configuration>
293-
</execution>
294-
</executions>
295-
</plugin>
296-
245+
<!-- Persists the generated OpenAPI spec so CI (see .github/workflows/lint_openapi.yml)
246+
can lint it with vacuum without building the project. -->
297247
<plugin>
298248
<artifactId>maven-resources-plugin</artifactId>
299249
<version>3.5.0</version>
@@ -361,88 +311,5 @@
361311
</plugins>
362312
</build>
363313

364-
<!-- Selects the matching vacuum release binary (vacuum_<version>_<os>_<arch>.tar.gz). -->
365-
<profiles>
366-
<profile>
367-
<id>vacuum-macos-aarch64</id>
368-
<activation>
369-
<os>
370-
<family>mac</family>
371-
<arch>aarch64</arch>
372-
</os>
373-
</activation>
374-
<properties>
375-
<vacuum.os>darwin</vacuum.os>
376-
<vacuum.arch>arm64</vacuum.arch>
377-
</properties>
378-
</profile>
379-
<profile>
380-
<id>vacuum-macos-x86_64</id>
381-
<activation>
382-
<os>
383-
<family>mac</family>
384-
<arch>x86_64</arch>
385-
</os>
386-
</activation>
387-
<properties>
388-
<vacuum.os>darwin</vacuum.os>
389-
<vacuum.arch>x86_64</vacuum.arch>
390-
</properties>
391-
</profile>
392-
<profile>
393-
<id>vacuum-linux-amd64</id>
394-
<activation>
395-
<os>
396-
<name>Linux</name>
397-
<arch>amd64</arch>
398-
</os>
399-
</activation>
400-
<properties>
401-
<vacuum.os>linux</vacuum.os>
402-
<vacuum.arch>x86_64</vacuum.arch>
403-
</properties>
404-
</profile>
405-
<profile>
406-
<id>vacuum-linux-aarch64</id>
407-
<activation>
408-
<os>
409-
<name>Linux</name>
410-
<arch>aarch64</arch>
411-
</os>
412-
</activation>
413-
<properties>
414-
<vacuum.os>linux</vacuum.os>
415-
<vacuum.arch>arm64</vacuum.arch>
416-
</properties>
417-
</profile>
418-
<profile>
419-
<id>vacuum-windows-amd64</id>
420-
<activation>
421-
<os>
422-
<family>windows</family>
423-
<arch>amd64</arch>
424-
</os>
425-
</activation>
426-
<properties>
427-
<vacuum.os>windows</vacuum.os>
428-
<vacuum.arch>x86_64</vacuum.arch>
429-
<vacuum.binary.extension>.exe</vacuum.binary.extension>
430-
</properties>
431-
</profile>
432-
<profile>
433-
<id>vacuum-windows-aarch64</id>
434-
<activation>
435-
<os>
436-
<family>windows</family>
437-
<arch>aarch64</arch>
438-
</os>
439-
</activation>
440-
<properties>
441-
<vacuum.os>windows</vacuum.os>
442-
<vacuum.arch>arm64</vacuum.arch>
443-
<vacuum.binary.extension>.exe</vacuum.binary.extension>
444-
</properties>
445-
</profile>
446-
</profiles>
447314

448315
</project>

0 commit comments

Comments
 (0)