Skip to content

Commit

Permalink
.github/workflows/gen-images: add aarch64* live isos, matrixify jobs
Browse files Browse the repository at this point in the history
also simplify environment prep and fix qemu dependencies

the matrix should ensure we never run out of space while building

unfortunately, github limits us to 10 inputs so we can't add a selector
for live iso platforms
  • Loading branch information
classabbyamp committed Dec 27, 2024
1 parent 31b973e commit d90ec88
Showing 1 changed file with 50 additions and 33 deletions.
83 changes: 50 additions & 33 deletions .github/workflows/gen-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
type: boolean
live_archs:
description: "Archs to build live ISOs for"
default: "x86_64 x86_64-musl i686"
default: "x86_64 x86_64-musl i686 aarch64 aarch64-musl"
required: false
type: string
live_flavors:
Expand Down Expand Up @@ -69,6 +69,11 @@ jobs:
datecode: ${{ steps.prep.outputs.datecode }}
revision: ${{ steps.prep.outputs.revision }}
mirror: ${{ steps.prep.outputs.mirror }}
live_archs: ${{ steps.prep.outputs.live_archs }}
live_flavors: ${{ steps.prep.outputs.live_flavors }}
rootfs: ${{ steps.prep.outputs.rootfs }}
platformfs: ${{ steps.prep.outputs.platformfs }}
sbc_imgs: ${{ steps.prep.outputs.sbc_imgs }}

steps:
- name: Prepare Environment
Expand All @@ -82,12 +87,28 @@ jobs:
echo "revision=${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT
echo "mirror=https://repo-ci.voidlinux.org/current" >> $GITHUB_OUTPUT
jsonify() {
sed 's/\s\+/ /g' | jq -Rrc 'split(" ")'
}
echo "live_archs=$(echo "${{ inputs.live_archs }}" | jsonify)" >> $GITHUB_OUTPUT
echo "live_flavors=$(echo "${{ inputs.live_flavors }}" | jsonify)" >> $GITHUB_OUTPUT
echo "rootfs=$(echo "${{ inputs.rootfs }}" | jsonify)" >> $GITHUB_OUTPUT
echo "platformfs=$(echo "${{ inputs.platformfs }}" | jsonify)" >> $GITHUB_OUTPUT
echo "sbc_imgs=$(echo "${{ inputs.sbc_imgs }}" | jsonify)" >> $GITHUB_OUTPUT
build-live-isos:
name: Build Live ISOs
runs-on: ubuntu-latest
needs: prepare
if: ${{ inputs.live_iso_flag }}

strategy:
matrix:
arch: ${{ fromJson(needs.prepare.outputs.live_archs) }}
flavor: ${{ fromJson(needs.prepare.outputs.live_flavors) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
Expand All @@ -105,12 +126,8 @@ jobs:
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
# Install depedencies
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand All @@ -119,15 +136,15 @@ jobs:
make live-iso-all-print live-iso-all \
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
DATECODE="${{ needs.prepare.outputs.datecode }}" \
LIVE_ARCHS="${{ inputs.live_archs }}" LIVE_FLAVORS="${{ inputs.live_flavors }}"
LIVE_ARCHS="${{ matrix.arch }}" LIVE_FLAVORS="${{ matrix.flavor }}"
- name: Prepare artifacts for upload
run: |
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-iso-${{ needs.prepare.outputs.datecode }}
name: void-iso-${{ matrix.arch }}-${{ matrix.flavor }}-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ needs.prepare.outputs.datecode }}/*
if-no-files-found: error
Expand All @@ -138,6 +155,10 @@ jobs:
needs: prepare
if: ${{ inputs.rootfs_flag }}

strategy:
matrix:
arch: ${{ fromJson(needs.prepare.outputs.rootfs) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
Expand All @@ -155,12 +176,8 @@ jobs:
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
# Install depedencies
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand All @@ -169,15 +186,15 @@ jobs:
make rootfs-all-print rootfs-all \
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
DATECODE="${{ needs.prepare.outputs.datecode }}" \
ARCHS="${{ inputs.rootfs }}"
ARCHS="${{ matrix.arch }}"
- name: Prepare artifacts for upload
run: |
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-rootfs-${{ needs.prepare.outputs.datecode }}
name: void-rootfs-${{ matrix.arch }}-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ needs.prepare.outputs.datecode }}/*
if-no-files-found: error
Expand All @@ -188,6 +205,10 @@ jobs:
needs: prepare
if: ${{ inputs.platformfs_flag }}

strategy:
matrix:
platform: ${{ fromJson(needs.prepare.outputs.platformfs) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
Expand All @@ -205,12 +226,8 @@ jobs:
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
# Install depedencies
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand All @@ -219,15 +236,15 @@ jobs:
make platformfs-all-print platformfs-all \
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
DATECODE="${{ needs.prepare.outputs.datecode }}" \
PLATFORMS="${{ inputs.platformfs }}"
PLATFORMS="${{ matrix.platform }}"
- name: Prepare artifacts for upload
run: |
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-platformfs-${{ needs.prepare.outputs.datecode }}
name: void-platformfs-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ needs.prepare.outputs.datecode }}/*
!distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
Expand All @@ -239,6 +256,10 @@ jobs:
needs: prepare
if: ${{ inputs.sbc_img_flag }}

strategy:
matrix:
platform: ${{ fromJson(needs.prepare.outputs.sbc_imgs) }}

container:
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
options: --privileged
Expand All @@ -256,12 +277,8 @@ jobs:
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
/etc/xbps.d/*-repository-*.conf
# Sync and upgrade once, assume error comes from xbps update
xbps-install -Syu || xbps-install -yu xbps
# Upgrade again (in case there was a xbps update)
xbps-install -yu
# Install depedencies
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
xbps-install -Syu xbps && xbps-install -yu
xbps-install -yu bash make git kmod xz lzo qemu-user-arm qemu-user-aarch64 binfmt-support outils dosfstools e2fsprogs
- name: Clone and checkout
uses: classabbyamp/treeless-checkout-action@v1

Expand All @@ -270,15 +287,15 @@ jobs:
make images-all-sbc-print images-all-sbc \
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
DATECODE="${{ needs.prepare.outputs.datecode }}" \
SBC_IMGS="${{ inputs.sbc_imgs }}"
SBC_IMGS="${{ matrix.platform }}"
- name: Prepare artifacts for upload
run: |
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: void-sbc-img-${{ needs.prepare.outputs.datecode }}
name: void-sbc-img-${{ matrix.platform }}-${{ needs.prepare.outputs.datecode }}
path: |
distdir-${{ needs.prepare.outputs.datecode }}/*
!distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
Expand Down

0 comments on commit d90ec88

Please sign in to comment.