Skip to content

Commit 267a550

Browse files
authored
Build and test against CUPS 2.4, 2.5 and 3.x across 4 architectures (#76)
* Build against CUPS 2.4, 2.5 and 3.x; add 12-combination CI matrix * Fix C++ utility builds and .pc Cflags for source-installed CUPS (2.5/3.x) * Support libcups3 cups_bool_t and default texttopdf charset dir for source CUPS * Skip run-time locale-switching testppd cases on libcups3; CI native-only for now * Rename ppd_bool_t alias and check CUPS_DATADIR env var in fontpath fallback
1 parent 18e509a commit 267a550

11 files changed

Lines changed: 370 additions & 178 deletions

File tree

.github/workflows/build.yml

Lines changed: 71 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,18 @@
11
# =============================================================================
2-
# Multi-Architecture Build & Test Workflow for libppd
2+
# Multi-Architecture / multi-CUPS Build & Test Workflow for libppd
33
#
4-
# Modelled on the QEMU-based CI used in the sister OpenPrinting repositories
5-
# (libcupsfilters, cups-filters). Proves on every push / PR / manual dispatch
6-
# that libppd compiles end-to-end (libppd.la + every check_PROGRAMS binary)
7-
# and that every registered TEST in Makefile.am passes under
8-
# `make check V=1 VERBOSE=1` on FOUR architectures:
4+
# Matrix: 4 architectures x 3 CUPS releases = 12 combinations.
5+
# architectures: amd64, arm64 (native runners); armhf, riscv64 (QEMU)
6+
# CUPS releases: 2.4.x (distro libcups2-dev), 2.5.x (OpenPrinting/cups
7+
# master), 3.x (OpenPrinting/libcups master)
98
#
10-
# * amd64 - native, ubuntu-latest
11-
# * arm64 - native, ubuntu-24.04-arm
12-
# * armhf - emulated via QEMU (armv7)
13-
# * riscv64 - emulated via QEMU
14-
#
15-
# The hermetic C unit tests exercised: testppd, test_ppd_localize,
16-
# test_ppd_cache, test_ppd_ipp, test_ppd_mark, test_ppd_custom,
17-
# test_ppd_attr, test_ppd_page, test_ppd_conflicts.
18-
#
19-
# apt package list derived from libppd's configure.ac:
20-
# PKG_CHECK_MODULES([LIBCUPSFILTERS]) -> libcupsfilters-dev
21-
# PKG_CHECK_MODULES([ZLIB]) -> zlib1g-dev
22-
# AC_PATH_TOOL(CUPSCONFIG) -> libcups2-dev
23-
# AC_CHECK_PROG(gs / pdftops / mutool) -> ghostscript, poppler-utils,
24-
# mupdf-tools
25-
# AM_GNU_GETTEXT([external]) -> gettext, autopoint
26-
# AC_PROG_CC / CXX / LT_INIT / pkg-config -> build-essential, autoconf,
27-
# automake, libtool,
28-
# libtool-bin, pkg-config
29-
# transitive (poppler / qpdf renderers) -> libqpdf-dev, libpoppler-dev,
30-
# libpoppler-cpp-dev
9+
# libppd depends on BOTH libcups and libcupsfilters. For the source-CUPS legs
10+
# the distro libcupsfilters-dev is the wrong ABI, so ci/ci-setup.sh builds
11+
# libcupsfilters (and pdfio) from source against the active CUPS. All the
12+
# per-combination work lives in that script so the legs differ only in which
13+
# CUPS is provided and whether they run under emulation.
3114
# =============================================================================
32-
33-
name: Build and Test (libppd, multi-arch)
15+
name: Build and Test (libppd, Multi-Architecture, Multi-CUPS)
3416

3517
on:
3618
push:
@@ -41,14 +23,22 @@ on:
4123
- '**'
4224
workflow_dispatch:
4325

26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
29+
4430
jobs:
45-
build:
46-
name: Build & Test (${{ matrix.arch }})
31+
build-matrix:
32+
name: Build & Test (${{ matrix.arch }}, ${{ matrix.cups }})
4733
runs-on: ${{ matrix.runs-on }}
34+
# Building CUPS / libcupsfilters from source under QEMU is slow; allow plenty.
35+
timeout-minutes: 360
4836

4937
strategy:
5038
fail-fast: false
5139
matrix:
40+
arch: [amd64, arm64, armhf, riscv64]
41+
cups: [system-2x, source-2.5.x, source-3.x]
5242
include:
5343
- arch: amd64
5444
runs-on: ubuntu-latest
@@ -66,156 +56,80 @@ jobs:
6656
qemu-arch: riscv64
6757

6858
steps:
69-
- name: Checkout repository
70-
uses: actions/checkout@v4
71-
72-
- name: Save workspace directory
73-
run: echo "REPO_DIR=$(pwd)" >> $GITHUB_ENV
74-
75-
# -----------------------------------------------------------------------
76-
# NATIVE LEG (amd64 on ubuntu-latest, arm64 on ubuntu-24.04-arm)
77-
# -----------------------------------------------------------------------
78-
- name: Install dependencies (native)
79-
if: matrix.use-qemu == false
80-
run: |
81-
set -ex
82-
sudo apt-get clean
83-
sudo apt-get update --fix-missing -y -o Acquire::Retries=3
84-
# Drop any pre-shipped libppd-dev so our local build wins
85-
sudo apt-get remove -y libppd-dev || true
86-
sudo apt-get install -y --no-install-recommends \
87-
build-essential \
88-
autoconf \
89-
automake \
90-
autopoint \
91-
libtool \
92-
libtool-bin \
93-
pkg-config \
94-
gettext \
95-
git \
96-
wget \
97-
tar \
98-
libcups2-dev \
99-
libcupsfilters-dev \
100-
libqpdf-dev \
101-
libpoppler-dev \
102-
libpoppler-cpp-dev \
103-
zlib1g-dev \
104-
ghostscript \
105-
poppler-utils \
106-
mupdf-tools \
107-
file
59+
- uses: actions/checkout@v4
10860

109-
- name: Build & test libppd (native)
61+
# ==========================================
62+
# NATIVE EXECUTION (amd64 and arm64)
63+
# ==========================================
64+
- name: Build & Test (Native)
11065
if: matrix.use-qemu == false
66+
env:
67+
CUPS_KIND: ${{ matrix.cups }}
68+
EMULATED: "0"
11169
run: |
11270
set -ex
113-
cd "$REPO_DIR"
114-
./autogen.sh
115-
# --enable-ppdc-utils: the downstream libppd-2-dev autopkgtest needs
116-
# the staged `ppdc` to compile its test.drv into a PPD.
117-
./configure --enable-ppdc-utils
118-
make -j$(nproc) V=1
119-
make check V=1 VERBOSE=1 || {
120-
echo "==== test-suite.log ===="
121-
test -f test-suite.log && cat test-suite.log
122-
echo "==== per-test logs ===="
123-
for f in $(find . -name '*.log' -not -name 'config.log'); do
124-
echo "---- $f ----"; cat "$f"
125-
done
126-
exit 1
127-
}
71+
sh ci/ci-setup.sh deps
72+
sh ci/ci-setup.sh cups "${{ matrix.cups }}"
73+
sh ci/ci-setup.sh pdfio
74+
sh ci/ci-setup.sh libcupsfilters "${{ matrix.cups }}"
75+
sh ci/ci-setup.sh build-libppd
12876
12977
- name: Autopkgtest (DESTDIR staging, native)
78+
# Run the downstream autopkgtest suite (libppd-2-dev compile/link/run +
79+
# libppd-2-ppd-handling) against every CUPS version under test.
13080
if: matrix.use-qemu == false
13181
run: |
13282
set -ex
133-
cd "$REPO_DIR"
134-
# Full downstream suite: libppd-2-dev (compile/link/run) +
135-
# libppd-2-ppd-handling. Both point at the staged tree via
136-
# environment overrides, so no privilege or path redirection is
137-
# needed.
13883
make test-autopkgtest V=1
13984
140-
# -----------------------------------------------------------------------
141-
# EMULATED LEG (armhf via QEMU armv7, riscv64 via QEMU)
142-
# -----------------------------------------------------------------------
143-
- name: Set up QEMU
144-
if: matrix.use-qemu == true
145-
uses: docker/setup-qemu-action@v3
85+
- name: Upload test artifacts (Native)
86+
if: matrix.use-qemu == false && always()
87+
continue-on-error: true
88+
timeout-minutes: 5
89+
uses: actions/upload-artifact@v4
14690
with:
147-
platforms: ${{ matrix.qemu-arch }}
91+
name: libppd-logs-${{ matrix.arch }}-${{ matrix.cups }}
92+
path: |
93+
config.log
94+
test-suite.log
95+
ppd/*.log
96+
ppd/*.trs
97+
if-no-files-found: ignore
14898

149-
- name: Build & test libppd (emulated)
99+
# ==========================================
100+
# EMULATED EXECUTION (armhf and riscv64)
101+
# ==========================================
102+
- name: Build & Test (Emulated)
150103
if: matrix.use-qemu == true
151104
uses: uraimo/run-on-arch-action@v3
152105
with:
153106
arch: ${{ matrix.qemu-arch }}
154107
distro: ubuntu24.04
155-
dockerRunArgs: |
156-
--volume "${{ github.workspace }}:/workspace"
108+
githubToken: ${{ github.token }}
157109
install: |
158-
apt-get clean
159-
apt-get update --fix-missing -y -o Acquire::Retries=3
160-
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
161-
apt-get remove -y libppd-dev 2>/dev/null || true
162-
apt-get install -y --no-install-recommends \
163-
build-essential \
164-
gcc g++ \
165-
autoconf \
166-
automake \
167-
autopoint \
168-
libtool \
169-
libtool-bin \
170-
pkg-config \
171-
gettext \
172-
git \
173-
wget \
174-
tar \
175-
libcups2-dev \
176-
libcupsfilters-dev \
177-
libqpdf-dev \
178-
libpoppler-dev \
179-
libpoppler-cpp-dev \
180-
zlib1g-dev \
181-
ghostscript \
182-
poppler-utils \
183-
mupdf-tools \
184-
file
110+
apt-get update --fix-missing -y
111+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata ca-certificates git
185112
run: |
186113
set -ex
187-
cd /workspace
188-
./autogen.sh
189-
# --enable-ppdc-utils: needed by the libppd-2-dev autopkgtest.
190-
./configure --enable-ppdc-utils
191-
make -j$(nproc) V=1
192-
make check V=1 VERBOSE=1 || {
193-
echo "==== test-suite.log ===="
194-
test -f test-suite.log && cat test-suite.log
195-
echo "==== per-test logs ===="
196-
for f in $(find . -name '*.log' -not -name 'config.log'); do
197-
echo "---- $f ----"; cat "$f"
198-
done
199-
exit 1
200-
}
201-
202-
# Full downstream autopkgtest suite. Both tests resolve the
203-
# staged build tree through environment overrides (no absolute
204-
# paths, no privilege, no bind mounts), so the same suite that
205-
# runs on the native legs runs unchanged under QEMU emulation.
114+
export CUPS_KIND="${{ matrix.cups }}"
115+
export EMULATED=1
116+
sh ci/ci-setup.sh deps
117+
sh ci/ci-setup.sh cups "${{ matrix.cups }}"
118+
sh ci/ci-setup.sh pdfio
119+
sh ci/ci-setup.sh libcupsfilters "${{ matrix.cups }}"
120+
sh ci/ci-setup.sh build-libppd
206121
make test-autopkgtest V=1
207122
208-
# -----------------------------------------------------------------------
209-
# ARTIFACT UPLOAD (all four legs, only on failure)
210-
# -----------------------------------------------------------------------
211-
- name: Upload test logs on failure
212-
if: failure()
123+
- name: Upload test artifacts (Emulated)
124+
if: matrix.use-qemu == true && always()
125+
continue-on-error: true
126+
timeout-minutes: 5
213127
uses: actions/upload-artifact@v4
214128
with:
215-
name: libppd-test-logs-${{ matrix.arch }}
129+
name: libppd-logs-${{ matrix.arch }}-${{ matrix.cups }}
216130
path: |
131+
config.log
217132
test-suite.log
218-
**/*.log
219-
**/*.trs
220-
if-no-files-found: warn
221-
retention-days: 14
133+
ppd/*.log
134+
ppd/*.trs
135+
if-no-files-found: ignore

Makefile.am

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,53 +315,63 @@ genstrings_SOURCES = \
315315
genstrings_LDADD = \
316316
libppd.la \
317317
$(CUPS_LIBS)
318-
genstrings_CFLAGS = \
318+
# These utilities are built from C++ (.cxx) sources, so their per-target
319+
# compiler flags must be *_CXXFLAGS - Automake ignores *_CFLAGS for C++.
320+
# Without this the CUPS include path is dropped, which only fails for a
321+
# source-installed CUPS whose headers are not in the default search path.
322+
genstrings_CXXFLAGS = \
319323
-I$(srcdir)/ppd/ \
324+
$(LIBCUPSFILTERS_CFLAGS) \
320325
$(CUPS_CFLAGS)
321326

322327
ppdc_SOURCES = \
323328
ppd/ppdc.cxx
324329
ppdc_LDADD = \
325330
libppd.la \
326331
$(CUPS_LIBS)
327-
ppdc_CFLAGS = \
332+
ppdc_CXXFLAGS = \
328333
-I$(srcdir)/ppd/ \
334+
$(LIBCUPSFILTERS_CFLAGS) \
329335
$(CUPS_CFLAGS)
330336

331337
ppdhtml_SOURCES = \
332338
ppd/ppdhtml.cxx
333339
ppdhtml_LDADD = \
334340
libppd.la \
335341
$(CUPS_LIBS)
336-
ppdhtml_CFLAGS = \
342+
ppdhtml_CXXFLAGS = \
337343
-I$(srcdir)/ppd/ \
344+
$(LIBCUPSFILTERS_CFLAGS) \
338345
$(CUPS_CFLAGS)
339346

340347
ppdi_SOURCES = \
341348
ppd/ppdi.cxx
342349
ppdi_LDADD = \
343350
libppd.la \
344351
$(CUPS_LIBS)
345-
ppdi_CFLAGS = \
352+
ppdi_CXXFLAGS = \
346353
-I$(srcdir)/ppd/ \
354+
$(LIBCUPSFILTERS_CFLAGS) \
347355
$(CUPS_CFLAGS)
348356

349357
ppdmerge_SOURCES = \
350358
ppd/ppdmerge.cxx
351359
ppdmerge_LDADD = \
352360
libppd.la \
353361
$(CUPS_LIBS)
354-
ppdmerge_CFLAGS = \
362+
ppdmerge_CXXFLAGS = \
355363
-I$(srcdir)/ppd/ \
364+
$(LIBCUPSFILTERS_CFLAGS) \
356365
$(CUPS_CFLAGS)
357366

358367
ppdpo_SOURCES = \
359368
ppd/ppdpo.cxx
360369
ppdpo_LDADD = \
361370
libppd.la \
362371
$(CUPS_LIBS)
363-
ppdpo_CFLAGS = \
372+
ppdpo_CXXFLAGS = \
364373
-I$(srcdir)/ppd/ \
374+
$(LIBCUPSFILTERS_CFLAGS) \
365375
$(CUPS_CFLAGS)
366376

367377
distclean-local:
@@ -416,6 +426,16 @@ install-test-data:
416426
echo " STAGE $$f -> $(CIROOT)$(datadir)/ppd/testppd/"; \
417427
$(INSTALL_DATA) "$(srcdir)/$$f" "$(CIROOT)$(datadir)/ppd/testppd/" || exit 1; \
418428
done
429+
@# The libppd-2-dev test exercises the text -> PDF path, whose texttopdf
430+
@# filter (from libcupsfilters) reads charsets/pdf.<charset> from the CUPS
431+
@# data directory. The wrapper points CUPS_DATADIR at the staging tree, so
432+
@# seed the charset data (installed by libcupsfilters into the real
433+
@# $(CUPS_DATADIR)/charsets) into the staged tree.
434+
@if [ -d "$(CUPS_DATADIR)/charsets" ]; then \
435+
echo " STAGE $(CUPS_DATADIR)/charsets -> $(CIROOT)$(datadir)/charsets/"; \
436+
$(MKDIR_P) "$(CIROOT)$(datadir)/charsets"; \
437+
cp -a "$(CUPS_DATADIR)/charsets/." "$(CIROOT)$(datadir)/charsets/" || exit 1; \
438+
fi
419439

420440
# Build everything, DESTDIR-install it, top up the test-only programs/data,
421441
# then rewrite the staged libppd.pc prefix so a downstream consumer resolves

0 commit comments

Comments
 (0)