Skip to content

ci: implement robust multi-architecture build and test workflow #5

ci: implement robust multi-architecture build and test workflow

ci: implement robust multi-architecture build and test workflow #5

Workflow file for this run

name: Multi-Architecture CI Build & Test
on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]
workflow_dispatch:
jobs:
build:
name: Build & Test (${{ matrix.arch }})
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runs-on: ubuntu-latest
use-qemu: false
- arch: arm64
runs-on: ubuntu-24.04-arm
use-qemu: false
- arch: armv7
runs-on: ubuntu-latest
use-qemu: true
qemu-arch: armv7
- arch: riscv64
runs-on: ubuntu-latest
use-qemu: true
qemu-arch: riscv64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Save workspace directory
run: |
echo "REPO_DIR=$(pwd)" >> $GITHUB_ENV
# ========================================================================
# NATIVE BUILD (x86_64 and arm64)
# ========================================================================
- name: Install build dependencies (native)
if: matrix.use-qemu == false
run: |
sudo apt-get update
# Remove conflicting system packages
sudo apt-get remove -y libcupsfilters-dev libppd-dev || true
# Install comprehensive OpenPrinting dependency stack
sudo apt-get install -y \
build-essential gcc g++ cmake autoconf automake libtool pkg-config \
libcups2-dev libcupsimage2-dev libqpdf-dev \
libpoppler-dev libpoppler-cpp-dev libpng-dev \
libjpeg-dev libtiff-dev libfontconfig1-dev libfreetype6-dev \
ghostscript poppler-utils tzdata git curl wget tar mupdf-tools \
autopoint gettext libjxl-dev libopenjp2-7-dev liblcms2-dev \
libavahi-client-dev libavahi-common-dev libdbus-1-dev libexif-dev \
zlib1g-dev
- name: Build pdfio, libcupsfilters, and libppd (native)
if: matrix.use-qemu == false
run: |
set -ex
# Clone and build pdfio (v1.6.2)
cd /tmp
wget -q https://github.com/michaelrsweet/pdfio/releases/download/v1.6.2/pdfio-1.6.2.tar.gz
tar -xzf pdfio-1.6.2.tar.gz
cd pdfio-1.6.2
./configure --prefix=/usr --enable-shared
make all
sudo make install
sudo ldconfig
# Clone and build libcupsfilters
cd /tmp
git clone --depth 1 https://github.com/OpenPrinting/libcupsfilters.git
cd libcupsfilters
./autogen.sh
./configure --prefix=/usr
make -j$(nproc)
sudo make install
sudo ldconfig
# Clone and build libppd
cd /tmp
git clone --depth 1 https://github.com/OpenPrinting/libppd.git
cd libppd
./autogen.sh
./configure --prefix=/usr
make -j$(nproc)
sudo make install
sudo ldconfig
- name: Build cups-filters (native)
if: matrix.use-qemu == false
run: |
set -ex
cd "$REPO_DIR"
./autogen.sh
./configure --prefix=/usr
make -j$(nproc) V=1
- name: Run test suite (native)
if: matrix.use-qemu == false
run: |
set -ex
cd "$REPO_DIR"
make check V=1 VERBOSE=1 || (test -f test-suite.log && cat test-suite.log; exit 1)
# ========================================================================
# EMULATED BUILD (armv7 and riscv64)
# ========================================================================
- name: Set up QEMU for emulation
if: matrix.use-qemu == true
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.qemu-arch }}
- name: Build and test on emulated architecture
if: matrix.use-qemu == true
uses: uraimo/run-on-arch-action@v3
with:
arch: ${{ matrix.qemu-arch }}
distro: ubuntu24.04
dockerRunArgs: |
--volume "${{ github.workspace }}:/workspace"
install: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
# Remove conflicting system packages
apt-get remove -y libcupsfilters-dev libppd-dev 2>/dev/null || true
# Install comprehensive OpenPrinting dependency stack
apt-get install -y \
build-essential gcc g++ cmake autoconf automake libtool pkg-config \
libcups2-dev libcupsimage2-dev libqpdf-dev \
libpoppler-dev libpoppler-cpp-dev libpng-dev \
libjpeg-dev libtiff-dev libfontconfig1-dev libfreetype6-dev \
ghostscript poppler-utils git curl wget tar mupdf-tools \
autopoint gettext libjxl-dev libopenjp2-7-dev liblcms2-dev \
libavahi-client-dev libavahi-common-dev libdbus-1-dev libexif-dev \
zlib1g-dev
run: |
set -ex
export REPO_DIR="/workspace"
# Build pdfio (v1.6.2)
cd /tmp
wget -q https://github.com/michaelrsweet/pdfio/releases/download/v1.6.2/pdfio-1.6.2.tar.gz
tar -xzf pdfio-1.6.2.tar.gz
cd pdfio-1.6.2
./configure --prefix=/usr --enable-shared
make all
make install
ldconfig
# Clone and build libcupsfilters
cd /tmp
git clone --depth 1 https://github.com/OpenPrinting/libcupsfilters.git
cd libcupsfilters
./autogen.sh
./configure --prefix=/usr
make -j$(nproc)
make install
ldconfig
# Clone and build libppd
cd /tmp
git clone --depth 1 https://github.com/OpenPrinting/libppd.git
cd libppd
./autogen.sh
./configure --prefix=/usr
make -j$(nproc)
make install
ldconfig
# CRITICAL: Return to workspace (not pwd, which would be /tmp/libppd)
cd "$REPO_DIR"
./autogen.sh
./configure --prefix=/usr
make -j$(nproc) V=1
# Run test suite with strict error handling
make check V=1 VERBOSE=1 || (test -f test-suite.log && cat test-suite.log; exit 1)
# ========================================================================
# ARTIFACT COLLECTION (both native and emulated)
# ========================================================================
- name: Upload test logs on failure
if: always()
uses: actions/upload-artifact@v4
with:
name: test-logs-${{ matrix.arch }}
path: |
test-suite.log
**/*.log
if-no-files-found: ignore