Skip to content

Commit 89ab05e

Browse files
committed
Add post-install smoke tests for distribution packages
1 parent 26d3431 commit 89ab05e

27 files changed

Lines changed: 684 additions & 107 deletions
Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
---
2+
name: Package install tests
3+
4+
on:
5+
push:
6+
branches:
7+
- "*"
8+
paths:
9+
- "packaging-examples/**"
10+
- "debian/**"
11+
- ".github/workflows/package-install-tests.yml"
12+
pull_request:
13+
branches:
14+
- "*"
15+
paths:
16+
- "packaging-examples/**"
17+
- "debian/**"
18+
- ".github/workflows/package-install-tests.yml"
19+
20+
permissions:
21+
contents: read
22+
23+
env:
24+
DEBIAN_FRONTEND: noninteractive
25+
26+
jobs:
27+
28+
upload-tests:
29+
runs-on: ubuntu-24.04
30+
31+
steps:
32+
- uses: actions/checkout@v6
33+
with:
34+
persist-credentials: false
35+
sparse-checkout: |
36+
packaging-examples/install_tests
37+
libs/bindings/python/example.py
38+
libs/bindings/perl/example.pl
39+
libs/bindings/ruby/example.rb
40+
libs/bindings/java/Example.java
41+
42+
- name: Collect test assets
43+
run: |
44+
cp libs/bindings/python/example.py \
45+
packaging-examples/install_tests/example.py
46+
cp libs/bindings/perl/example.pl \
47+
packaging-examples/install_tests/example.pl
48+
cp libs/bindings/ruby/example.rb \
49+
packaging-examples/install_tests/example.rb
50+
51+
- name: Upload test scripts
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: install-tests
55+
path: packaging-examples/install_tests/
56+
retention-days: 1
57+
58+
build-deb:
59+
runs-on: ubuntu-24.04
60+
61+
steps:
62+
- uses: actions/checkout@v6
63+
with:
64+
persist-credentials: false
65+
66+
- name: Fix PATH for CI
67+
run: sed -i "s|/usr/local/bin:||" build/make_resource.pl
68+
69+
- name: Set version placeholder to valid date
70+
run: sed -i '1s/^XXXX-XX-XX$/0001-01-01/' CHANGES
71+
72+
- name: Speed up dpkg and configure apt retries
73+
run: |
74+
echo 'force-unsafe-io' | sudo tee /etc/dpkg/dpkg.cfg.d/02speedup
75+
echo 'Acquire::Retries "10";' | sudo tee /etc/apt/apt.conf.d/80retries
76+
77+
- name: Install build dependencies
78+
run: |
79+
sudo apt-get update
80+
sudo apt-get install -y --no-install-recommends devscripts equivs
81+
sudo mk-build-deps -i -t 'apt-get -y --no-install-recommends' debian/control
82+
83+
- name: Build DEB packages
84+
run: dpkg-buildpackage -us -uc -b
85+
86+
- name: Collect DEB packages
87+
run: |
88+
mkdir -p deb-output
89+
cp ../*.deb deb-output/
90+
91+
- name: Upload DEB packages
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: deb-packages
95+
path: deb-output/*.deb
96+
retention-days: 1
97+
98+
test-deb:
99+
needs: [upload-tests, build-deb]
100+
runs-on: ubuntu-24.04
101+
102+
steps:
103+
- name: Download test scripts
104+
uses: actions/download-artifact@v4
105+
with:
106+
name: install-tests
107+
path: tests
108+
109+
- name: Download DEB packages
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: deb-packages
113+
path: packages
114+
115+
- name: Install DEB packages
116+
run: |
117+
sudo apt-get update
118+
sudo dpkg -i packages/*.deb || true
119+
sudo apt-get install -f -y
120+
sudo apt-get install -y --no-install-recommends ghostscript
121+
122+
- name: Run smoke tests
123+
run: |
124+
chmod +x tests/*.sh
125+
tests/run_all.sh
126+
127+
build-rpm:
128+
runs-on: ubuntu-24.04
129+
container: fedora:latest
130+
131+
steps:
132+
- uses: actions/checkout@v6
133+
with:
134+
persist-credentials: false
135+
136+
- name: Set version placeholder to valid date
137+
run: sed -i '1s/^XXXX-XX-XX$/0001-01-01/' CHANGES
138+
139+
- name: Install build dependencies
140+
run: |
141+
echo 'install_weak_deps=False' >> /etc/dnf/dnf.conf
142+
dnf install -y rpm-build rpmdevtools
143+
rpmdev-setuptree
144+
VERSION=$(head -1 CHANGES | tr -d -)
145+
sed "s/^Version:.*/Version: ${VERSION}/" \
146+
packaging-examples/rpm-based/postscriptbarcode.spec \
147+
> "$HOME/rpmbuild/SPECS/postscriptbarcode.spec"
148+
dnf builddep -y "$HOME/rpmbuild/SPECS/postscriptbarcode.spec"
149+
150+
- name: Build RPM packages
151+
run: |
152+
VERSION=$(head -1 CHANGES | tr -d -)
153+
tar czf "$HOME/rpmbuild/SOURCES/postscriptbarcode-${VERSION}.tar.gz" \
154+
--transform "flags=r;s,^,postscriptbarcode-${VERSION}/," \
155+
--exclude=.git .
156+
rpmbuild -bb "$HOME/rpmbuild/SPECS/postscriptbarcode.spec"
157+
mkdir -p /tmp/rpms
158+
cp "$HOME"/rpmbuild/RPMS/*/*.rpm /tmp/rpms/
159+
160+
- name: Upload RPM packages
161+
uses: actions/upload-artifact@v4
162+
with:
163+
name: rpm-packages
164+
path: /tmp/rpms/*.rpm
165+
retention-days: 1
166+
167+
test-rpm:
168+
needs: [upload-tests, build-rpm]
169+
runs-on: ubuntu-24.04
170+
container: fedora:latest
171+
172+
steps:
173+
- name: Download test scripts
174+
uses: actions/download-artifact@v4
175+
with:
176+
name: install-tests
177+
path: tests
178+
179+
- name: Download RPM packages
180+
uses: actions/download-artifact@v4
181+
with:
182+
name: rpm-packages
183+
path: packages
184+
185+
- name: Install RPM packages
186+
run: dnf install -y ghostscript packages/*.rpm
187+
188+
- name: Run smoke tests
189+
run: |
190+
chmod +x tests/*.sh
191+
tests/run_all.sh
192+
193+
build-arch:
194+
runs-on: ubuntu-24.04
195+
container: archlinux:latest
196+
197+
steps:
198+
- uses: actions/checkout@v6
199+
with:
200+
persist-credentials: false
201+
202+
- name: Set version placeholder to valid date
203+
run: sed -i '1s/^XXXX-XX-XX$/0001-01-01/' CHANGES
204+
205+
- name: Install base build tools
206+
run: |
207+
pacman -Syu --noconfirm
208+
pacman -S --noconfirm --needed base-devel
209+
210+
- name: Build Arch packages
211+
run: |
212+
VERSION=$(head -1 CHANGES)
213+
PKGVER=${VERSION//-/}
214+
sed -i "s/^pkgver=.*/pkgver=${PKGVER}/" \
215+
packaging-examples/arch-linux/PKGBUILD
216+
TGZDIR=packaging-examples/arch-linux
217+
tar czf "${TGZDIR}/postscriptbarcode-${PKGVER}.tar.gz" \
218+
--transform "flags=r;s,^,postscriptbarcode-${PKGVER}/," \
219+
--exclude=.git --exclude=packaging-examples .
220+
useradd -m builder
221+
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
222+
chown -R builder:builder .
223+
cd packaging-examples/arch-linux
224+
su builder -c "makepkg -s --noconfirm --skipchecksums"
225+
mkdir -p /tmp/archpkgs
226+
cp ./*.pkg.tar.zst /tmp/archpkgs/
227+
228+
- name: Upload Arch packages
229+
uses: actions/upload-artifact@v4
230+
with:
231+
name: arch-packages
232+
path: /tmp/archpkgs/*.pkg.tar.zst
233+
retention-days: 1
234+
235+
test-arch:
236+
needs: [upload-tests, build-arch]
237+
runs-on: ubuntu-24.04
238+
container: archlinux:latest
239+
240+
steps:
241+
- name: Download test scripts
242+
uses: actions/download-artifact@v4
243+
with:
244+
name: install-tests
245+
path: tests
246+
247+
- name: Download Arch packages
248+
uses: actions/download-artifact@v4
249+
with:
250+
name: arch-packages
251+
path: packages
252+
253+
- name: Install Arch packages
254+
run: |
255+
pacman -Syu --noconfirm
256+
pacman -U --noconfirm packages/*.pkg.tar.zst
257+
pacman -S --noconfirm --needed ghostscript
258+
259+
- name: Run smoke tests
260+
run: |
261+
chmod +x tests/*.sh
262+
tests/run_all.sh

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
XXXX-XX-XX
2+
3+
*
4+
5+
16
2026-03-13
27

38
* FMLY was added to the encoder metadata.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#! /usr/bin/dh-exec
2-
libs/bindings/java/libpostscriptbarcode.so usr/lib/${DEB_HOST_MULTIARCH}/jni
2+
libs/bindings/java/libpostscriptbarcode_jni.so usr/lib/${DEB_HOST_MULTIARCH}/jni

debian/tests/control

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Tests: smoke-postscript
2+
Depends: postscriptbarcode, ghostscript
3+
4+
Tests: smoke-clib
5+
Depends: libpostscriptbarcode0, python3
6+
7+
Tests: smoke-python
8+
Depends: python3-postscriptbarcode
9+
10+
Tests: smoke-perl
11+
Depends: libpostscriptbarcode-perl
12+
13+
Tests: smoke-ruby
14+
Depends: ruby-postscriptbarcode
15+
16+
Tests: smoke-java
17+
Depends: libpostscriptbarcode-java, default-jdk

debian/tests/smoke-clib

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec packaging-examples/install_tests/test_clib.sh

debian/tests/smoke-java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec packaging-examples/install_tests/test_java.sh

debian/tests/smoke-perl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec packaging-examples/install_tests/test_perl.sh

debian/tests/smoke-postscript

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec packaging-examples/install_tests/test_postscript.sh

debian/tests/smoke-python

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec packaging-examples/install_tests/test_python.sh

debian/tests/smoke-ruby

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
exec packaging-examples/install_tests/test_ruby.sh

0 commit comments

Comments
 (0)