Skip to content

Commit dc5c7a0

Browse files
authored
Merge pull request #33 from osuosl/rpm-deb-ci
Add new CI which tests building and installing rpm/deb packages
2 parents edf74a6 + fd3249d commit dc5c7a0

File tree

3 files changed

+198
-5
lines changed

3 files changed

+198
-5
lines changed

.github/workflows/ci.yml

Lines changed: 195 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,207 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Check out code
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
- name: Install dependencies
1717
run: |
1818
sudo apt-get update
19-
sudo apt-get -y install build-essential autoconf dump kpartx fdisk qemu-utils
19+
sudo apt-get -y install build-essential autoconf dump kpartx fdisk \
20+
qemu-utils
2021
- name: Build
2122
run: |
2223
./autogen.sh
2324
./configure
2425
make
2526
sudo make install
27+
- name: Verify installation
28+
run: |
29+
test -d /usr/local/share/ganeti/os/image
30+
test -f /usr/local/share/ganeti/os/image/create
31+
test -f /usr/local/share/ganeti/os/image/import
32+
test -f /usr/local/share/ganeti/os/image/export
33+
34+
# Call package build workflows
35+
rpm-build:
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
include:
40+
- os: 'almalinux:8'
41+
name: 'almalinux-8'
42+
- os: 'almalinux:9'
43+
name: 'almalinux-9'
44+
container:
45+
image: ${{ matrix.os }}
46+
47+
steps:
48+
- name: Check out code
49+
uses: actions/checkout@v4
50+
51+
- name: Install build dependencies
52+
run: |
53+
dnf install -y --allowerasing curl
54+
dnf install -y epel-release
55+
dnf install -y rpm-build rpmdevtools git autoconf automake make
56+
dnf builddep -y ganeti-instance-image.spec
57+
58+
- name: Set up RPM build environment
59+
run: |
60+
rpmdev-setuptree
61+
62+
- name: Generate configure script
63+
run: |
64+
./autogen.sh
65+
66+
- name: Configure build
67+
run: |
68+
./configure
69+
70+
- name: Create source tarball
71+
run: |
72+
make dist
73+
cp ganeti-instance-image-*.tar.gz ~/rpmbuild/SOURCES/
74+
75+
- name: Build RPM package
76+
run: |
77+
rpmbuild -ba ganeti-instance-image.spec
78+
79+
- name: Check built packages
80+
run: |
81+
ls -la ~/rpmbuild/RPMS/noarch/
82+
ls -la ~/rpmbuild/SRPMS/
83+
84+
- name: Upload RPM artifacts
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: rpm-packages-${{ matrix.name }}
88+
path: |
89+
~/rpmbuild/RPMS/noarch/*.rpm
90+
~/rpmbuild/SRPMS/*.rpm
91+
retention-days: 30
92+
93+
debian-build:
94+
runs-on: ubuntu-latest
95+
strategy:
96+
matrix:
97+
include:
98+
- os: 'debian:12'
99+
name: 'debian-12'
100+
- os: 'debian:13'
101+
name: 'debian-13'
102+
- os: 'ubuntu:22.04'
103+
name: 'ubuntu-22-04'
104+
- os: 'ubuntu:24.04'
105+
name: 'ubuntu-24-04'
106+
container:
107+
image: ${{ matrix.os }}
108+
109+
steps:
110+
- name: Check out code
111+
uses: actions/checkout@v4
112+
113+
- name: Install build dependencies
114+
run: |
115+
apt-get update
116+
apt-get install -y build-essential devscripts debhelper \
117+
autotools-dev automake git
118+
# Install all build dependencies from debian/control
119+
apt-get build-dep -y .
120+
121+
- name: Generate configure script
122+
run: |
123+
./autogen.sh
124+
125+
- name: Configure build
126+
run: |
127+
./configure
128+
129+
- name: Build Debian package
130+
run: |
131+
debuild -us -uc -b
132+
133+
- name: Check built packages
134+
run: |
135+
ls -la ../*.deb
136+
ls -la ../*.changes
137+
138+
- name: Move built packages to workspace
139+
run: |
140+
mv -v ../*.deb .
141+
mv -v ../*.changes .
142+
143+
- name: Upload Debian artifacts
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: debian-packages-${{ matrix.name }}
147+
path: |
148+
*.deb
149+
*.changes
150+
retention-days: 30
151+
152+
package-test:
153+
needs:
154+
- rpm-build
155+
- debian-build
156+
strategy:
157+
matrix:
158+
include:
159+
- os: 'almalinux:8'
160+
name: 'almalinux-8'
161+
artifact: 'rpm-packages-almalinux-8'
162+
- os: 'almalinux:9'
163+
name: 'almalinux-9'
164+
artifact: 'rpm-packages-almalinux-9'
165+
- os: 'debian:12'
166+
name: 'debian-12'
167+
artifact: 'debian-packages-debian-12'
168+
- os: 'debian:13'
169+
name: 'debian-13'
170+
artifact: 'debian-packages-debian-13'
171+
- os: 'ubuntu:22.04'
172+
name: 'ubuntu-22-04'
173+
artifact: 'debian-packages-ubuntu-22-04'
174+
- os: 'ubuntu:24.04'
175+
name: 'ubuntu-24-04'
176+
artifact: 'debian-packages-ubuntu-24-04'
177+
runs-on: ubuntu-latest
178+
container:
179+
image: ${{ matrix.os }}
180+
steps:
181+
- name: Download package artifact
182+
uses: actions/download-artifact@v4
183+
with:
184+
name: ${{ matrix.artifact }}
185+
path: .
186+
- name: Install gdebi (Debian/Ubuntu only)
187+
if: startsWith(matrix.os, 'debian') || startsWith(matrix.os, 'ubuntu')
188+
run: apt-get update && apt-get install -y gdebi-core
189+
- name: Add Ganeti repo (EL only)
190+
shell: bash
191+
if: contains(matrix.os, 'almalinux')
192+
run: |
193+
cat <<EOF > /etc/yum.repos.d/ganeti.repo
194+
[ganeti]
195+
name=Integ Ganeti Packages $releasever - \$basearch
196+
baseurl=https://ftp2.osuosl.org/pub/ganeti-rpm/\$releasever/\$basearch/
197+
enabled=1
198+
gpgcheck=1
199+
gpgkey=https://ftp2.osuosl.org/pub/ganeti-rpm/RPM-GPG-KEY-integ-ganeti
200+
EOF
201+
rpm --import https://ftp2.osuosl.org/pub/ganeti-rpm/RPM-GPG-KEY-integ-ganeti
202+
- name: Install package
203+
shell: bash
204+
run: |
205+
case "${{ matrix.os }}" in
206+
debian*)
207+
gdebi -n ./*.deb
208+
;;
209+
ubuntu*)
210+
gdebi -n ./*.deb
211+
;;
212+
almalinux*)
213+
dnf install -y epel-release
214+
dnf install -y RPMS/noarch/*.rpm
215+
;;
216+
esac
217+
- name: Verify installation
218+
run: 'test -d /usr/share/ganeti/os/image'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ debian/files
3636
debian/*.log
3737
debian/ganeti-instance-image/
3838
debian/ganeti-instance-image.substvars
39+
debian/.debhelper/
3940

4041
# Vagrant/Chef
4142
Berksfile.lock

debian/control

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ Source: ganeti-instance-image
22
Section: admin
33
Priority: extra
44
Maintainer: Lance Albertson <lance@osuosl.org>
5-
Build-Depends: debhelper (>= 7), autotools-dev, automake, curl, dump, kpartx,
6-
qemu (>= 0.11) | qemu-kvm (>= 0.11)
5+
Build-Depends: debhelper (>= 7), autotools-dev, automake, curl, dump, kpartx, qemu-utils, fdisk
76
Standards-Version: 3.7.3
87
Homepage: http://code.osuosl.org/projects/ganeti-image
98
Vcs-Browser: http://git.osuosl.org/?p=ganeti-instance-image.git
109
Vcs-Git: git://git.osuosl.org/gitolite/ganeti/ganeti-instance-image.git
1110

1211
Package: ganeti-instance-image
1312
Architecture: all
14-
Depends: ${misc:Depends}, dump, gawk, curl, kpartx, qemu (>= 0.11) | qemu-kvm (>= 0.11)
13+
Depends: ${misc:Depends}, dump, gawk, curl, kpartx, qemu-utils, fdisk
1514
Conflicts: ganeti (<< 1.2.7)
1615
Enhances: ganeti
1716
Description: image based instance OS defintion for ganeti

0 commit comments

Comments
 (0)