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
name: CI
on:
push:
branches:
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# The vendored libcurl/OpenSSL build (see the `curl` dependency in Cargo.toml)
# dominates a cold build, so a warm cache is the difference between a two
# minute job and a twenty minute one.
CARGO_INCREMENTAL: 0
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all --check
# The feature matrix is the point of this job. PaperBoy builds in four shapes
# and each one has to stay both compiling *and* warning-free on its own:
#
# headless -- no front-end at all; the shape used in CI images and Docker
# tui -- the default, and what `cargo install paperboy` gives you
# gui -- tui + gui, what `--features gui` gives you
# gui-only -- the GUI without the terminal UI
#
# Without this job the non-default shapes rot silently: `gui-only` did not
# compile at all until the front-ends were split apart, because nothing ever
# built it. `-D warnings` is deliberate — the dead-code suppression in
# `main.rs` is keyed on the `tui` feature, and this is what proves the two
# front-end-complete configurations are still carrying full analysis.
check:
name: check (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: headless
features: --no-default-features
- name: tui
features: ""
- name: gui
features: --features gui
- name: gui-only
features: --no-default-features --features gui
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.name }}
# eframe pulls in winit, which needs the X11/Wayland and xkbcommon headers
# at build time. The terminal and headless shapes need none of this, which
# is a large part of why the GUI is opt-in in the first place.
- name: Install GUI build dependencies
if: contains(matrix.features, 'gui')
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev \
libxrandr-dev libxi-dev libgl1-mesa-dev
- run: cargo check ${{ matrix.features }} --all-targets
env:
RUSTFLAGS: -D warnings
# Every shape that is built is also tested. The GUI configurations were
# originally check-only, which left their 432 `gui::*` tests compiled but
# never run — a shape CI proves builds and nothing more. They need no display
# to run, so there was nothing bought by leaving them out.
#
# None of the four is redundant: headless is the only one proving the core
# passes with no front-end linked in (what a CI-image user installs), and
# gui-only is the only one proving the GUI stands on its own.
test:
name: test (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: headless
features: --no-default-features
- name: tui
features: ""
- name: gui
features: --features gui
- name: gui-only
features: --no-default-features --features gui
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: test-${{ matrix.name }}
- name: Install GUI build dependencies
if: contains(matrix.features, 'gui')
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libxkbcommon-dev libwayland-dev libx11-dev libxcursor-dev \
libxrandr-dev libxi-dev libgl1-mesa-dev
# `paperboy` is a binary crate with no lib target, so the unit tests are
# compiled into `src/main.rs` and plain `cargo test` is the only form that
# works (`--lib` fails outright).
- run: cargo test ${{ matrix.features }}
# Everything above runs on Linux, which for a long time meant the two
# platforms a user is most likely to *download* were never compiled at all --
# "PaperBoy runs on Windows" was a claim resting on nothing, and the first
# person to test it did so by hand, one missing dependency at a time.
#
# Only the `gui` shape is built here. It is a strict superset: the same binary
# serves `-c`, the terminal UI and `--gui`, so it is both the widest compile
# and exactly what a release artifact will be. A second shape would double a
# slow job to prove something the Linux matrix already proves.
#
# Neither runner can build this out of the box, and what each is missing is
# not the same:
platform:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: windows
os: windows-latest
- name: macos
os: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
# On MSVC, `libxml` asks vcpkg and nothing else. The image ships a vcpkg
# tree already, so this installs the port rather than bootstrapping one --
# and `VCPKG_ROOT` is exported because that, not `PATH`, is how vcpkg-rs
# finds the tree. The triplet must be the `-static-md` one Rust's MSVC
# target wants; the plain `x64-windows` port installs fine and then reads
# as missing.
- name: Install libxml2 (vcpkg)
if: runner.os == 'Windows'
run: |
& "$env:VCPKG_INSTALLATION_ROOT\vcpkg" install libxml2:x64-windows-static-md
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" >> $env:GITHUB_ENV
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $env:GITHUB_ENV
# OpenSSL assembles its Windows primitives with NASM, which is the one
# prerequisite the image does not carry (it has Perl, LLVM and MSVC). Its
# installer does not extend PATH either, hence the second line.
- name: Install NASM
if: runner.os == 'Windows'
run: |
choco install nasm -y --no-progress
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
# hurl 8.0.1's build script embeds a Windows icon from
# `../../bin/windows/logo.ico`, a path relative to hurl's own git
# checkout. The crates.io package ships nothing outside its own
# directory, so on Windows `rc.exe` fails with RC2135 and the build
# script panics -- hurl as a library simply cannot be built on Windows
# from crates.io. Upstream fixed it by guarding the path
# (Orange-OpenSource/hurl#5207, merged 2026-09-14) but has not released
# it; 8.0.1 is still the newest crate.
#
# rc.exe resolves that relative path from the build script's working
# directory, which Cargo sets to the package root -- so `../../` lands in
# `registry/src`, and putting a file there is enough to satisfy it. We
# supply *our own* icon rather than fetching hurl's: the resource is
# linked into the final executable, so hurl's logo would otherwise become
# paperboy.exe's icon. Remove this once hurl 8.1.0 is out.
- name: Work around hurl's unreachable Windows icon (hurl#5207)
if: runner.os == 'Windows'
run: |
$cargoHome = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { Join-Path $env:USERPROFILE ".cargo" }
$dir = Join-Path $cargoHome "registry\src\bin\windows"
New-Item -ItemType Directory -Force -Path $dir | Out-Null
Copy-Item "assets\windows\paperboy.ico" (Join-Path $dir "logo.ico") -Force
# macOS bundles libxml2 in the dyld shared cache on every install, and the
# SDK ships its headers and a linker stub -- but no pkg-config file, so
# `libxml`'s pkg-config probe cannot find the one copy that is guaranteed
# to be present. Synthesising the `.pc` is what makes that copy usable:
# the binary then links `/usr/lib/libxml2.2.dylib`, a path every Mac has,
# and the archive needs nothing installed. `xcrun` keeps this correct as
# the SDK moves between Xcode releases.
#
# The previous approach -- Homebrew's keg-only libxml2 plus
# `LIBXML2_STATIC` -- was a no-op, and silently so. Homebrew's bottle
# ships no `libxml2.a` at all, and pkg-config-rs only emits `static=`
# when it can see one in the `-L` directory; finding none it falls back
# to an ordinary dynamic link without warning. The build then succeeds
# having baked in an `/opt/homebrew` path that exists on this runner and
# on no user's Mac, which is exactly what 0.7.0's first attempt shipped.
# Supplying an `.a` would not have rescued it either: Apple's linker has
# no `-Bstatic`, so `-lxml2` against a directory holding both files picks
# the dylib regardless, and forcing the archive means linking it by
# absolute path.
#
# Kept identical to release.yml's step on purpose: if they drift, this job
# proves one linking arrangement works and the release ships another.
- name: Point pkg-config at the macOS SDK's libxml2
if: runner.os == 'macOS'
run: |
set -euo pipefail
# `pkg-config` is a build tool here, not a link dependency: installing
# it from Homebrew has no bearing on what the binary ends up linking.
command -v pkg-config >/dev/null || brew install pkg-config
sdk="$(xcrun --show-sdk-path)"
header="$sdk/usr/include/libxml2/libxml/xmlversion.h"
version="$(awk -F'"' '/define LIBXML_DOTTED_VERSION/ {print $2}' "$header")"
if [ -z "$version" ]; then
echo "::error::no LIBXML_DOTTED_VERSION in $header"
exit 1
fi
echo "using the SDK's libxml2 $version from $sdk"
mkdir -p "$RUNNER_TEMP/pkgconfig"
cat > "$RUNNER_TEMP/pkgconfig/libxml-2.0.pc" <<PC
Name: libxml2
Description: libxml2 from the macOS SDK
Version: $version
Libs: -lxml2
Cflags: -I$sdk/usr/include/libxml2
PC
echo "PKG_CONFIG_PATH=$RUNNER_TEMP/pkgconfig" >> "$GITHUB_ENV"
# `-D warnings` matches the Linux matrix. Platform-gated code (clipboard
# and terminal handling differ per OS) has never been under it before, so
# this is the job that will say so.
- run: cargo test --features gui
env:
RUSTFLAGS: -D warnings