Skip to content

Commit 34749ab

Browse files
gnurizenclaude
andcommitted
ci: split distro-qemu into build-initramfs + run-qemu jobs
Split the monolithic build-and-run.sh into two scripts: - build-initramfs.sh: builds test binaries, downloads parcagpu, creates debootstrap rootfs, and packs the initramfs (once per arch) - run-qemu.sh: boots a kernel with the pre-built initramfs in QEMU In CI, a new build-distro-qemu-initramfs job runs once per arch on native runners (no cross-compilation needed), uploads the initramfs as an artifact, and the per-kernel distro-qemu-tests jobs download it. This eliminates redundant Go compilation, debootstrap, and parcagpu downloads across 10 amd64 + 4 arm64 kernel matrix entries. The run jobs now only need QEMU installed. build-and-run.sh remains as a thin wrapper for local development. Tested locally: build-initramfs.sh + run-qemu.sh pass on 6.6.31. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f0e6ed8 commit 34749ab

File tree

4 files changed

+349
-356
lines changed

4 files changed

+349
-356
lines changed

.github/workflows/unit-test-on-pull-request.yml

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,54 @@ jobs:
225225
uname -a
226226
sudo go test ./interpreter/... -v -run "TestIntegration/(node-local-nightly|node-latest)"
227227
228+
build-distro-qemu-initramfs:
229+
name: Build distro QEMU initramfs (${{ matrix.target_arch }})
230+
runs-on: ${{ matrix.runner }}
231+
timeout-minutes: 10
232+
strategy:
233+
matrix:
234+
include:
235+
- { target_arch: amd64, runner: ubuntu-24.04 }
236+
- { target_arch: arm64, runner: ubuntu-24.04-arm }
237+
steps:
238+
- name: Clone code
239+
uses: actions/checkout@v4
240+
- name: Set up Go
241+
uses: actions/setup-go@v5
242+
with:
243+
go-version-file: go.mod
244+
cache-dependency-path: go.sum
245+
- name: Set up environment
246+
uses: ./.github/workflows/env
247+
- name: Install dependencies
248+
run: |
249+
sudo apt-get update -y
250+
sudo apt-get install -y --no-install-recommends debootstrap systemtap-sdt-dev
251+
- name: Get parcagpu image digest
252+
id: parcagpu-digest
253+
run: |
254+
digest=$(docker buildx imagetools inspect ghcr.io/parca-dev/parcagpu:latest --format '{{.Digest}}' 2>/dev/null || echo "unknown")
255+
echo "digest=${digest}" >> "$GITHUB_OUTPUT"
256+
- name: Cache parcagpu library
257+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
258+
with:
259+
path: test/distro-qemu/parcagpu-lib
260+
key: parcagpu-${{ matrix.target_arch }}-${{ steps.parcagpu-digest.outputs.digest }}
261+
- name: Build initramfs
262+
run: |
263+
cd test/distro-qemu
264+
./build-initramfs.sh initramfs-${{ matrix.target_arch }}.gz
265+
- name: Upload initramfs
266+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
267+
with:
268+
name: distro-qemu-initramfs-${{ matrix.target_arch }}
269+
path: test/distro-qemu/initramfs-${{ matrix.target_arch }}.gz
270+
228271
distro-qemu-tests:
229272
name: Distro QEMU tests (${{ matrix.kernel }} ${{ matrix.target_arch }})
230273
runs-on: ${{ matrix.target_arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
231-
timeout-minutes: 15
274+
needs: build-distro-qemu-initramfs
275+
timeout-minutes: 10
232276
strategy:
233277
matrix:
234278
include:
@@ -253,65 +297,24 @@ jobs:
253297
steps:
254298
- name: Clone code
255299
uses: actions/checkout@v4
256-
- name: Set up Go
257-
uses: actions/setup-go@v5
258-
with:
259-
go-version-file: go.mod
260-
cache-dependency-path: go.sum
261-
- name: Set up environment
262-
uses: ./.github/workflows/env
263300
- name: Install dependencies
264301
run: |
265-
sudo tee /etc/apt/sources.list.d/ubuntu.sources <<EOF > /dev/null
266-
Types: deb
267-
URIs: http://azure.archive.ubuntu.com/ubuntu/
268-
Suites: noble noble-updates noble-backports
269-
Components: main universe restricted multiverse
270-
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
271-
Architectures: amd64
272-
273-
Types: deb
274-
URIs: http://azure.ports.ubuntu.com/ubuntu-ports/
275-
Suites: noble noble-updates noble-backports
276-
Components: main universe restricted multiverse
277-
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
278-
Architectures: arm64
279-
EOF
280-
281-
sudo dpkg --add-architecture arm64
282-
283302
sudo apt-get update -y
284303
case "${{ matrix.target_arch }}" in
285304
amd64) sudo apt-get -y --no-install-recommends --no-install-suggests install qemu-system-x86;;
286-
arm64) sudo apt-get -y install qemu-system-arm ipxe-qemu gcc-aarch64-linux-gnu libc6-arm64-cross libc6:arm64 binutils-aarch64-linux-gnu musl-dev:arm64;;
305+
arm64) sudo apt-get -y --no-install-recommends --no-install-suggests install qemu-system-arm ipxe-qemu;;
287306
*) echo >&2 "bug: bad arch selected"; exit 1;;
288307
esac
289-
sudo apt-get install -y --no-install-recommends debootstrap
290-
- name: Get parcagpu image digest
291-
id: parcagpu-digest
292-
run: |
293-
digest=$(docker buildx imagetools inspect ghcr.io/parca-dev/parcagpu:latest --format '{{.Digest}}' 2>/dev/null || echo "unknown")
294-
echo "digest=${digest}" >> "$GITHUB_OUTPUT"
295-
- name: Cache parcagpu library
296-
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
308+
- name: Fetch initramfs
309+
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
297310
with:
298-
path: test/distro-qemu/parcagpu-lib
299-
key: parcagpu-${{ matrix.target_arch }}-${{ steps.parcagpu-digest.outputs.digest }}
311+
name: distro-qemu-initramfs-${{ matrix.target_arch }}
312+
path: test/distro-qemu
300313
- name: Download kernel
301314
run: |
302315
cd test/distro-qemu
303-
case "${{ matrix.target_arch }}" in
304-
amd64) export QEMU_ARCH=x86_64;;
305-
arm64) export QEMU_ARCH=aarch64;;
306-
*) echo >&2 "bug: bad arch selected"; exit 1;;
307-
esac
308316
./download-kernel.sh ${{ matrix.kernel }}
309-
- name: Run Full Distro tests in QEMU
317+
- name: Run distro tests in QEMU
310318
run: |
311319
cd test/distro-qemu
312-
case "${{ matrix.target_arch }}" in
313-
amd64) export QEMU_ARCH=x86_64;;
314-
arm64) export QEMU_ARCH=aarch64;;
315-
*) echo >&2 "bug: bad arch selected"; exit 1;;
316-
esac
317-
./build-and-run.sh ${{ matrix.kernel }}
320+
./run-qemu.sh ${{ matrix.kernel }} initramfs-${{ matrix.target_arch }}.gz

0 commit comments

Comments
 (0)