Skip to content

zbus backend

zbus backend #66

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
build-ubuntu:
name: Build & test (ubuntu-latest)
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v6
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential pkg-config autoconf automake libtool libtool-bin gettext autopoint \
libglib2.0-dev libdbus-1-dev dbus dbus-x11 \
libcups2-dev cups \
libavahi-common-dev libavahi-client-dev \
git curl
- name: Build and install cpdb-libs
run: |
git clone --depth=1 https://github.com/OpenPrinting/cpdb-libs.git ~/cpdb-libs
cd ~/cpdb-libs
./autogen.sh || autoreconf -fi
./configure --prefix=/usr
make -j"$(nproc)"
sudo make install
sudo ldconfig
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Build (all targets)
run: cargo build --all-targets --all-features --verbose
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
- name: Run unit tests
env:
LD_LIBRARY_PATH: /usr/lib:/usr/local/lib
run: cargo test --all-targets --all-features --verbose
- name: D-Bus smoke test (ignored integration tests)
env:
LD_LIBRARY_PATH: /usr/lib:/usr/local/lib
# `dbus-launch` spins up an ephemeral session bus for the cargo
# invocation. No printers are configured in CI, so the smoke test
# exercises init/connect/discover/teardown only — its job is to
# catch crashes and leaks, not to assert printer counts.
run: dbus-launch --exit-with-session cargo test --test integration -- --ignored --nocapture
- name: Build examples
run: cargo build --examples --all-features --verbose
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-dev build-essential pkg-config autoconf automake libtool libtool-bin gettext autopoint
- name: Build and install cpdb-libs (for headers)
run: |
git clone --depth=1 https://github.com/OpenPrinting/cpdb-libs.git ~/cpdb-libs
cd ~/cpdb-libs
./autogen.sh || autoreconf -fi
./configure --prefix=/usr
make -j"$(nproc)"
sudo make install
sudo ldconfig
- name: Docs
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --no-deps -p cpdb-rs --all-features
audit:
name: Security audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run audit
run: cargo audit
deny:
name: cargo-deny (licenses, advisories, bans)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-deny
run: cargo install cargo-deny --locked
- name: Run cargo deny
run: cargo deny --all-features check
miri:
name: Miri (pure-Rust portions)
runs-on: ubuntu-latest
# Miri cannot evaluate cpdb-libs FFI calls. The job exercises the
# subset of tests marked safe (everything not gated by
# `#[cfg_attr(miri, ignore)]`) and is non-blocking — its purpose is
# to catch undefined behaviour in pure-Rust code (lifetime errors,
# use-after-free, pointer arithmetic) before it ships.
continue-on-error: true
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v6
- name: Install nightly + miri
uses: dtolnay/rust-toolchain@nightly
with:
components: miri, rust-src
- name: Install system dependencies (headers only)
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-dev build-essential pkg-config autoconf automake libtool libtool-bin gettext autopoint
- name: Build and install cpdb-libs (for headers — bindgen still runs)
run: |
git clone --depth=1 https://github.com/OpenPrinting/cpdb-libs.git ~/cpdb-libs
cd ~/cpdb-libs
./autogen.sh || autoreconf -fi
./configure --prefix=/usr
make -j"$(nproc)"
sudo make install
sudo ldconfig
- name: Run miri on the library tests
env:
MIRIFLAGS: -Zmiri-disable-isolation
run: cargo miri test --lib -- --skip 'ffi::'
build-macos:
name: Build (macos-latest, headers only)
runs-on: macos-latest
env:
# Skip rustc-link-lib directives — cpdb-libs is not fully installed.
# Verifies bindgen can parse the headers and the crate compiles;
# linking is exercised on Ubuntu.
CPDB_NO_LINK: "1"
steps:
- uses: actions/checkout@v6
- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Homebrew dependencies
run: brew install autoconf automake libtool gettext pkg-config glib
- name: Clone and configure cpdb-libs (headers only)
run: |
git clone --depth=1 https://github.com/OpenPrinting/cpdb-libs.git ~/cpdb-libs
cd ~/cpdb-libs
export PATH="/opt/homebrew/opt/gettext/bin:/opt/homebrew/bin:$PATH"
autoreconf -fi
./configure --prefix=/usr/local || true
# Run make to generate auto-generated headers (e.g. backend-interface.h).
make -j$(sysctl -n hw.logicalcpu) || true
echo "CPDB_LIBS_PATH=$HOME/cpdb-libs" >> "$GITHUB_ENV"
echo "BINDGEN_EXTRA_CLANG_ARGS=-I$HOME/cpdb-libs -I$HOME/cpdb-libs/cpdb" >> "$GITHUB_ENV"
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Build Rust library (bindgen + compile, no link)
run: cargo build --lib --all-features --verbose