name: build-image on: push: branches: [main] 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 `. # # 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 # One image at a time: each build takes loop devices, RAM and tens of GiB max-parallel: 1 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 "_.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: Upload image and kickstart as artifact if: github.ref == 'refs/heads/main' uses: actions/upload-artifact@v3 with: name: ${{ matrix.edition }} path: | build/${{ env.DISH }}.img.xz cook/dishes/${{ env.DISH }}.cfg if-no-files-found: error - 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.*