-
-
Notifications
You must be signed in to change notification settings - Fork 15
312 lines (279 loc) · 11.6 KB
/
build-media.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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: Build Live images
on:
workflow_dispatch:
inputs:
GNOME:
description: 'GNOME'
required: true
type: boolean
default: true
GNOME-Mini:
description: 'GNOME-Mini'
required: true
type: boolean
default: true
KDE:
description: 'KDE'
required: true
type: boolean
default: true
MATE:
description: 'MATE'
required: true
type: boolean
default: true
XFCE:
description: 'XFCE'
required: true
type: boolean
default: true
version_major:
description: 'AlmaLinux major version'
required: true
default: '10-kitten'
type: choice
options:
- 10-kitten
- 9
- 8
iteration:
description: 'Kitten 10 build iteration'
required: true
default: '0'
store_as_artifact:
description: "Store ISO to the workflow Artifacts"
required: true
type: boolean
default: false
upload_to_s3:
description: "Upload to S3 Bucket"
required: true
type: boolean
default: true
notify_mattermost:
description: "Send notification to Mattermost"
required: true
type: boolean
default: false
jobs:
init-data:
name: Initialize common data
runs-on: ubuntu-latest
outputs:
time_stamp: ${{ steps.time-stamp.outputs.time_stamp }}
steps:
- name: Date+time stamp
id: time-stamp
run: |
# date+time stamp, YYYYMMDDhhmmss
time_stamp=$(date -u '+%Y%m%d%H%M%S')
echo "time_stamp=${time_stamp}" >> $GITHUB_OUTPUT
build-x86_64:
name: ${{ matrix.version }} ${{ matrix.arch }} ${{ matrix.image_type }}
needs: [init-data]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Set image types matrix based on boolean inputs.* with true value
image_type: ${{ fromJSON(format('["{0}", "{1}", "{2}", "{3}", "{4}"]', ( inputs.GNOME && 'GNOME' ), ( inputs.GNOME-Mini && 'GNOME-Mini' ), ( inputs.KDE && 'KDE' ), ( inputs.MATE && 'MATE' ), ( inputs.XFCE && 'XFCE' ) )) }}
version: ${{ fromJSON(format('["{0}"]', inputs.version_major)) }}
arch: [x86_64, x86_64_v2]
exclude:
- image_type: 'false'
- version: 8
arch: x86_64_v2
- version: 9
arch: x86_64_v2
# TODO: the excludes below should be removed when '10-kitten' provides need packages
- version: 10-kitten
arch: x86_64_v2
image_type: KDE
- version: 10-kitten
arch: x86_64_v2
image_type: MATE
- version: 10-kitten
arch: x86_64_v2
image_type: XFCE
# TODO: the excludes below should be removed when EPEL for 10 provides need packages
- version: 10-kitten
arch: x86_64
image_type: KDE
- version: 10-kitten
arch: x86_64
image_type: MATE
- version: 10-kitten
arch: x86_64
image_type: XFCE
env:
RUNNER: github-hosted
TIME_STAMP: ${{ needs.init-data.outputs.time_stamp }}
RESULT_DIR: /sig-livemedia
steps:
- name: Checkout ${{ github.action_repository }}
uses: actions/checkout@v4
- name: Install KVM Packages and Start libvirt
run: |
sudo apt-get -y update
sudo apt-get -y install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo systemctl enable --now libvirtd
sudo adduser "$(id -un)" libvirt
sudo adduser "$(id -un)" kvm
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Install the Vagrant and need plugins
run: |
sudo apt-get -y install vagrant
sudo vagrant plugin install vagrant-reload
sudo vagrant plugin install vagrant-env
sudo vagrant plugin install vagrant-scp
- name: Install Libvirt Plugins
run: |
sudo cp /etc/apt/sources.list /etc/apt/sources.list."$(date +"%F")"
sudo sed -i -e '/^# deb-src.*universe$/s/# //g' /etc/apt/sources.list
sudo apt-get -y update
sudo apt-get -y install nfs-kernel-server
sudo systemctl enable --now nfs-server
sudo apt-get -y build-dep vagrant ruby-libvirt
sudo apt-get -y install ebtables dnsmasq-base
sudo apt-get -y install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
sudo vagrant plugin install vagrant-libvirt
- name: Create 'mnt' Storage Pull
run: |
sudo virsh pool-define-as --name mnt --type dir --target /mnt
sudo virsh pool-autostart mnt
sudo virsh pool-start mnt
sudo virsh pool-list
- name: Run vagrant up
run: |
vm_box='almalinux/${{ inputs.version_major }}'
# TODO: use official Vagrant images when available
if [ "${{ inputs.version_major }}" = "10-kitten" ]; then
vm_box='lkhn/almalinux-kitten'
[ "${{ matrix.arch }}" = "x86_64_v2" ] && vm_box='lkhn/almalinux-kitten-x86-64-v2'
fi
echo vm_box=${vm_box} > .env
cp -av ci/vagrant/Vagrantfile ./
sudo vagrant up --no-tty almalinux
- name: Extend disk space on ${{ env.RESULT_DIR }}
run: |
# Create file-system and mount additional disk inside the VM
sudo vagrant ssh almalinux -c "sudo mkfs.xfs -f /dev/vdb"
sudo vagrant ssh almalinux -c "sudo sh -c 'mkdir -p ${{ env.RESULT_DIR }}; mount /dev/vdb ${{ env.RESULT_DIR }}'"
- uses: ./.github/actions/shared-steps
name: ${{ matrix.version }} ${{ matrix.arch }} ${{ matrix.image_type }}
with:
image_type: ${{ matrix.image_type }}
version_major: ${{ inputs.version_major }}
arch: ${{ matrix.arch }}
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }}
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: ${{ vars.MATTERMOST_CHANNEL }}
iteration: ${{ inputs.iteration }}
store_as_artifact: ${{ inputs.store_as_artifact }}
upload_to_s3: ${{ inputs.upload_to_s3 }}
notify_mattermost: ${{ inputs.notify_mattermost }}
start-aarch64-runner:
name: ${{ inputs.version_major != '8' && format('Runner for {0} {1} {2}', inputs.version_major, matrix.arch, matrix.image_type) || format('{0} aarch64 runner [EXCLUDED]', inputs.version_major) }}
runs-on: ubuntu-latest
needs: [init-data]
strategy:
fail-fast: false
matrix:
# Set image types matrix based on boolean inputs.* with true value
image_type: ${{ fromJSON(format('["{0}", "{1}", "{2}", "{3}", "{4}"]', ( inputs.GNOME && 'GNOME' ), ( inputs.GNOME-Mini && 'GNOME-Mini' ), ( inputs.KDE && 'KDE' ), ( inputs.MATE && 'MATE' ), ( inputs.XFCE && 'XFCE' ) )) }}
version: ${{ fromJSON(format('["{0}"]', inputs.version_major)) }}
arch: [aarch64]
exclude:
- image_type: 'false'
- version: 8
arch: aarch64
# TODO: the excludes below should be removed when EPEL for 10 provides need packages
- version: 10-kitten
arch: aarch64
image_type: KDE
- version: 10-kitten
arch: aarch64
image_type: MATE
- version: 10-kitten
arch: aarch64
image_type: XFCE
steps:
- name: Setup and start the runner
if: ${{ inputs.version_major != '8' }}
id: start-ec2-runner
uses: NextChapterSoftware/[email protected]
with:
github_token: ${{ secrets.GIT_HUB_TOKEN }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ secrets.AWS_REGION }}
ec2_ami_id: ${{ secrets[format('EC2_AMI_ID_AL{0}', ( matrix.version == '10-kitten' && '10_KITTEN' || matrix.version))] }}
ec2_subnet_id: ${{ secrets.EC2_SUBNET_ID}}
ec2_security_group_id: ${{ secrets.EC2_SECURITY_GROUP_ID }}
ec2_instance_type: t4g.medium # 2 vCPU and 4 GiM Memory
ec2_root_disk_size_gb: "24" # override default size which is too small for images
ec2_root_disk_ebs_class: "gp3" # use faster and cheeper storage instead of default 'gp2'
ec2_instance_ttl: 60 # Optional (default is 60 minutes)
ec2_spot_instance_strategy: None # Other options are: SpotOnly, BestEffort, MaxPerformance
ec2_instance_tags: > # Required for IAM role resource permission scoping
[
{"Key": "Project", "Value": "GitHub Actions Self-hosted Runners"}
]
build-aarch64:
name: ${{ inputs.version_major != '8' && format('{0} {1} {2}', inputs.version_major, matrix.arch, matrix.image_type) || format('{0} aarch64 [EXCLUDED]', inputs.version_major) }}
runs-on: ${{ inputs.version_major != '8' && github.run_id || 'ubuntu-latest' }}
if: ${{ always() && contains(join(needs.start-aarch64-runner.result, ','), 'success') }}
needs: [init-data, start-aarch64-runner]
strategy:
fail-fast: false
matrix:
# Set image types matrix based on boolean inputs.* with true value
image_type: ${{ fromJSON(format('["{0}", "{1}", "{2}", "{3}", "{4}"]', ( inputs.GNOME && 'GNOME' ), ( inputs.GNOME-Mini && 'GNOME-Mini' ), ( inputs.KDE && 'KDE' ), ( inputs.MATE && 'MATE' ), ( inputs.XFCE && 'XFCE' ) )) }}
version: ${{ fromJSON(format('["{0}"]', inputs.version_major)) }}
arch: [aarch64]
exclude:
- image_type: 'false'
- version: 8
arch: aarch64
# TODO: the excludes below should be removed when EPEL for 10 provides need packages
- version: 10-kitten
arch: aarch64
image_type: KDE
- version: 10-kitten
arch: aarch64
image_type: MATE
- version: 10-kitten
arch: aarch64
image_type: XFCE
env:
RUNNER: self-hosted
TIME_STAMP: ${{ needs.init-data.outputs.time_stamp }}
RESULT_DIR: /sig-livemedia
steps:
- name: Checkout ${{ github.action_repository }}
if: inputs.version_major != '8'
uses: actions/checkout@v4
- uses: ./.github/actions/shared-steps
name: ${{ matrix.version }} ${{ matrix.arch }} ${{ matrix.image_type }}
if: inputs.version_major != '8'
with:
image_type: ${{ matrix.image_type }}
version_major: ${{ inputs.version_major }}
arch: ${{ matrix.arch }}
S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }}
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: ${{ vars.MATTERMOST_CHANNEL }}
iteration: ${{ inputs.iteration }}
store_as_artifact: ${{ inputs.store_as_artifact }}
upload_to_s3: ${{ inputs.upload_to_s3 }}
notify_mattermost: ${{ inputs.notify_mattermost }}