|
| 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 |
0 commit comments