-
-
Notifications
You must be signed in to change notification settings - Fork 9
339 lines (306 loc) · 9.64 KB
/
build-katsu.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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
name: Build images (with Katsu)
env:
KATSU_BUILD_TASK_NAME: "Build image"
DNF_PKGS: |
git
xorriso
rpm
limine
systemd
btrfs-progs
e2fsprogs
xfsprogs
dosfstools
grub2
parted
util-linux-core
systemd-container
grub2-efi
uboot-images-armv8
uboot-tools
rustc
qemu-user-static-aarch64
qemu-user-binfmt
qemu-kvm
qemu-img
cargo
systemd-devel
mkpasswd
clang-devel
moby-engine
squashfs-tools
erofs-utils
grub2-tools
grub2-tools-extra
isomd5sum
moby-engine
podman
buildah
katsu
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-41.noarch.rpm
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-41.noarch.rpm
on:
push:
branches: ["um41", "jade/chromebook-fixes"]
workflow_dispatch:
pull_request:
branches: ["um41"]
jobs:
#### BASE IMAGES ####
image:
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64
variant:
- base/base-disk
- flagship/base-disk
- gnome/base-disk
- plasma/base-disk
- xfce/base-disk
- ports/chromebook/sc7180/sc7180
- ports/chromebook/flagship
- ports/chromebook/gnome
- ports/chromebook/plasma
- ports/chromebook/xfce
# TODO: figure out how to get loop devices to work on our ARM runners
exclude:
- arch: aarch64
variant: flagship/flagship-chromebook
- arch: aarch64
variant: gnome/gnome-chromebook
- arch: aarch64
variant: plasma/plasma-chromebook
- arch: aarch64
variant: xfce/xfce-chromebook
- arch: aarch64
variant: ports/chromebook/flagship
- arch: aarch64
variant: ports/chromebook/plasma
- arch: aarch64
variant: ports/chromebook/gnome
- arch: aarch64
variant: ports/chromebook/xfce
- arch: x86_64
variant: ports/chromebook/sc7180/sc7180
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'arm64' }}
container:
image: ghcr.io/terrapkg/builder:f41
# Pass /dev from host to container
# Very hacky, but it works
# Microsoft/Github, if you're reading this,
# I'm sorry.
options: --privileged -v /dev:/dev
steps:
- name: Install dependencies
run: |
dnf up -y
dnf install -y $DNF_PKGS
dnf clean all
- name: Checkout
uses: actions/checkout@v4
- name: sanitize artifact name
run: |
name=$(echo ${{ matrix.variant }} | sed 's/\//-/g')
name=$name-${{ matrix.arch }}
# set github variable
echo artifact=$name >> $GITHUB_ENV
# Get architecture
# e.g. base/base-disk-x86_64 -> x86_64
echo arch=$(echo ${{ matrix.variant }} | cut -d'-' -f3) >> $GITHUB_ENV
- name: ${{ env.KATSU_BUILD_TASK_NAME }}
run: |
rm -rf /etc/rpm/macros.image-language-conf
chcon system_u:object_r:install_exec_t:s0 "$(which katsu)"
pushd katsu
KATSU_LOG=trace katsu -v --output=disk-image "modules/${{ matrix.variant }}-${{ matrix.arch }}.yaml"
mv katsu-work/image/katsu.img katsu-work/image/${{ env.artifact }}.img
# compress image as zst, output as .img.zst
zstd -T0 -19 katsu-work/image/${{ env.artifact }}.img -o katsu-work/image/${{ env.artifact }}.img.zst
popd
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact }}-image
path: katsu/katsu-work/image/*.img.zst
compression-level: 0
live-iso:
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64
variant:
- flagship/flagship-live
- gnome/gnome-live
- plasma/plasma-live
- xfce/xfce-live
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'arm64' }}
container:
image: ghcr.io/terrapkg/builder:f41
# Pass /dev from host to container
# Very hacky, but it works
# Microsoft/Github, if you're reading this,
# I'm sorry.
options: --privileged -v /dev:/dev
steps:
- name: Install dependencies
run: |
dnf up -y
dnf install -y $DNF_PKGS
dnf clean all
- name: sanitize artifact name
run: |
name=$(echo ${{ matrix.variant }} | sed 's/\//-/g')
# set github variable
echo artifact=$name-${{ matrix.arch }} >> $GITHUB_ENV
# Get variant name from path
# e.g. flagship/flagship-live -> flagship
echo variant=$(echo ${{ matrix.variant }} | cut -d'/' -f1) >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: ${{ env.KATSU_BUILD_TASK_NAME }}
run: |
# loop device fix
if [ "$(df -T /dev | tail -1 |cut -f 1 -d ' ')" = "tmpfs" ]; then
mount -t devtmpfs none /dev
fi
rm -rf /etc/rpm/macros.image-language-conf
chcon system_u:object_r:install_exec_t:s0 "$(which katsu)"
pushd katsu
KATSU_KEEP_CHROOT=1 KATSU_LOG=trace katsu -v --output=iso "modules/${{ matrix.variant }}.yaml"
# get the ISO name, and then append the arch
# e.g. flagship-live.iso -> flagship-live-x86_64.iso
# get the ISO name
iso=$(ls *.iso)
# append the arch
mv $iso $(echo $iso | sed "s/.iso/-${{ matrix.arch }}.iso/")
rm -rf katsu-work/
popd
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact }}-iso
path: katsu/*.iso
compression-level: 0
tar:
strategy:
fail-fast: false
matrix:
arch:
- x86_64
- aarch64
variant:
- wsl/wsl
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-latest' || 'arm64' }}
container:
image: ghcr.io/terrapkg/builder:f41
# Pass /dev from host to container
# Very hacky, but it works
# Microsoft/Github, if you're reading this,
# I'm sorry.
options: --privileged -v /dev:/dev
steps:
- name: Install dependencies
run: |
dnf up -y
dnf install -y $DNF_PKGS
dnf clean all
- name: Checkout
uses: actions/checkout@v4
- name: sanitize artifact name
run: |
name=$(echo ${{ matrix.variant }} | sed 's/\//-/g')
name=$name-${{ matrix.arch }}
# set github variable
echo artifact=$name >> $GITHUB_ENV
# Get architecture
# e.g. base/base-disk-x86_64 -> x86_64
echo arch=$(echo ${{ matrix.variant }} | cut -d'-' -f3) >> $GITHUB_ENV
- name: ${{ env.KATSU_BUILD_TASK_NAME }}
run: |
rm -rf /etc/rpm/macros.image-language-conf
chcon system_u:object_r:install_exec_t:s0 "$(which katsu)"
pushd katsu
KATSU_LOG=trace katsu -v --output=fs "modules/${{ matrix.variant }}.yaml"
tar -cJf katsu-work/chroot.tar katsu-work/chroot
mv katsu-work/chroot.tar katsu-work/${{ env.artifact }}.tar
# compress tar as zst, output as .tar.zst
# have an exception for WSL, as it doesn't support zstd
if [ "${{ matrix.variant }}" = "wsl/wsl" ]; then
gzip -9 -c katsu-work/${{ env.artifact }}.tar > katsu-work/${{ env.artifact }}.tar.gz
else
zstd -T0 -19 katsu-work/${{ env.artifact }}.tar -o katsu-work/${{ env.artifact }}.tar.zst
fi
popd
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact }}-tar
path: |
katsu/katsu-work/*.tar.zst
katsu/katsu-work/*.tar.gz
compression-level: 0
#### LIVE ISO PUSH ####
push-image:
runs-on: arm64
container:
image: ghcr.io/terrapkg/builder:f41
environment: production
needs:
- live-iso
- image
- tar
if: github.event_name != 'pull_request'
steps:
- name: Install dependencies
run: |
dnf install -y wget
dnf clean all
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate artifact tree
run: |
set
ls -lR
mkdir -p images
# for folder in artifacts
pack_image() {
file=$1
type=$2
IMAGEDIR=images/$type/ultramarine/41/
mkdir -p $IMAGEDIR
filename=$(basename -- "$file")
# create sha256sum
sha256sum $file > $IMAGEDIR/$filename.sha256sum
mv $file $IMAGEDIR
}
for file in artifacts/*-iso/*; do
# if is file
if [ -f "$file" ]; then
pack_image $file isos
fi
done
for file in artifacts/*-image/*; do
# if is file
if [ -f "$file" ]; then
pack_image $file images
fi
done
for file in artifacts/*-tar/*; do
# if is file
if [ -f "$file" ]; then
pack_image $file images
fi
done
- name: Upload to R2
run: |
wget https://dl.min.io/client/mc/release/linux-arm64/mc
chmod +x ./mc
./mc alias set r2 '${{ secrets.S3_ENDPOINT }}' '${{ secrets.S3_KEY_ID }}' '${{ secrets.S3_SECRET_KEY }}'
./mc mirror --overwrite images 'r2/images'