Every pull request now builds the package directories it touches on ephemeral DigitalOcean droplets, and every merge to master publishes the resulting artifacts into the channels each package belongs to. The repository host's timers become the fallback rather than the pipeline. Build (.github/workflows/build-pr.yml) One job per package per architecture, always against edge. The artifact is labelled with the package directory's git tree hash. Tooling (bin/, helpers/, build/) is checked out from the base branch; the PR supplies only pkgbuilds/, so a PR can change what is built, never how. Builds run only for trusted authors: collaborators, .github/VOUCHED.td, or a PR carrying the build-approved label. A single required check, result, aggregates the matrix. Publish (.github/workflows/publish.yml, bin/publish-artifact) One job per merge. It collects the PR artifacts for the merged tree, builds anything that has none, then walks each channel/architecture slot once: pull that database, repo-add every package that belongs in it, upload packages, signatures, then the database. A published filename is immutable; identical bytes under an existing name only gain a database entry, different bytes are refused. Fast-ring packages reach edge, rc and stable in the same run from the same file. Matrix (bin/build-matrix) Package x architecture, with the channels the artifact ships to, decided by package_builds_for_mirror so CI and the host agree. arch=any packages build once and land in every architecture database. Builder (build/build.sh, bin/build, build/Dockerfile) With no local published tree, plan against and resolve from the public channel over HTTPS. PACKAGER is set to Omarchy. rclone is in the image. Runners (ci/) A controller droplet polls GitHub with curl and creates one g5 droplet per queued job from cloud-init, deleting them when off or over-age. Builders carry QEMU with credential support for aarch64. Operator SSH keys come from GitHub. tests/controller.sh and tests/publish-artifact.sh cover the decisions against fixtures and real makepkg output. Tests run on pull requests only; branch protection requires result, self-tests and build-isolation with up-to-date branches.
55 lines
2.6 KiB
Bash
Executable File
55 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Print the PR build matrix for a set of package directories as JSON: one
|
|
# entry per package per supported architecture. Every package builds exactly
|
|
# once, against edge, and that one artifact is what every channel ships:
|
|
# channels are databases over a shared pool of files, and a filename must
|
|
# mean one set of bytes. "channels" lists where the artifact is published on
|
|
# merge: edge for everything, plus rc and stable immediately for the fast
|
|
# ring. Eligibility comes from package_builds_for_mirror, the rule the
|
|
# release host uses, so CI and the host cannot disagree.
|
|
#
|
|
# Usage: build-matrix [--arch <arch>|all] <package>...
|
|
# Reads package names on stdin when none are given. With no --arch, every
|
|
# architecture in CI_ARCHES (default "x86_64 aarch64") the package supports.
|
|
# Output: {"include":[{"package":"x","arch":"x86_64","channels":"edge rc stable","publish_arches":"x86_64"},...]}
|
|
# arch is where it builds; publish_arches lists every architecture
|
|
# database the file goes into (all of them for arch=any).
|
|
set -euo pipefail
|
|
BUILD_ROOT=$(realpath "${BASH_SOURCE[0]%/*}/..")
|
|
source "$BUILD_ROOT/helpers/paths.sh"
|
|
source "$BUILD_ROOT/helpers/package-metadata.sh"
|
|
|
|
ARCHES=${CI_ARCHES:-x86_64 aarch64}
|
|
if [[ "${1:-}" == --arch ]]; then [[ $2 == all ]] || ARCHES=$2; shift 2; fi
|
|
for a in $ARCHES; do require_valid_arch "$a"; done
|
|
|
|
if (( $# )); then names=("$@"); else mapfile -t names; fi
|
|
|
|
entries=()
|
|
for name in "${names[@]}"; do
|
|
[[ -n "$name" ]] || continue
|
|
pkgdir="$PKGBUILDS_DIR/$name"
|
|
[[ -d "$pkgdir" ]] || continue
|
|
# skip_build packages still build on their own PR (explicit --package
|
|
# semantics); the host's unscoped runs are what skip them.
|
|
channels=""
|
|
for mirror in $VALID_MIRRORS; do
|
|
package_builds_for_mirror "$pkgdir" "$mirror" && channels="$channels $mirror"
|
|
done
|
|
channels=${channels# }
|
|
[[ -n "$channels" ]] || continue
|
|
# An arch=any package produces one architecture-independent file, so it
|
|
# builds once, on the first architecture, and that file serves every
|
|
# channel database of every architecture.
|
|
if [[ " $(package_arches "$pkgdir" "${ARCHES%% *}") " == *" any "* ]]; then
|
|
entries+=("$(jq -nc --arg p "$name" --arg a "${ARCHES%% *}" --arg c "$channels" --arg pa "$ARCHES" '{package:$p, arch:$a, channels:$c, publish_arches:$pa}')")
|
|
continue
|
|
fi
|
|
for arch in $ARCHES; do
|
|
package_supports_arch "$pkgdir" "$arch" || continue
|
|
entries+=("$(jq -nc --arg p "$name" --arg a "$arch" --arg c "$channels" '{package:$p, arch:$a, channels:$c, publish_arches:$a}')")
|
|
done
|
|
done
|
|
|
|
printf '%s\n' "${entries[@]}" | jq -sc '{include: .}'
|