Skip to content

Commit c040517

Browse files
authored
ci: Implement multi-architecture build and test workflow (#135)
1 parent 1862663 commit c040517

1 file changed

Lines changed: 138 additions & 49 deletions

File tree

.github/workflows/build.yaml

Lines changed: 138 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,150 @@
1-
name: Build and Test
1+
# Multi-Architecture Build and Test Workflow for libcupsfilters
2+
name: Build and Test (Multi-Architecture)
23

34
on:
45
push:
56
branches:
6-
- '**'
7+
- '**'
78
pull_request:
89
branches:
9-
- '**'
10+
- '**'
1011
workflow_dispatch:
1112

1213
jobs:
13-
build-linux-run-tests:
14+
build-matrix:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
# Native x86_64
20+
- arch: x86_64
21+
runs-on: ubuntu-latest
22+
use-qemu: false
1423

15-
runs-on: ubuntu-latest
24+
# Native ARM64
25+
- arch: arm64
26+
runs-on: ubuntu-24.04-arm
27+
use-qemu: false
28+
29+
# Emulated 32-bit ARM
30+
- arch: armv7
31+
runs-on: ubuntu-latest
32+
use-qemu: true
33+
34+
# Emulated RISC-V
35+
- arch: riscv64
36+
runs-on: ubuntu-latest
37+
use-qemu: true
38+
39+
runs-on: ${{ matrix.runs-on }}
40+
name: Build & Test (${{ matrix.arch }})
1641

1742
steps:
18-
- uses: actions/checkout@v4
19-
- name: show Ubuntu version
20-
run: cat /etc/os-release | grep PRETTY_NAME | awk -F '=' '{print $2}'
21-
- name: update build environment
22-
run: sudo apt-get update --fix-missing -y && sudo apt-get upgrade --fix-missing -y
23-
- name: install prerequisites
24-
run: |
25-
sudo apt-get install -y avahi-daemon libavahi-client-dev libssl-dev libpam-dev libusb-1.0-0-dev zlib1g-dev
26-
sudo apt install autotools-dev autopoint cmake libtool pkg-config libcups2-dev libexif-dev liblcms2-dev libfontconfig1-dev
27-
sudo apt install libfreetype6-dev build-essential qtbase5-dev qtchooser libcairo2-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev libopenjp2-7-dev liblcms2-dev libjpeg-dev
28-
sudo apt install -y libjxl-dev
29-
30-
# UPDATED: Using PDFio 1.6.2
31-
- name: Install pdfio >= 1.6.2
32-
run: |
33-
cd ..
34-
mkdir -p pdfio
35-
cd pdfio
36-
wget -q https://github.com/michaelrsweet/pdfio/releases/download/v1.6.2/pdfio-1.6.2.tar.gz
37-
tar -xzf pdfio-1.6.2.tar.gz
38-
cd pdfio-1.6.2
39-
./configure --prefix=/usr --enable-shared
40-
make all
41-
make test
42-
sudo make install
43-
cd "$GITHUB_WORKSPACE"
44-
45-
- name: Install poppler and mupdf
46-
run: |
47-
sudo apt install libpoppler-cpp-dev libpython3-dev libdbus-1-dev
48-
sudo apt install mupdf-tools
49-
sudo apt install -y poppler-utils
50-
51-
- name: Install ghostscript
52-
run: sudo apt install ghostscript
53-
54-
- name: configure
55-
env:
56-
CC: /usr/bin/gcc
57-
run: ./autogen.sh && ./configure --enable-debug
58-
- name: make
59-
run: make
60-
- name: Run Tests
61-
run: make check || cat test/error_log*
43+
- uses: actions/checkout@v4
44+
45+
# ==========================================
46+
# 1. NATIVE EXECUTION (x86_64 and arm64)
47+
# ==========================================
48+
- name: Install Dependencies (Native)
49+
if: matrix.use-qemu == false
50+
run: |
51+
sudo apt-get update --fix-missing -y
52+
sudo apt-get upgrade --fix-missing -y
53+
# PREVENT CONFLICTS: Ensure system version doesn't override local source
54+
sudo apt-get remove -y libcupsfilters-dev || true
55+
sudo apt-get install -y \
56+
libqpdf-dev \
57+
avahi-daemon libavahi-client-dev libssl-dev libpam-dev libusb-1.0-0-dev zlib1g-dev \
58+
autotools-dev autopoint cmake libtool pkg-config libcups2-dev libexif-dev liblcms2-dev \
59+
libfontconfig1-dev libfreetype6-dev build-essential qtbase5-dev qtchooser libcairo2-dev \
60+
libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev \
61+
libopenjp2-7-dev libjpeg-dev libjxl-dev libpoppler-cpp-dev libpython3-dev libdbus-1-dev \
62+
mupdf-tools poppler-utils ghostscript wget tar make gettext
63+
64+
- name: Build PDFio and libcupsfilters (Native)
65+
if: matrix.use-qemu == false
66+
env:
67+
CC: /usr/bin/gcc
68+
run: |
69+
set -ex
70+
71+
# Build pdfio
72+
cd /tmp
73+
wget -q https://github.com/michaelrsweet/pdfio/releases/download/v1.6.2/pdfio-1.6.2.tar.gz
74+
tar -xzf pdfio-1.6.2.tar.gz && cd pdfio-1.6.2
75+
./configure --prefix=/usr --enable-shared
76+
make all
77+
sudo make install
78+
sudo ldconfig
79+
80+
# Build and Test libcupsfilters
81+
cd "$GITHUB_WORKSPACE"
82+
./autogen.sh
83+
./configure
84+
make -j$(nproc)
85+
# V=1 shows compiler commands; VERBOSE=1 restores full internal test details
86+
make check V=1 VERBOSE=1 || (test -f test-suite.log && cat test-suite.log; exit 1)
87+
88+
- name: Upload test artifacts (Native)
89+
if: matrix.use-qemu == false && always()
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: libcupsfilters-test-artifacts-${{ matrix.arch }}
93+
path: |
94+
**/*.log
95+
if-no-files-found: warn
96+
97+
# ==========================================
98+
# 2. EMULATED EXECUTION (armv7 and riscv64)
99+
# ==========================================
100+
- name: Build and Test (Emulated)
101+
if: matrix.use-qemu == true
102+
uses: uraimo/run-on-arch-action@v3
103+
with:
104+
arch: ${{ matrix.arch }}
105+
distro: ubuntu24.04
106+
install: |
107+
apt-get update --fix-missing -y
108+
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
109+
# PREVENT CONFLICTS: Ensure system version doesn't override local source
110+
apt-get remove -y libcupsfilters-dev || true
111+
apt-get install -y \
112+
libqpdf-dev \
113+
avahi-daemon libavahi-client-dev libssl-dev libpam-dev libusb-1.0-0-dev zlib1g-dev \
114+
autotools-dev autopoint cmake libtool pkg-config libcups2-dev libexif-dev liblcms2-dev \
115+
libfontconfig1-dev libfreetype6-dev build-essential qtbase5-dev qtchooser libcairo2-dev \
116+
libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-test-dev \
117+
libopenjp2-7-dev libjpeg-dev libjxl-dev libpoppler-cpp-dev libpython3-dev libdbus-1-dev \
118+
mupdf-tools poppler-utils ghostscript wget tar make gettext gcc g++
119+
run: |
120+
set -ex
121+
REPO_DIR=$(pwd)
122+
123+
# Build pdfio
124+
cd /tmp
125+
wget -q https://github.com/michaelrsweet/pdfio/releases/download/v1.6.2/pdfio-1.6.2.tar.gz
126+
tar -xzf pdfio-1.6.2.tar.gz && cd pdfio-1.6.2
127+
./configure --prefix=/usr --enable-shared
128+
make all
129+
make install
130+
ldconfig
131+
132+
# Build and Test libcupsfilters
133+
cd $REPO_DIR
134+
export CC=/usr/bin/gcc
135+
./autogen.sh
136+
./configure
137+
make -j$(nproc)
138+
139+
# Mark test-pclm-overflow.sh as XFAIL; VERBOSE=1 for full internal logs
140+
make check V=1 VERBOSE=1 XFAIL_TESTS="cupsfilters/test-pclm-overflow.sh" || (test -f test-suite.log && cat test-suite.log; exit 1)
141+
142+
- name: Upload test artifacts (Emulated)
143+
if: matrix.use-qemu == true && always()
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: libcupsfilters-test-artifacts-${{ matrix.arch }}
147+
path: |
148+
**/*.log
149+
if-no-files-found: warn
150+

0 commit comments

Comments
 (0)