Repository navigation
137 lines (109 loc) · 4.64 KB
/
Copy pathtest.yml
File metadata and controls
137 lines (109 loc) · 4.64 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
# The test suite, factored out so two callers can share one definition: `ci.yml`
# on every push and PR, and `release.yml` as the gate a tag has to pass before
# any binary is built. A release that shipped without these having run would be
# a release nobody checked.
name: Test
on:
workflow_call:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-D warnings"
jobs:
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Build
run: cargo build --workspace --all-targets
- name: Test
run: cargo test --workspace
# The corpus is generated, not hand-committed: if the generator and the
# committed binaries ever disagree, the goldens are testing fiction.
- name: Corpus is up to date
run: python3 corpus/generate.py --check
# CI gate 1 of Phase 15 (`docs/technical-analysis-presentations.md` §5.5): the
# `.pptx` parts this project writes, validated against the ECMA-376 XSDs
# vendored in `schemas/`. Ubuntu only, and once: the gate measures the bytes
# the writer produces, which are the same on all three platforms, and running
# it three times would only buy three copies of the same answer.
schema-gate:
name: pptx schema validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# libxml2's validator. Not a workspace dependency and deliberately not one:
# it never reaches a shipped binary (`AGENTS.md` §7 rule 4).
- name: Install xmllint
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
- name: Build the CLI
run: cargo build -p docsai-cli
- name: Schema gate
run: python3 corpus/schema_gate.py
# CI gate 2 of Phase 15: what a corpus deck *looks like*, before and after the
# round trip. Headless LibreOffice renders each package to PDF, `pdftoppm`
# rasterises every page, and a low-frequency perceptual diff scores the pairs.
# Ubuntu only and once, for the same reason as the schema gate: the bytes the
# writer produces are the same on all three platforms.
#
# `--require-renderer` is the point of this job. A missing LibreOffice is a
# *skip* on a developer's machine — a clean message and exit 3, never a green
# tick — but here it is a **failure**: this runner installs LibreOffice
# deliberately, so «no renderer» means the install step broke, not that the
# gate is inapplicable. A CI job that silently measured nothing is exactly the
# failure this gate was written against.
render-gate:
name: pptx render diff
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Neither is a workspace dependency, and neither reaches a shipped binary
# (`AGENTS.md` §7 rule 4). `--no-install-recommends` keeps the LibreOffice
# install to the Impress filters and the fonts they need.
- name: Install LibreOffice and poppler
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libreoffice-impress poppler-utils fonts-liberation
- name: Build the CLI
run: cargo build -p docsai-cli
# The comparator itself, on synthetic pairs whose answer is known. It
# needs no LibreOffice, so it measures something even on a machine where
# the renderer is unavailable, and it is what pins the threshold.
- name: Comparator self-test
run: python3 corpus/render_gate.py --self-test
- name: Render gate
run: python3 corpus/render_gate.py --require-renderer
lint:
name: fmt + clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
# Named separately from `cargo test` so a blown token budget reads as a
# blown token budget in the checks list, not as "some test failed".
- name: Token budget
run: cargo test -p docsai-convert --test token_budget
- name: Docs
run: cargo doc --workspace --no-deps
env:
RUSTDOCFLAGS: "-D warnings"