@@ -2,19 +2,11 @@ name: Build and Test Packages
22
33on :
44 push :
5- tags :
6- - " v*"
7- branches :
8- - " main"
9- - " release-test"
5+ tags : ["v*"]
6+ branches : ["main", "release-test"]
107 pull_request :
11- branches :
12- - " main"
13- paths :
14- - " debian/**"
15- - " rpm/**"
16- - " scripts/build-*.sh"
17- - " .github/workflows/packages.yml"
8+ branches : ["main"]
9+ paths : ["debian/**", "rpm/**", "scripts/build-*.sh", ".github/workflows/packages.yml"]
1810 workflow_dispatch :
1911 workflow_call :
2012
@@ -24,201 +16,111 @@ permissions:
2416
2517jobs :
2618 build-deb :
27- name : Build Debian Package
19+ name : Build DEB
2820 runs-on : ubuntu-20.04
2921 steps :
3022 - uses : actions/checkout@v4
3123 with :
3224 fetch-depth : 0
3325
34- - name : Install build dependencies
35- run : |
36- sudo apt-get update
37- sudo apt-get install -y debhelper dpkg-dev build-essential \
38- libssl-dev pkg-config unixodbc-dev lintian
26+ - name : Install dependencies
27+ run : sudo apt-get update && sudo apt-get install -y debhelper dpkg-dev build-essential libssl-dev pkg-config unixodbc-dev lintian
3928
40- - name : Install Rust toolchain
41- uses : dtolnay/rust-toolchain@stable
29+ - uses : dtolnay/rust-toolchain@stable
4230 with :
4331 targets : x86_64-unknown-linux-gnu
4432
45- - name : Set up cargo cache
46- uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
33+ - uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
4734
48- - name : Build package
49- run : |
50- VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
51- sed -i "1s/.*/sqlpage ($VERSION-1) unstable; urgency=medium/" debian/changelog
52- dpkg-buildpackage -us -uc -b -d
53-
54- mkdir -p build-output
55- mv ../*.deb build-output/
56- mv ../*.changes build-output/ || true
57- mv ../*.buildinfo build-output/ || true
58-
59- lintian --no-tag-display-limit build-output/*.deb || true
60- dpkg-deb --contents build-output/*.deb
61- dpkg-deb --info build-output/*.deb
62-
63- - name : Upload DEB package
64- uses : actions/upload-artifact@v4
35+ - name : Build
36+ run : bash scripts/ci-build-deb.sh
37+
38+ - uses : actions/upload-artifact@v4
6539 with :
6640 name : debian-package
6741 path : build-output/*.deb
68- if-no-files-found : error
69-
70- - name : Upload DEB changes
71- uses : actions/upload-artifact@v4
72- with :
73- name : debian-changes
74- path : build-output/*.changes
75- if-no-files-found : warn
7642
7743 build-rpm :
78- name : Build RPM Package
44+ name : Build RPM
7945 runs-on : ubuntu-latest
8046 container : quay.io/pypa/manylinux_2_28_x86_64
8147 steps :
82- - name : Install git for checkout
83- run : yum install -y git
48+ - name : Setup
49+ run : |
50+ yum install -y git
51+ git config --global --add safe.directory /__w/SQLPage/SQLPage
8452
8553 - uses : actions/checkout@v4
8654 with :
8755 fetch-depth : 0
8856
89- - name : Configure git safe directory
90- run : git config --global --add safe.directory /__w/SQLPage/SQLPage
91-
92- - name : Install build dependencies
57+ - name : Install dependencies
9358 run : yum install -y rpm-build rpmdevtools openssl-devel systemd unixODBC-devel
9459
95- - name : Install Rust toolchain
96- uses : dtolnay/rust-toolchain@stable
60+ - uses : dtolnay/rust-toolchain@stable
9761 with :
9862 targets : x86_64-unknown-linux-gnu
9963
100- - name : Set up cargo cache
101- uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
64+ - uses : Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
10265
103- - name : Build package
104- run : |
105- rpmdev-setuptree
106- VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
107- RPM_VERSION=$(echo "$VERSION" | sed 's/-/~/')
108-
109- sed -i "s/^Version:.*/Version: ${RPM_VERSION}/" rpm/sqlpage.spec
110- cp rpm/sqlpage.spec ~/rpmbuild/SPECS/
111-
112- git archive --format=tar.gz --prefix="SQLPage-${RPM_VERSION}/" \
113- -o ~/rpmbuild/SOURCES/v${RPM_VERSION}.tar.gz HEAD
114-
115- rpmbuild -ba --nodeps ~/rpmbuild/SPECS/sqlpage.spec
116-
117- rpmlint ~/rpmbuild/RPMS/*/sqlpage*.rpm || true
118- rpmlint ~/rpmbuild/SRPMS/sqlpage*.rpm || true
119- rpm -qilp ~/rpmbuild/RPMS/*/sqlpage*.rpm
120-
121- - name : Upload RPM package
122- uses : actions/upload-artifact@v4
66+ - name : Build
67+ run : bash scripts/ci-build-rpm.sh
68+
69+ - uses : actions/upload-artifact@v4
12370 with :
12471 name : rpm-package
12572 path : ~/rpmbuild/RPMS/*/sqlpage*.rpm
126- if-no-files-found : error
12773
128- - name : Upload SRPM package
129- uses : actions/upload-artifact@v4
74+ - uses : actions/upload-artifact@v4
13075 with :
13176 name : srpm-package
13277 path : ~/rpmbuild/SRPMS/sqlpage*.rpm
133- if-no-files-found : error
134-
135- test-deb-debian :
136- name : Test DEB on Debian ${{ matrix.version }}
137- needs : build-deb
138- runs-on : ubuntu-latest
139- strategy :
140- matrix :
141- version : ["bookworm", "bullseye"]
142- container : debian:${{ matrix.version }}
143- steps :
144- - uses : actions/checkout@v4
145-
146- - name : Download DEB package
147- uses : actions/download-artifact@v4
148- with :
149- name : debian-package
150-
151- - name : Run DEB tests
152- run : bash scripts/ci-test-deb.sh ./sqlpage*.deb
15378
154- test-deb-ubuntu :
155- name : Test DEB on Ubuntu ${{ matrix.version }}
156- needs : build-deb
79+ test :
80+ name : Test ${{ matrix.pkg }} on ${{ matrix.distro }}
81+ needs : [ build-deb, build-rpm]
15782 runs-on : ubuntu-latest
15883 strategy :
15984 matrix :
160- version : ["24.04", "22.04", "20.04"]
161- container : ubuntu:${{ matrix.version }}
85+ include :
86+ - pkg : deb
87+ distro : debian:bookworm
88+ - pkg : deb
89+ distro : debian:bullseye
90+ - pkg : deb
91+ distro : ubuntu:24.04
92+ - pkg : deb
93+ distro : ubuntu:22.04
94+ - pkg : deb
95+ distro : ubuntu:20.04
96+ - pkg : rpm
97+ distro : fedora:latest
98+ - pkg : rpm
99+ distro : rockylinux:8
100+ container : ${{ matrix.distro }}
162101 steps :
163102 - uses : actions/checkout@v4
164103
165- - name : Download DEB package
166- uses : actions/download-artifact@v4
104+ - uses : actions/download-artifact@v4
167105 with :
168- name : debian-package
106+ name : ${{ matrix.pkg == 'deb' && ' debian-package' || 'rpm-package' }}
169107
170- - name : Run DEB tests
171- run : bash scripts/ci-test-deb. sh . /sqlpage*.deb
108+ - name : Test
109+ run : bash scripts/ci-test-${{ matrix.pkg }}. sh ${{ matrix.pkg == 'deb' && '. /sqlpage*.deb' || './x86_64/*.rpm' }}
172110
173- test-rpm :
174- name : Test RPM on ${{ matrix.container }}
175- needs : build-rpm
176- runs-on : ubuntu-latest
177- strategy :
178- matrix :
179- container : [fedora:latest, rockylinux:8]
180- container : ${{ matrix.container }}
181- steps :
182- - uses : actions/checkout@v4
183-
184- - name : Download RPM package
185- uses : actions/download-artifact@v4
186- with :
187- name : rpm-package
188-
189- - name : Run RPM tests
190- run : bash scripts/ci-test-rpm.sh ./x86_64/*.rpm
191-
192- publish-packages :
193- name : Publish Packages to GitHub Release
194- needs : [test-deb-debian, test-deb-ubuntu, test-rpm]
111+ publish :
112+ name : Publish
113+ needs : test
195114 runs-on : ubuntu-latest
196115 if : startsWith(github.ref, 'refs/tags/')
197116 steps :
198117 - uses : actions/checkout@v4
118+ - uses : actions/download-artifact@v4
199119
200- - name : Download all artifacts
201- uses : actions/download-artifact@v4
202-
203- - name : Prepare release assets
204- run : |
205- mkdir -p release-assets
206- cp debian-package/*.deb release-assets/
207- cp rpm-package/*.rpm release-assets/
208- cp srpm-package/*.rpm release-assets/
209- ls -lh release-assets/
210-
211- - name : Generate package checksums
212- run : |
213- cd release-assets
214- sha256sum * > SHA256SUMS
215- cat SHA256SUMS
120+ - name : Prepare
121+ run : bash scripts/ci-publish.sh
216122
217- - name : Upload to GitHub Release
218- uses : softprops/action-gh-release@v2
123+ - uses : softprops/action-gh-release@v2
219124 with :
220- files : |
221- release-assets/*.deb
222- release-assets/*.rpm
223- release-assets/SHA256SUMS
224- fail_on_unmatched_files : true
125+ files : release-assets/*
126+ fail_on_unmatched_files : true
0 commit comments