Repository navigation
211 lines (177 loc) · 6.76 KB
/
Copy pathci.yml
File metadata and controls
211 lines (177 loc) · 6.76 KB
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
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: Build (ffi-only, no zbus)
run: cargo build --no-default-features --features ffi --verbose
- name: Build (zbus-only, no ffi)
run: cargo build --no-default-features --features zbus-backend --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: Run unit tests (zbus-only)
env:
LD_LIBRARY_PATH: /usr/lib:/usr/local/lib
run: cargo test --no-default-features --features zbus-backend --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