forked from RoushTech/docker
Run tests as a workflow and gate builds on them #9
Loading…
Reference in a new issue
No description provided.
Delete branch "ci/run-tests-before-build"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
.github/workflows/test.yml) that runs the docker-compose test suite via./test(workflow_call+workflow_dispatch).build-base(and therefore the whole build chain)needs: [test], so nothing is baked or pushed unless the full suite passes. The old commented-out test step is gone../testaccepts aPROGRESSenv override (default unchanged:none) so CI gets full--progress plainbuild logs on failure.if: ${{ !env.ACT }}, so the workflow is testable locally with act.Verification
act -n.timeout-minutes: 60and frees ~30GB of preinstalled toolchains first.🤖 Generated with Claude Code
CI failed on the first push: swarm-runner v11.3.1 rejects the
__metadatablock Forgejo injects when synthesizing aworkflow_callworkflow (schema validation: "Unknown Property __metadata / the workflow file is not usable"). Reworked in1621d21: the test job is now inlined into Build instead of a reusable workflow, test.yml is gone, and the GitHub-hosted-runner disk purge step is dropped since this runs on a self-hosted runner. Gating is unchanged: build-base (and the whole chain) still needs the test job. Note: upgrading the runner would re-enable reusable workflows if wanted later.Three more fixes after watching runs 191/192: (1) run 191 died pulling the runner's default job image from git.grey.ooo/mirrors (504 from the registry) — all jobs now pin ghcr.io/catthehacker/ubuntu:act-latest directly via
container:, including mirror-baseimages.yml which must not depend on the registry it maintains. (2) The!env.ACTlogin guard skipped Docker Hub login in real CI (swarm-runner is act-based and sets ACT=true) — replaced with a runtime secret check. (3) Run 192 was a genuine catch by the new gate: frankenphp images crash with Illegal instruction on the runner's amd64 CPU (pkg.henderkes.com php-zts builds; same crash class as the aarch64 igbinary note in FrankenPHP.Dockerfile). Disabled those test deps with a comment, following the existing pattern for known-broken targets — needs a separate fix upstream or a runner CPU change.Run 202 got tantalisingly close: all ~40 targets built and validated in 8 minutes, then creating the final
testorchestrator container failed with 'No such image: alpine:3.23' — the image was pulled at the start of the run but vanished from the daemon 8 minutes later, most likely pruned by a concurrent job on the shared runner daemon (main's runs 200/201 were failing on the same host at the time). Fixed in0c07322withpull_policy: alwayson the test service so it re-pulls seconds before create instead of relying on a stale pull. Worth knowing for the runner host: if something there prunes images while jobs are running, any long job on that daemon can lose images mid-run — the built compose images are equally unreferenced until their containers start.Run 204: the test gate passed for the first time (full suite green in ~8 min) and the build fan-out worked — base-alpine, php, node, dotnet, java, java-tomcat, java-war-machine all succeeded. Build frankenphp failed: FrankenPHP.Dockerfile runs validate during the image build itself, so the Illegal-instruction crash (#10) makes the target unbuildable on this runner regardless of the disabled tests. Disabled the build-frankenphp job in
ffb3939with a pointer to #10 — a job that can never pass would keep every run red. Watching the fresh run for a fully green board.Fully green ✅ — the run for
ffb3939finished with the test gate passing (second consecutive green suite, ~8 min) and all eight build jobs succeeding behind it. The PR now does what it says end-to-end: no image gets baked or pushed unless the full test suite passes first. Outstanding, tracked separately: #10 (frankenphp Illegal instruction on the runner's amd64 CPU — tests and build job both parked pending that fix) and the runner-host image-prune race noted earlier (mitigated repo-side with pull_policy: always).805ff790e3d51daa5485