@@ -60,16 +60,20 @@ jobs:
6060 strategy :
6161 fail-fast : false
6262 matrix :
63- os : [fedora:latest, fedora:41, rockylinux:9 ]
63+ os : [fedora:latest, fedora:41]
6464
6565 container :
6666 image : ${{ matrix.os }}
6767
6868 steps :
6969 - uses : actions/checkout@v4
70+ with :
71+ fetch-depth : 0
72+
73+ - name : Mark directory as safe for git
74+ run : git config --global --add safe.directory "$GITHUB_WORKSPACE"
7075
71- - name : Install RPM build dependencies (Fedora)
72- if : startsWith(matrix.os, 'fedora')
76+ - name : Install RPM build dependencies
7377 run : |
7478 dnf install -y \
7579 rpm-build \
@@ -85,23 +89,74 @@ jobs:
8589 python3-sphinx \
8690 git
8791
88- - name : Install RPM build dependencies (Rocky/RHEL)
89- if : startsWith(matrix.os, 'rockylinux')
92+ - name : Set up RPM build tree
93+ run : rpmdev-setuptree
94+
95+ - name : Create source tarball
96+ run : |
97+ VERSION=$(grep "version:" meson.build | head -1 | sed "s/.*'\(.*\)'.*/\1/")
98+ echo "Building version $VERSION"
99+ tar czf ~/rpmbuild/SOURCES/systemd-netlogd-$VERSION.tar.gz \
100+ --transform "s,^,systemd-netlogd-$VERSION/," \
101+ --exclude='.git' --exclude='builddir' \
102+ .
103+
104+ - name : Copy spec file
105+ run : cp systemd-netlogd.spec ~/rpmbuild/SPECS/
106+
107+ - name : Build RPMs
108+ run : rpmbuild -ba ~/rpmbuild/SPECS/systemd-netlogd.spec
109+
110+ - name : Test install RPM
111+ run : |
112+ dnf install -y ~/rpmbuild/RPMS/*/systemd-netlogd-*.rpm
113+ rpm -qi systemd-netlogd
114+ systemctl status systemd-netlogd || true
115+
116+ - name : Upload RPM artifacts
117+ uses : actions/upload-artifact@v4
118+ with :
119+ name : rpms-${{ matrix.os }}
120+ path : |
121+ ~/rpmbuild/RPMS/*/*.rpm
122+ ~/rpmbuild/SRPMS/*.rpm
123+ retention-days : 30
124+
125+ build-rpm-rocky :
126+ name : Build RPM (rockylinux:9)
127+ runs-on : ubuntu-latest
128+
129+ container :
130+ image : rockylinux:9
131+
132+ steps :
133+ - uses : actions/checkout@v4
134+ with :
135+ fetch-depth : 0
136+
137+ - name : Mark directory as safe for git
138+ run : git config --global --add safe.directory "$GITHUB_WORKSPACE"
139+
140+ - name : Enable CRB and install EPEL
90141 run : |
91142 dnf install -y epel-release
143+ /usr/bin/crb enable
144+
145+ - name : Install RPM build dependencies
146+ run : |
92147 dnf install -y \
93148 rpm-build \
94149 rpmdevtools \
95- meson \
96- ninja-build \
97150 gcc \
98151 systemd-devel \
99152 libcap-devel \
100153 gperf \
101154 openssl-devel \
102155 libcmocka-devel \
156+ python3-pip \
103157 python3-sphinx \
104158 git
159+ pip3 install meson ninja
105160
106161 - name : Set up RPM build tree
107162 run : rpmdev-setuptree
@@ -110,7 +165,10 @@ jobs:
110165 run : |
111166 VERSION=$(grep "version:" meson.build | head -1 | sed "s/.*'\(.*\)'.*/\1/")
112167 echo "Building version $VERSION"
113- git archive --format=tar.gz --prefix=systemd-netlogd-$VERSION/ -o ~/rpmbuild/SOURCES/systemd-netlogd-$VERSION.tar.gz HEAD
168+ tar czf ~/rpmbuild/SOURCES/systemd-netlogd-$VERSION.tar.gz \
169+ --transform "s,^,systemd-netlogd-$VERSION/," \
170+ --exclude='.git' --exclude='builddir' \
171+ .
114172
115173 - name : Copy spec file
116174 run : cp systemd-netlogd.spec ~/rpmbuild/SPECS/
@@ -127,7 +185,7 @@ jobs:
127185 - name : Upload RPM artifacts
128186 uses : actions/upload-artifact@v4
129187 with :
130- name : rpms-${{ matrix.os }}
188+ name : rpms-rockylinux-9
131189 path : |
132190 ~/rpmbuild/RPMS/*/*.rpm
133191 ~/rpmbuild/SRPMS/*.rpm
0 commit comments