-
Notifications
You must be signed in to change notification settings - Fork 2
278 lines (236 loc) · 9.06 KB
/
build-rpm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
name: Build and test rpm package for linupdate
on:
push:
branches: [ devel ]
pull_request:
push:
branches: [ main ]
jobs:
# Build rpm package
# Even it is build on CentOS7, package should be installable on RHEL7/8/9 based systems
build-rpm:
name: Build rpm package
runs-on: ubuntu-latest
env:
# Force to use node16 (for actions/checkout@v3)
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container:
image: centos:7
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
- name: Install CentOS7 archive repositories
run: |
rm /etc/yum.repos.d/* -f
echo "[os]
name=os repo
baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/os.repo
echo "[extras]
name=extras repo
baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/extras.repo
echo "[updates]
name=updates repo
baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/updates.repo
yum clean all
- name: Install dependencies packages
run: yum install rpmdevtools rpmlint -y
- name: Create build environment
run: |
mkdir -p $HOME/rpmbuild/BUILD
mkdir -p $HOME/rpmbuild/BUILDROOT
mkdir -p $HOME/rpmbuild/RPMS
mkdir -p $HOME/rpmbuild/SOURCES
mkdir -p $HOME/rpmbuild/SPECS
mkdir -p /etc/linupdate/modules
mkdir -p /opt/linupdate
mkdir -p /opt/linupdate/.src/
mkdir -p /opt/linupdate/mods-available/
mkdir -p /opt/linupdate/mods-enabled/
mkdir -p /opt/linupdate/agents-available/
mkdir -p /opt/linupdate/agents-enabled/
mkdir -p /opt/linupdate/service/
mkdir -p /lib/systemd/system/
- name: Copy files to include in the build
run: |
cp -r ${GITHUB_WORKSPACE}/src/* /opt/linupdate/.src/
cp -r ${GITHUB_WORKSPACE}/mods-available/* /opt/linupdate/mods-available/
cp -r ${GITHUB_WORKSPACE}/service/* /opt/linupdate/service/
cp ${GITHUB_WORKSPACE}/linupdate /opt/linupdate/linupdate
cp ${GITHUB_WORKSPACE}/version /opt/linupdate/version
cp -r ${GITHUB_WORKSPACE}/service/linupdate.systemd.template /lib/systemd/system/linupdate.service
- name: Copy spec file
run: |
cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec
sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec
- name: Build package
run: |
cd $HOME/rpmbuild/SPECS
rpmbuild --target noarch -bb --quiet linupdate.spec
mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-stable.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm
path: /tmp/linupdate-test-build-${{ env.VERSION }}.noarch.rpm
retention-days: 1
# Try to install packages on CentOS 7
install-centos7:
name: Install on CentOS 7
needs:
build-rpm
runs-on: ubuntu-latest
container:
image: centos:7
options: --user root
env:
# Force to use node16 (for actions/checkout@v3)
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
- name: Install CentOS7 archive repositories
run: |
rm /etc/yum.repos.d/* -f
echo "[os]
name=os repo
baseurl=https://vault.centos.org/7.9.2009/os/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/os.repo
echo "[extras]
name=extras repo
baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/extras.repo
echo "[updates]
name=updates repo
baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/
enabled=1
gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7
gpgcheck=1" > /etc/yum.repos.d/updates.repo
echo "[epel]
name=epel repo
baseurl=https://dl.fedoraproject.org/pub/epel/7/x86_64/
enabled=1
gpgkey=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
gpgcheck=1" > /etc/yum.repos.d/epel.repo
yum clean all
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Install package
run: yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Test some params
run: |
/opt/linupdate/linupdate --help
/opt/linupdate/linupdate --version
/opt/linupdate/linupdate --check-updates
/opt/linupdate/linupdate --profile container
/opt/linupdate/linupdate --env test
# Try to install packages on RockyLinux 8
install-rockylinux8:
name: Install on RockyLinux 8
needs:
build-rpm
runs-on: ubuntu-latest
container:
image: rockylinux/rockylinux:8
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
- name: Install EPEL repository
run: dnf install epel-release glibc-langpack-en -y
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Install package
run: yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Test some params
run: |
/opt/linupdate/linupdate --help
/opt/linupdate/linupdate --version
/opt/linupdate/linupdate --check-updates
/opt/linupdate/linupdate --profile container
/opt/linupdate/linupdate --env test
# Try to install packages on RockyLinux 9
install-rockylinux9:
name: Install on RockyLinux 9
needs:
build-rpm
runs-on: ubuntu-latest
container:
image: rockylinux/rockylinux:9
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
- name: Install EPEL repository
run: dnf install epel-release -y
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Install package
run: yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Test some params
run: |
/opt/linupdate/linupdate --help
/opt/linupdate/linupdate --version
/opt/linupdate/linupdate --check-updates
/opt/linupdate/linupdate --profile container
/opt/linupdate/linupdate --env test
# Try to install packages on latest Fedora
install-fedora:
name: Install on latest Fedora
needs:
build-rpm
runs-on: ubuntu-latest
container:
image: fedora:latest
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get linupdate version
run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV
# Download builded deb package artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Install package
run: dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm
- name: Test some params
run: |
/opt/linupdate/linupdate --help
/opt/linupdate/linupdate --version
/opt/linupdate/linupdate --check-updates
/opt/linupdate/linupdate --profile container
/opt/linupdate/linupdate --env test