Skip to content

Commit 3e355a7

Browse files
committed
.github/workflows/gen-images.yml: refactor
for whatever reason, the old workflow was running out of space on the runner. splitting it up into different jobs and combining it at the end fixes that. not 100% optimal because it doesn't reüse the ROOTFS when building PLATFORMFS and PLATFORMFS when building SBC images. I couldn't think of a good way to do that if e.g. generating ROOTFSes was not done in the ROOTFS step. also add checkboxes for each kind of image to make it more ergonomic to generate a subset of images while still keeping the default strings. unfortunately, this means we're at the max number of inputs so something will have to change if we reënable netboot images or something.
1 parent 0a15965 commit 3e355a7

1 file changed

Lines changed: 261 additions & 55 deletions

File tree

.github/workflows/gen-images.yml

Lines changed: 261 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
description: "Override datecode for images"
88
required: false
99
type: string
10-
mirror:
11-
description: "Mirror to use"
12-
default: "https://repo-ci.voidlinux.org/current"
13-
required: false
14-
type: string
10+
live_iso_flag:
11+
description: "Build live ISOs"
12+
default: true
13+
required: true
14+
type: boolean
1515
live_archs:
1616
description: "Archs to build live ISOs for"
1717
default: "x86_64 x86_64-musl i686"
@@ -22,16 +22,31 @@ on:
2222
default: "base xfce"
2323
required: false
2424
type: string
25+
rootfs_flag:
26+
description: "Build ROOTFSes"
27+
default: true
28+
required: true
29+
type: boolean
2530
rootfs:
2631
description: "Archs to build ROOTFSes for"
2732
default: "x86_64 x86_64-musl i686 armv6l armv6l-musl armv7l armv7l-musl aarch64 aarch64-musl"
2833
required: false
2934
type: string
35+
platformfs_flag:
36+
description: "Build PLATFORMFSes"
37+
default: true
38+
required: true
39+
type: boolean
3040
platformfs:
3141
description: "Platforms to build PLATFORMFSes for"
3242
default: "rpi-armv6l rpi-armv6l-musl rpi-armv7l rpi-armv7l-musl rpi-aarch64 rpi-aarch64-musl"
3343
required: false
3444
type: string
45+
sbc_img_flag:
46+
description: "Build SBC Images"
47+
default: true
48+
required: true
49+
type: boolean
3550
sbc_imgs:
3651
description: "Platforms to build SBC images for"
3752
default: "rpi-armv6l rpi-armv6l-musl rpi-armv7l rpi-armv7l-musl rpi-aarch64 rpi-aarch64-musl"
@@ -42,89 +57,280 @@ concurrency:
4257
group: ${{ github.workflow }}-${{ github.ref }}
4358
cancel-in-progress: true
4459

60+
defaults:
61+
run:
62+
shell: bash
63+
4564
jobs:
46-
build:
47-
name: Build
65+
prepare:
66+
name: Prepare Environment
4867
runs-on: ubuntu-latest
68+
outputs:
69+
datecode: ${{ steps.prep.outputs.datecode }}
70+
revision: ${{ steps.prep.outputs.revision }}
71+
mirror: ${{ steps.prep.outputs.mirror }}
4972

50-
defaults:
51-
run:
52-
shell: bash
73+
steps:
74+
- name: Prepare Environment
75+
id: prep
76+
run: |
77+
if [ -z "${{ inputs.datecode }}" ]; then
78+
echo "datecode=$(date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
79+
else
80+
echo "datecode=${{ inputs.datecode }}" >> $GITHUB_OUTPUT
81+
fi
82+
echo "revision=${GITHUB_SHA:0:8}" >> $GITHUB_OUTPUT
83+
echo "mirror=https://repo-ci.voidlinux.org/current" >> $GITHUB_OUTPUT
84+
85+
build-live-isos:
86+
name: Build Live ISOs
87+
runs-on: ubuntu-latest
88+
needs: prepare
89+
if: ${{ inputs.live_iso_flag }}
5390

5491
container:
55-
image: 'ghcr.io/void-linux/void-linux:20230204RC01-full-x86_64'
92+
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
5693
options: --privileged
5794
volumes:
5895
- /dev:/dev
5996
env:
6097
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
61-
DATECODE: "${{ inputs.datecode }}"
62-
LIVE_ARCHS: "${{ inputs.live_archs }}"
63-
LIVE_FLAVORS: "${{ inputs.live_flavors }}"
64-
ROOTFS_ARCHS: "${{ inputs.rootfs }}"
65-
PLATFORMS: "${{ inputs.platformfs }}"
66-
SBC_IMGS: "${{ inputs.sbc_imgs }}"
67-
REPO: "${{ inputs.mirror }}"
98+
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
6899

69100
steps:
70101
- name: Prepare container
71102
shell: sh
72103
run: |
73-
# Switch to repo-ci mirror
104+
# Switch to mirror
74105
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
75-
sed -i 's|https://repo-default.voidlinux.org/current|'"$REPO"'|g' /etc/xbps.d/*-repository-*.conf
106+
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
107+
/etc/xbps.d/*-repository-*.conf
76108
# Sync and upgrade once, assume error comes from xbps update
77109
xbps-install -Syu || xbps-install -yu xbps
78110
# Upgrade again (in case there was a xbps update)
79111
xbps-install -yu
80112
# Install depedencies
81113
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
82-
83114
- name: Clone and checkout
84115
uses: classabbyamp/treeless-checkout-action@v1
85-
- name: Prepare environment
86-
run: |
87-
echo "DATECODE=$(date -u "+%Y%m%d")" >> $GITHUB_ENV
88-
echo "MKLIVE_REV=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
116+
89117
- name: Build live ISOs
90118
run: |
91-
if ! [[ "$LIVE_ARCHS" = "none" || "$LIVE_FLAVORS" = "none" ]]; then
92-
make live-iso-all{-print,} \
93-
LIVE_ARCHS="$LIVE_ARCHS" LIVE_FLAVORS="$LIVE_FLAVORS" \
94-
SUDO= REPOSITORY="$REPO" DATECODE=$DATECODE
95-
else
96-
echo "Nothing to do..."
97-
fi
119+
make live-iso-all-print live-iso-all \
120+
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
121+
DATECODE="${{ needs.prepare.outputs.datecode }}" \
122+
LIVE_ARCHS="${{ inputs.live_archs }}" LIVE_FLAVORS="${{ inputs.live_flavors }}"
123+
124+
- name: Prepare artifacts for upload
125+
run: |
126+
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
127+
- name: Upload artifacts
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: void-iso-${{ needs.prepare.outputs.datecode }}
131+
path: |
132+
distdir-${{ needs.prepare.outputs.datecode }}/*
133+
if-no-files-found: error
134+
135+
build-rootfs:
136+
name: Build ROOTFSes
137+
runs-on: ubuntu-latest
138+
needs: prepare
139+
if: ${{ inputs.rootfs_flag }}
140+
141+
container:
142+
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
143+
options: --privileged
144+
volumes:
145+
- /dev:/dev
146+
env:
147+
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
148+
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
149+
150+
steps:
151+
- name: Prepare container
152+
shell: sh
153+
run: |
154+
# Switch to mirror
155+
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
156+
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
157+
/etc/xbps.d/*-repository-*.conf
158+
# Sync and upgrade once, assume error comes from xbps update
159+
xbps-install -Syu || xbps-install -yu xbps
160+
# Upgrade again (in case there was a xbps update)
161+
xbps-install -yu
162+
# Install depedencies
163+
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
164+
- name: Clone and checkout
165+
uses: classabbyamp/treeless-checkout-action@v1
166+
98167
- name: Build ROOTFSes
99168
run: |
100-
if ! [ "$ROOTFS_ARCHS" = "none" ]; then
101-
make rootfs-all{-print,} \
102-
SUDO= ARCHS="$ROOTFS_ARCHS" REPOSITORY="$REPO" DATECODE=$DATECODE
103-
else
104-
echo "Nothing to do..."
105-
fi
169+
make rootfs-all-print rootfs-all \
170+
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
171+
DATECODE="${{ needs.prepare.outputs.datecode }}" \
172+
ARCHS="${{ inputs.rootfs }}"
173+
174+
- name: Prepare artifacts for upload
175+
run: |
176+
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
177+
- name: Upload artifacts
178+
uses: actions/upload-artifact@v4
179+
with:
180+
name: void-rootfs-${{ needs.prepare.outputs.datecode }}
181+
path: |
182+
distdir-${{ needs.prepare.outputs.datecode }}/*
183+
if-no-files-found: error
184+
185+
build-platformfs:
186+
name: Build PLATFORMFSes
187+
runs-on: ubuntu-latest
188+
needs: prepare
189+
if: ${{ inputs.platformfs_flag }}
190+
191+
container:
192+
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
193+
options: --privileged
194+
volumes:
195+
- /dev:/dev
196+
env:
197+
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
198+
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
199+
200+
steps:
201+
- name: Prepare container
202+
shell: sh
203+
run: |
204+
# Switch to mirror
205+
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
206+
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
207+
/etc/xbps.d/*-repository-*.conf
208+
# Sync and upgrade once, assume error comes from xbps update
209+
xbps-install -Syu || xbps-install -yu xbps
210+
# Upgrade again (in case there was a xbps update)
211+
xbps-install -yu
212+
# Install depedencies
213+
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
214+
- name: Clone and checkout
215+
uses: classabbyamp/treeless-checkout-action@v1
216+
106217
- name: Build PLATFORMFSes
107218
run: |
108-
if ! [ "$PLATFORMS" = "none" ]; then
109-
make platformfs-all{-print,} \
110-
SUDO= PLATFORMS="$PLATFORMS" REPOSITORY="$REPO" DATECODE=$DATECODE
111-
else
112-
echo "Nothing to do..."
113-
fi
114-
- name: Build SBC images
219+
make platformfs-all-print platformfs-all \
220+
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
221+
DATECODE="${{ needs.prepare.outputs.datecode }}" \
222+
PLATFORMS="${{ inputs.platformfs }}"
223+
224+
- name: Prepare artifacts for upload
115225
run: |
116-
if ! [ "$SBC_IMGS" = "none" ]; then
117-
make images-all-sbc{-print,} \
118-
SUDO= SBC_IMGS="$SBC_IMGS" REPOSITORY="$REPO" DATECODE=$DATECODE
119-
else
120-
echo "Nothing to do..."
121-
fi
226+
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
227+
- name: Upload artifacts
228+
uses: actions/upload-artifact@v4
229+
with:
230+
name: void-platformfs-${{ needs.prepare.outputs.datecode }}
231+
path: |
232+
distdir-${{ needs.prepare.outputs.datecode }}/*
233+
!distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
234+
if-no-files-found: error
235+
236+
build-sbc-img:
237+
name: Build SBC Images
238+
runs-on: ubuntu-latest
239+
needs: prepare
240+
if: ${{ inputs.sbc_img_flag }}
241+
242+
container:
243+
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
244+
options: --privileged
245+
volumes:
246+
- /dev:/dev
247+
env:
248+
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
249+
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
250+
251+
steps:
252+
- name: Prepare container
253+
shell: sh
254+
run: |
255+
# Switch to mirror
256+
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
257+
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
258+
/etc/xbps.d/*-repository-*.conf
259+
# Sync and upgrade once, assume error comes from xbps update
260+
xbps-install -Syu || xbps-install -yu xbps
261+
# Upgrade again (in case there was a xbps update)
262+
xbps-install -yu
263+
# Install depedencies
264+
xbps-install -yu bash make git kmod xz lzo qemu-user-static outils dosfstools e2fsprogs
265+
- name: Clone and checkout
266+
uses: classabbyamp/treeless-checkout-action@v1
267+
268+
- name: Build SBC Images
269+
run: |
270+
make images-all-sbc-print images-all-sbc \
271+
SUDO= REPOSITORY="${{ needs.prepare.outputs.mirror }}" \
272+
DATECODE="${{ needs.prepare.outputs.datecode }}" \
273+
SBC_IMGS="${{ inputs.sbc_imgs }}"
274+
275+
- name: Prepare artifacts for upload
276+
run: |
277+
make dist DATECODE="${{ needs.prepare.outputs.datecode }}"
278+
- name: Upload artifacts
279+
uses: actions/upload-artifact@v4
280+
with:
281+
name: void-sbc-img-${{ needs.prepare.outputs.datecode }}
282+
path: |
283+
distdir-${{ needs.prepare.outputs.datecode }}/*
284+
!distdir-${{ needs.prepare.outputs.datecode }}/*ROOTFS*
285+
!distdir-${{ needs.prepare.outputs.datecode }}/*PLATFORMFS*
286+
if-no-files-found: error
287+
288+
merge-artifacts:
289+
name: Combine artifacts
290+
runs-on: ubuntu-latest
291+
if: ${{ always() }}
292+
needs:
293+
- prepare
294+
- build-live-isos
295+
- build-rootfs
296+
- build-platformfs
297+
- build-sbc-img
298+
299+
container:
300+
image: 'ghcr.io/void-linux/void-glibc-full:20231230R1'
301+
env:
302+
PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
303+
MKLIVE_REV: "${{ needs.prepare.outputs.revision }}"
304+
305+
steps:
306+
- name: Prepare container
307+
shell: sh
308+
run: |
309+
# Switch to mirror
310+
mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
311+
sed -i 's|https://repo-default.voidlinux.org/current|'"${{ needs.prepare.outputs.mirror }}"'|g' \
312+
/etc/xbps.d/*-repository-*.conf
313+
# Sync and upgrade once, assume error comes from xbps update
314+
xbps-install -Syu || xbps-install -yu xbps
315+
# Upgrade again (in case there was a xbps update)
316+
xbps-install -yu
317+
# Install depedencies
318+
xbps-install -yu bash make git outils
319+
- name: Clone and checkout
320+
uses: classabbyamp/treeless-checkout-action@v1
321+
322+
- name: Download artifacts
323+
uses: actions/download-artifact@v4
324+
with:
325+
path: distdir-${{ needs.prepare.outputs.datecode }}
326+
merge-multiple: true
122327
- name: Prepare artifacts for upload
123328
run: |
124-
make dist checksum DATECODE=$DATECODE
329+
make checksum DATECODE="${{ needs.prepare.outputs.datecode }}"
125330
- name: Upload artifacts
126-
uses: actions/upload-artifact@v3
331+
uses: actions/upload-artifact@v4
127332
with:
128-
name: void-live-${{ env.DATECODE }}
129-
path: distdir-${{ env.DATECODE }}/*
333+
name: void-live-${{ needs.prepare.outputs.datecode }}
334+
path: |
335+
distdir-${{ needs.prepare.outputs.datecode }}/*
130336
if-no-files-found: error

0 commit comments

Comments
 (0)