perf(ci): fold the matrix job into the image job and stream its output

Computing the distro list no longer justifies a runner of its own: it is
two steps, and the job that consumes them already checks the repository
out. The workflow now occupies one runner instead of seven.

The step also went silent for minutes at a time, printing five pids and
then nothing until every build had finished. Each build's output is piped
through a [distro][HH:MM:SS] stamp as it arrives, so the log shows what is
happening while it happens; tee still files the per-distro logs for the
artifact, and the replay block at the end is gone as duplication.

A pipeline hands $! the pid of tee rather than of the build, which would
have swallowed every failure, so each build runs in a subshell under
pipefail and wait reads that.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-16 21:48:12 +02:00
1 parent 94baeb7502
commit 7d8505c8c3
2 files changed
+22 -41

No files matched your search

+9 -19
View File
@@ -41,25 +41,8 @@ concurrency:
cancel-in-progress: false
jobs:
prepare:
name: 📋 Build Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.out.outputs.matrix }}
image_tag: ${{ steps.out.outputs.image_tag }}
steps:
- uses: actions/checkout@v7.0.0
- name: 📦 Install jq
run: ./scripts/install/apt.sh jq
- name: 🧮 Compute matrix JSON
id: out
run: scripts/github/runner/images_build_outputs.sh "${{ inputs.distros }}" "${{ inputs.image_tag }}"
build:
name: 💿 Image
needs: prepare
runs-on: ubuntu-latest
permissions:
contents: read
@@ -81,6 +64,13 @@ jobs:
persist-credentials: false
allow-unsafe-pr-checkout: ${{ inputs.allow_unsafe_checkout }}
- name: 📦 Install jq
run: ./scripts/install/apt.sh jq
- name: 🧮 Compute the distro list and image tag
id: out
run: scripts/github/runner/images_build_outputs.sh "${{ inputs.distros }}" "${{ inputs.image_tag }}"
- name: 💽 Disk pressure (start)
shell: bash
run: bash scripts/github/runner/disk_pressure_report.sh START
@@ -129,8 +119,8 @@ jobs:
env:
GITHUB_REPOSITORY_OWNER: ${{ steps.owner.outputs.owner }}
BUILD_CONTEXT_DIR: _src
INFINITO_DISTROS: ${{ join(fromJson(needs.prepare.outputs.matrix), ' ') }}
IMAGE_TAG: ${{ needs.prepare.outputs.image_tag }}
INFINITO_DISTROS: ${{ join(fromJson(steps.out.outputs.matrix), ' ') }}
IMAGE_TAG: ${{ steps.out.outputs.image_tag }}
USE_NIX_TOKEN: ${{ !(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) }}
NIX_GITHUB_TOKEN: ${{ github.token }}
MAX_ATTEMPTS: "7"
+13 -22
View File
@@ -12,21 +12,15 @@ if ((${#distros[@]} == 0)); then
read -r -a distros <<<"${INFINITO_DISTROS}"
fi
log_dir="${INFINITO_BUILD_LOG_DIR:-${repo_root}/build/image-logs}"
log_dir="${BUILD_LOG_DIR:-${repo_root}/build/image-logs}"
mkdir -p "${log_dir}"
group_open() {
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
echo "::group::$1"
else
echo "──────── $1 ────────"
fi
}
group_close() {
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
echo "::endgroup::"
fi
stamp() {
local distro="$1"
local line
while IFS= read -r line; do
printf '[%s][%(%H:%M:%S)T] %s\n' "${distro}" -1 "${line}"
done
}
# shellcheck source=scripts/meta/env/load.sh
@@ -48,10 +42,13 @@ for distro in "${distros[@]}"; do
gap="${gap_next}"
fi
MATRIX_DISTRO="${distro}" \
bash "${script_dir}/push.sh" >"${log_dir}/${distro}.log" 2>&1 &
(
set -o pipefail
MATRIX_DISTRO="${distro}" bash "${script_dir}/push.sh" 2>&1 |
stamp "${distro}" |
tee "${log_dir}/${distro}.log"
) &
pids+=("$!")
echo " → ${distro} started as pid $!"
started=$((started + 1))
done
@@ -68,12 +65,6 @@ for pid in "${pids[@]}"; do
index=$((index + 1))
done
for distro in "${distros[@]}"; do
group_open "${distro}"
cat "${log_dir}/${distro}.log" || true # nocheck: shell-or-true -- a missing log must not mask the build verdict below
group_close
done
if ((${#failed[@]} > 0)); then
echo "❌ Failed distros: ${failed[*]}"
exit 1