Files
phyllomeos/.gitea/workflows/build-image.yaml
T
Lukas GreveandClaude Opus 5.5 41eb18cc70 ci: build images only on release tags, not on every push to main
A full build of both editions takes ~25 min on the fedora:host runner
(run 237: 10:46-11:10), too costly to repeat on every push to main.
build-image.yaml now triggers only on v*.*.* tags; the tag path already
publishes the image and kickstart as a release, so the main-only
upload-artifact step is dropped. Recipes are still linted and validated
on every push by ci.yml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 13:42:39 +02:00

103 lines
3.2 KiB
YAML

name: build-image
# Only a release tag builds images: a full build takes ~25 min on the runner,
# too costly to repeat on every push to main. Recipes are still linted and
# validated on every push by ci.yml.
on:
push:
tags: ["v*.*.*"]
# Builds raw disk images of the two default-tier editions (see
# cook/recipes_manifest.yaml) with build-image.sh, i.e.
# `livemedia-creator --no-virt --make-disk`. Other tiers (guest, experimental)
# are built on demand with `./build-image.sh --tier <tier>`.
#
# The build job runs on the registered `fedora:host` runner (a Fedora VM, jobs
# run as root), not in a container: --make-disk needs real loop devices and a
# live systemd-udevd. The runner needs lorax-lmc-novirt, qemu-img, make,
# python3-pip, pykickstart and xz installed.
jobs:
validate:
runs-on: fedora
defaults:
run:
shell: bash
container:
image: git.phyllo.me/devops/fedora-runner-image:latest
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Install Python deps
run: pip install -r cook/requirements.txt
- name: Generate, lint, and validate dishes
run: |
cd cook
make all
build-image:
needs: validate
runs-on: fedora
strategy:
fail-fast: false
# NB: Gitea runs every matrix entry as its own task, so `max-parallel`
# does not serialize them; build-image.sh takes a host-wide flock instead.
matrix:
include:
- edition: phyllomeos
root_size: 16384
- edition: phyllomeos-headless
root_size: 8192
defaults:
run:
shell: bash
env:
# /tmp is a small tmpfs on the runner; livemedia-creator writes the whole
# disk image under $TMPDIR
TMPDIR: /var/tmp
steps:
- uses: https://git.phyllo.me/devops/checkout@v5
with:
fetch-depth: 0
- name: Check runner prerequisites
run: |
missing=0
for tool in livemedia-creator qemu-img make pip xz sudo; do
command -v "$tool" >/dev/null || { echo "missing on runner: $tool"; missing=1; }
done
[ -e /dev/loop-control ] || { echo "missing on runner: /dev/loop-control"; missing=1; }
[ "$missing" = 0 ] || exit 1
- name: Install Python deps
run: pip install -r cook/requirements.txt
- name: Build raw image
run: |
# Editions are named "<edition>_<values...>.cfg"; the trailing "_" keeps
# "phyllomeos" from matching "phyllomeos-headless".
(cd cook && make all)
dish="$(basename "$(ls cook/dishes/${{ matrix.edition }}_*.cfg)" .cfg)"
echo "DISH=$dish" >> "$GITHUB_ENV"
./build-image.sh --dish "$dish" --root-size ${{ matrix.root_size }}
xz -T0 "build/$dish.img"
- name: Publish image and kickstart as release
if: startsWith(github.ref, 'refs/tags/')
uses: https://git.phyllo.me/devops/action-gh-release@v2
with:
files: |
build/${{ env.DISH }}.img.xz
cook/dishes/${{ env.DISH }}.cfg
draft: false
prerelease: false
- name: Clean up build products
if: always()
run: rm -rf build /var/tmp/lmc-result.*