1+ name : Build OSVMarchi ISO Images
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ pull_request :
7+ branches : [ main, master ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ build-iso :
12+ runs-on : ubuntu-latest
13+ strategy :
14+ matrix :
15+ include :
16+ - arch : x86_64
17+ name : generic-x86_64
18+ march : x86-64
19+ mtune : generic
20+ - arch : amd64
21+ name : amd64
22+ march : x86-64
23+ mtune : generic
24+ - arch : zen4
25+ name : zen4-optimized
26+ march : znver4
27+ mtune : znver4
28+ - arch : zen5
29+ name : zen5-optimized
30+ march : znver5
31+ mtune : znver5
32+ - arch : epyc
33+ name : epyc-optimized
34+ march : znver2
35+ mtune : znver2
36+ - arch : threadripper
37+ name : threadripper-optimized
38+ march : znver3
39+ mtune : znver3
40+
41+ steps :
42+ - name : Checkout repository
43+ uses : actions/checkout@v4
44+
45+ - name : Set up Docker Buildx
46+ uses : docker/setup-buildx-action@v3
47+
48+ - name : Cache Docker layers
49+ uses : actions/cache@v4
50+ with :
51+ path : /tmp/.buildx-cache
52+ key : ${{ runner.os }}-buildx-${{ matrix.arch }}-${{ github.sha }}
53+ restore-keys : |
54+ ${{ runner.os }}-buildx-${{ matrix.arch }}-
55+ ${{ runner.os }}-buildx-
56+
57+ - name : Install dependencies
58+ run : |
59+ sudo apt-get update
60+ sudo apt-get install -y \
61+ qemu-user-static \
62+ binfmt-support \
63+ arch-install-scripts \
64+ dosfstools \
65+ e2fsprogs \
66+ erofs-utils \
67+ libarchive-tools \
68+ libisoburn1 \
69+ mtools \
70+ squashfs-tools
71+
72+ - name : Create OSVMarchi ISO build environment
73+ run : |
74+ # Create working directory
75+ mkdir -p iso-build/archiso-${{ matrix.arch }}
76+ cd iso-build
77+
78+ # Download archiso profile
79+ git clone https://gitlab.archlinux.org/archlinux/archiso.git
80+ cp -r archiso/configs/releng archiso-${{ matrix.arch }}
81+
82+ # Create custom packages list including OSVMarchi dependencies
83+ cat > archiso-${{ matrix.arch }}/packages.x86_64 << 'EOF'
84+ # Base system
85+ base
86+ base-devel
87+ linux
88+ linux-firmware
89+
90+ # Bootloader and filesystem
91+ syslinux
92+ efibootmgr
93+ dosfstools
94+ e2fsprogs
95+
96+ # Network and utilities
97+ networkmanager
98+ openssh
99+ git
100+ curl
101+ wget
102+
103+ # Development tools
104+ gcc
105+ make
106+ cmake
107+
108+ # OSVMarchi core dependencies (subset of the 118 packages)
109+ hyprland
110+ alacritty
111+ waybar
112+ nvim
113+ fastfetch
114+ btop
115+ docker
116+ docker-compose
117+ nodejs
118+ npm
119+ python
120+ python-pip
121+
122+ # Additional tools for ISO building
123+ archiso
124+ EOF
125+
126+ - name : Configure OSVMarchi integration
127+ run : |
128+ cd iso-build/archiso-${{ matrix.arch }}
129+
130+ # Create airootfs structure
131+ mkdir -p airootfs/etc/systemd/system/multi-user.target.wants
132+ mkdir -p airootfs/etc/osvmarchi
133+ mkdir -p airootfs/usr/local/bin
134+
135+ # Copy OSVMarchi files
136+ cp -r ../../* airootfs/etc/osvmarchi/ || true
137+
138+ # Create OSVMarchi installer service
139+ cat > airootfs/etc/systemd/system/osvmarchi-installer.service << 'EOF'
140+ [Unit]
141+ Description=OSVMarchi Installer Service
142+ After=network-online.target
143+ Wants=network-online.target
144+
145+ [Service]
146+ Type=oneshot
147+ ExecStart=/usr/local/bin/osvmarchi-auto-install
148+ RemainAfterExit=yes
149+ StandardOutput=journal
150+
151+ [Install]
152+ WantedBy=multi-user.target
153+ EOF
154+
155+ # Create auto-installer script
156+ cat > airootfs/usr/local/bin/osvmarchi-auto-install << 'EOF'
157+ #!/bin/bash
158+ # OSVMarchi Auto Installer for ISO
159+
160+ echo "OSVMarchi ISO Image - ${{ matrix.name }}"
161+ echo "Architecture: ${{ matrix.arch }}"
162+ echo "Compiler flags: -march=${{ matrix.march }} -mtune=${{ matrix.mtune }}"
163+ echo
164+ echo "This ISO contains OSVMarchi pre-configured for ${{ matrix.arch }} processors."
165+ echo "Run 'osvmarchi-install' to begin installation on this system."
166+ echo
167+
168+ # Make OSVMarchi available
169+ if [ -d /etc/osvmarchi ]; then
170+ ln -sf /etc/osvmarchi/boot.sh /usr/local/bin/osvmarchi-install
171+ chmod +x /usr/local/bin/osvmarchi-install
172+ fi
173+ EOF
174+
175+ chmod +x airootfs/usr/local/bin/osvmarchi-auto-install
176+
177+ # Enable the service
178+ ln -sf ../osvmarchi-installer.service airootfs/etc/systemd/system/multi-user.target.wants/
179+
180+ - name : Configure architecture-specific optimizations
181+ run : |
182+ cd iso-build/archiso-${{ matrix.arch }}
183+
184+ # Create makepkg.conf with architecture optimizations
185+ cat > airootfs/etc/makepkg.conf << EOF
186+ # Architecture-specific optimizations for ${{ matrix.arch }}
187+ CARCH="x86_64"
188+ CHOST="x86_64-pc-linux-gnu"
189+
190+ # Compiler flags optimized for ${{ matrix.arch }}
191+ CFLAGS="-march=${{ matrix.march }} -mtune=${{ matrix.mtune }} -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
192+ CXXFLAGS="\$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
193+ LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs"
194+ LTOFLAGS="-flto=auto"
195+ RUSTFLAGS="-C opt-level=2 -C target-cpu=${{ matrix.mtune }}"
196+
197+ # Make options
198+ MAKEFLAGS="-j\$(nproc)"
199+
200+ # Package options
201+ OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto)
202+
203+ # Architecture
204+ INTEGRITY_CHECK=(sha256)
205+ BUILDENV=(!distcc color !ccache check !sign)
206+ EOF
207+
208+ - name : Customize ISO profile
209+ run : |
210+ cd iso-build/archiso-${{ matrix.arch }}
211+
212+ # Update profile configuration
213+ sed -i "s/iso_name=\"archlinux\"/iso_name=\"osvmarchi-${{ matrix.name }}\"/" profiledef.sh
214+ sed -i "s/iso_label=\"ARCH_.*\"/iso_label=\"OSVMARCHI_${{ matrix.arch }}\"/" profiledef.sh
215+ sed -i "s/iso_publisher=\"Arch Linux <https:\/\/archlinux.org>\"/iso_publisher=\"OSVMarchi <https:\/\/osvm.archi>\"/" profiledef.sh
216+ sed -i "s/iso_application=\"Arch Linux Live\/Rescue CD\"/iso_application=\"OSVMarchi Live\/Install CD - ${{ matrix.name }}\"/" profiledef.sh
217+
218+ # Set version
219+ echo "$(date +%Y.%m.%d)-${{ matrix.name }}" > airootfs/etc/osvmarchi-version
220+
221+ - name : Build ISO image
222+ run : |
223+ cd iso-build/archiso-${{ matrix.arch }}
224+
225+ # Build the ISO with verbose output
226+ echo "Building ISO for ${{ matrix.arch }} architecture..."
227+ sudo mkarchiso -v -w work -o out . 2>&1 | tee build.log
228+
229+ # Check if build was successful
230+ if [ ${PIPESTATUS[0]} -ne 0 ]; then
231+ echo "ISO build failed!"
232+ cat build.log
233+ exit 1
234+ fi
235+
236+ # Verify ISO was created
237+ if [ ! -d out ] || [ -z "$(ls out/*.iso 2>/dev/null)" ]; then
238+ echo "No ISO file found in output directory!"
239+ ls -la out/ || echo "Output directory does not exist"
240+ exit 1
241+ fi
242+
243+ # Get ISO filename
244+ ISO_FILE=$(ls out/*.iso | head -1)
245+ echo "Built ISO: $ISO_FILE"
246+
247+ # Move to predictable location
248+ sudo mv "$ISO_FILE" "../osvmarchi-${{ matrix.name }}-$(date +%Y%m%d).iso"
249+ sudo chown $USER:$USER "../osvmarchi-${{ matrix.name }}-$(date +%Y%m%d).iso"
250+
251+ - name : Generate checksums
252+ run : |
253+ cd iso-build
254+ ISO_FILE="osvmarchi-${{ matrix.name }}-$(date +%Y%m%d).iso"
255+
256+ # Generate checksums
257+ sha256sum "$ISO_FILE" > "$ISO_FILE.sha256"
258+ md5sum "$ISO_FILE" > "$ISO_FILE.md5"
259+
260+ # Display info
261+ ls -lh "$ISO_FILE"*
262+ echo "SHA256: $(cat $ISO_FILE.sha256)"
263+
264+ - name : Upload ISO artifact
265+ uses : actions/upload-artifact@v4
266+ with :
267+ name : osvmarchi-iso-${{ matrix.name }}
268+ path : |
269+ iso-build/osvmarchi-${{ matrix.name }}-*.iso
270+ iso-build/osvmarchi-${{ matrix.name }}-*.iso.sha256
271+ iso-build/osvmarchi-${{ matrix.name }}-*.iso.md5
272+ retention-days : 30
273+ compression-level : 0 # ISOs are already compressed
274+
275+ - name : Upload build logs
276+ if : failure()
277+ uses : actions/upload-artifact@v4
278+ with :
279+ name : build-logs-${{ matrix.name }}
280+ path : |
281+ iso-build/archiso-${{ matrix.arch }}/work/
282+ retention-days : 7
0 commit comments