Skip to content

Self-hosted CI runners

The fleet serves the run on main (ci.yml), not the pull-request gate. Pull requests and merge-queue entries run pr-gate.yml on GitHub-hosted runners, which are free for this public repository and do not wait behind the fleet; see CI for many agents. The repository variables GATE_RUNNER_JSON and GATE_WINDOWS_RUNNER_JSON move the gate onto the fleet if the hosted pool is queueing. Everything below describes how the run on main chooses between the fleet and GitHub-hosted runners.

The six plain Windows/Linux legs in .github/ci/legs.jsonc, the matrices of the split _ci-windows.yml and _ci-linux.yml (Windows MSVC, Windows LLVM, Linux GCC, Linux LLVM, Linux LLVM ASan+UBSan, Linux LLVM TSan; each has a runner_slot) can each run on a self-hosted runner instead of a GitHub-hosted one - whenever the fleet is online at all, and up to however many runners are online: with enough of the fleet online that means every leg, and the per-leg fan-out only reappears as graceful degradation when most of the fleet is gone (one surviving runner takes one leg, the rest overflow to GitHub-hosted). The fleet launches runners on demand, so how many are online varies. macOS and the arm64 legs always stay on GitHub-hosted runners; there's no self-hosted equivalent for either. ci.yml's own single-leg jobs (Detect changes, and the jobs of the core lane) route the same way through its check-runner job; ADM Module, Hearth Sendspin, the ABI gate and FFmpeg Validate live in _ci-core.yml (docs/ci-lanes.md) but still route through that same decision - ci.yml's core job forwards check-runner's output in as a plain input, since _ci-core.yml's jobs cannot reach across the workflow_call boundary to needs: check-runner directly. The Windows wheel leg routes through a decider of its own in wheels.yml. _build.yml's build-footprint, ESP32-S3 and ESP32-C3 jobs use Linux runner slots 5-7. A run of ci.yml can put up to three Windows consumers (two build legs, the wheel leg) onto the Windows fleet at once. The nightly analysis workflows (codeql.yml, msvc-analysis.yml, static-analysis.yml) have deciders of their own too, but run against main once a night rather than per run of ci.yml - see Nightly analysis window. Several jobs stay on GitHub-hosted deliberately: Coverage (see its own comment in _ci-core.yml for the undiagnosed shutdown-signal failure); build-wasm / build-android / build-rust (they run bare and lean on toolchains the hosted image pre-bakes - emsdk, Android SDK/NDK, rustup - that the fleet image does not; route them only if/when ci-runners bakes those in); the jobs of pr-gate.yml, which run hosted unless GATE_RUNNER_JSON and GATE_WINDOWS_RUNNER_JSON move them; and the wheels workflow's Linux and macOS legs (the fleet's Python has no pip, which cibuildwheel needs before it can do anything - see wheels.yml's own comment).

Control-plane jobs - the check-runner/check-runners deciders in ci.yml, _build.yml, codeql.yml and static-analysis.yml, _toolchain-versions.yml's resolve, the Verify Status aggregator of ci.yml, and dependency-review.yml's Scan dependency diff - route separately, via the repository variable CONTROL_RUNNER_JSON (a runner-label JSON array, e.g. ["self-hosted","Linux","X64"]; unset means ubuntu-latest). These are seconds-long jobs that everything else waits on, and leaving them on the shared hosted pool meant that under saturation a 9-second decider queued for hours behind 25-minute build legs before the run could even choose runners (observed 2026-08-28). Deleting the variable is the kill switch that returns them all to GitHub-hosted - it is evaluated fresh on every run, so a dead self-hosted fleet can never lock the escape hatch shut. The variable is set on this repository. (msvc-analysis.yml's and wheels.yml's own deciders are pinned to ubuntu-latest instead and don't read the variable, and the jobs of pr-gate.yml read GATE_RUNNER_JSON and GATE_WINDOWS_RUNNER_JSON instead: CI for many agents.) Fork PRs are pinned to GitHub-hosted unconditionally in every job of pr-gate.yml, and in ci.yml's and _build.yml's deciders although neither runs on a pull request now: check-runner executes decide-runner from a checkout of the fork's merge ref, which is fork-controlled code (codeql.yml's decider has no pull_request trigger and needs no pin).

This page describes what ICL Forge's CI does with a self-hosted runner once one exists. It does not describe how one comes to exist - the fleet itself (Packer images, provisioning scripts, the org they register against) lives in iainchesworthlabs/ci-runners, a repo shared across every project in the iainchesworthlabs organization rather than owned by this one.

How the decision gets made

A check-runners job runs before the split platform workflows in every run of _build.yml, which ci.yml and release.yml call. It decides a runner-label set for seven Linux consumers (four self-hosted-eligible matrix legs plus build-footprint, ESP32-S3 and ESP32-C3) and two Windows legs. _build.yml passes those labels into the platform workflows, whose matrices use them via runs-on. Per OS, in order:

  1. Fork PRs always get GitHub-hosted, no exceptions and no live check, for every leg. Untrusted code must never land on self-hosted infrastructure - the runners are ephemeral (wiped between every job) but that only bounds damage between jobs, not during one.
  2. An explicit override wins next. Repository variables RUNNER_LINUX_MODE and RUNNER_WINDOWS_MODE accept auto (the default, used whenever the variable is unset), self-hosted, or github-hosted. A forced mode skips the live check entirely and applies to every leg of that OS - if you force self-hosted and nothing is actually online, the job queues and waits, which is the expected cost of an explicit override.
  3. auto counts online runners, then fans legs across both pools. The count comes from up to two API calls, summed, each reading every page of the list (--paginate: the API returns 30 runners a page, and an organisation with 45 once hid all four Windows runners on its second page):
  4. This repo's own registered runners (GET /repos/iainchesworthlabs/iclforge/actions/runners, using the workflow's own GITHUB_TOKEN - no extra setup). Empty, because the fleet is registered at the organisation level, the model ci-runners uses.
  5. iainchesworthlabs's org-level runners (GET /orgs/iainchesworthlabs/actions/runners), only attempted if the repository secret ORG_RUNNERS_TOKEN is set - an org-scoped PAT or GitHub App token with "Self-hosted runners: read". The secret is set on this repository, so this is the count that matters; without it that call is skipped, not an error.

Both counts include every runner that is online - busy or not, deliberately; see the next section - and labelled with both self-hosted and the right OS (Linux or Windows). Of that OS's legs, the first online_count (capped at the leg count) get the self-hosted label set (self-hosted, Linux, X64 / self-hosted, Windows, X64 - the exact labels the ci-runners fleet registers with); the rest get GitHub-hosted (ubuntu-latest / windows-latest). An online count of zero, or the API call itself failing for any reason, sends every leg of that OS to GitHub-hosted - this check being unavailable is never a reason to block CI.

Why the check, not a static switch

An earlier, simpler design (a single repository variable holding the literal runner-label array, the pattern aqualink-automate currently uses) only answers "has someone configured self-hosted for this leg", not "is a self-hosted runner actually able to pick this job up right now". With ci-runners' runners shared across every repo in the org, "configured" and "available" can differ moment to moment, so the live check is what keeps a leg from silently queuing behind another repo's job instead of falling back.

Why online, not idle

The check originally counted runners that were online and not busy - "how many could pick a job up this instant". That predicate is wrong for this fleet, and the failure was measured rather than theorised (2026-08-28): the runners are ephemeral (--ephemeral, one job per registration), so after every job a runner deregisters, resets its workspace, and re-registers - and for that ~10-second recycle window it is absent from the runners API entirely: not busy, not offline, just missing. Under a churn of short jobs (the cheap gate jobs take seconds each) a runner completes a full cycle every ~25 seconds, which left each runner invisible to the count roughly 40% of the time - one runner's supervisor journal showed exactly that. Sampling 13 such runners at one instant therefore reported a small "idle" number while the pool was mostly free, and heavy legs (TSan, the second Windows leg) were spilled onto a GitHub-hosted pool that was hours-deep in queue. The cheaper the gate jobs, the worse the undercount - the opposite of intuition.

Counting online runners - busy included - fixes this: a busy runner proves the fleet is alive and frees up in minutes, and queueing a leg behind it (or behind a 10-second recycle) is far cheaper than hosted starvation. The count is still capped per leg, so the fan-out survives as graceful degradation when most of the fleet is dead: one surviving runner takes one leg and the rest overflow to GitHub-hosted rather than queueing behind a single machine. A fleet that is entirely absent (zero online, busy or not) still sends everything to GitHub-hosted, and the RUNNER_*_MODE variables remain the manual override for anything the heuristic gets wrong.

Measuring whether it's actually worth it

The whole point of this is to find out whether self-hosted is meaningfully faster than GitHub-hosted for ICL Forge's build - not to assume it. With one exception, every leg installs GCC/LLVM/Qt/ffmpeg/Ninja and warms vcpkg's cache identically regardless of which runner it landed on, so a timing comparison between the two is measuring the runner, not a shortcut. The exception is the Windows LLVM leg: its install step checks clang-cl --version first and skips the ~10-minute download/install when the host already carries the exact pinned version - which the fleet's own Packer template now bakes in (see ci-runners' scripts/windows/03-llvm-toolchain.ps1), so that leg's self-hosted timings do include a pre-bake shortcut and should be read accordingly. Wider pre-baking is a reasonable follow-up once there's real data to justify it - not built in advance of that data.

Nightly analysis window

The code-analysis engines - CodeQL (codeql.yml), MSVC Code Analysis / PREfast (msvc-analysis.yml), clang-tidy (static-analysis.yml) and SonarCloud (sonarcloud.yml) - run once a night against main rather than on every push, pull request and merge-queue entry. The first three route through a decide-runner call of their own at that hour (codeql.yml's decider reads CONTROL_RUNNER_JSON the way ci.yml's does; msvc-analysis.yml's is pinned to ubuntu-latest and doesn't read the variable), so the analysis lands on the self-hosted fleet whenever a Linux or Windows runner is online and on GitHub-hosted otherwise. sonarcloud.yml is the exception: it is pinned to GitHub-hosted and never routed, because the CFamily analyser does not fit the fleet's 12 GB guests (its own header carries the measurements). The slot was chosen for a quiet fleet at 02:00 UTC. No workflow here asks for the big label; ICL Forge does not use the big runners. A run that finds something new (or fails) opens or refreshes a nightly-analysis issue through .github/actions/report-nightly-failure - nothing reliably notifies anyone about a new default-branch code-scanning alert (GitHub's documented code-scanning notifications cover alert assignment), so the issue is what makes the finding visible the next morning.

The fleet is shared with aqualink-automate. Scheduled runs are placed so the two repos' heavy legs never share a window, and every cron sits off the top of the hour (GitHub delays on-the-hour schedules). The agreed split: ICL Forge owns 02:00-03:15 UTC on the fleet, and aqualink-automate takes the 04:00 hour (its code-scanning cron is Tuesday 21:42 UTC weekly today, plus per-PR and push runs; the move into 04:xx has not been made yet).

Cron (UTC) Repo Workflow Fleet use
02:17 ICL Forge codeql.yml (C++, JavaScript, Python and Kotlin) Linux
02:23 ICL Forge msvc-analysis.yml (PREfast) Windows
02:29 ICL Forge static-analysis.yml (clang-tidy) Linux
02:35 ICL Forge sonarcloud.yml none (ubuntu-latest)
03:17 ICL Forge fuzz.yml nightly jobs none (hosted)
04:43 ICL Forge interop.yml none (hosted)
13:17 ICL Forge ci.yml, the nightly run: every leg with every extra pass (The tiers) Linux and Windows, plus hosted
Mon 03:45 / 03:50 / 04:00 ICL Forge osv-scanner.yml / zizmor.yml / scorecard.yml none (hosted)
Tue 21:42 / 22:17 / 22:27 / 22:37 aqualink-automate automated-codescanning.yml (CodeQL and MSVC on the big runners; SonarCloud hosted) / trivy / osv / scorecard - weekly today; code scanning is to move to 04:07, the minute that repo picked Linux big, Windows big

These are the cron times. GitHub starts this repository's scheduled workflows hours after them: the CodeQL run for the 02:17 cron began at 08:36 UTC on 2026-09-29 and at 08:44 on 2026-09-28, and the other three analysis runs of each night began within 25 minutes after it, so the spacing between this repository's crons holds while the whole set starts about six and a half hours late. CI for many agents has the measurement and why ci.yml's cron is 6.5 hours before the time the nightly run is wanted. Run times vary with the fleet's load: over the three nights to 2026-09-29 the CodeQL C++ job took 27 to 46 minutes, MSVC analysis 18 to 78, clang-tidy 10 to 15 and SonarCloud 10 to 69, and the nightly fuzz job about 3.5 to 4 hours.

When either repo adds or moves a cron that touches the fleet, update this table and the copy kept in iainchesworthlabs/ci-runners.

SonarCloud setup

sonarcloud.yml is the one nightly that needs configuration outside this repository, and it skips itself with a notice when that is missing rather than failing every night. All of this was done by hand, once, by someone with admin on both sides, and is kept here in case the project has to be set up again:

  1. The project is already onboarded: organisation iainchesworthlabs, project key iainchesworthlabs_ac3forge, which is what sonar-project.properties declares. Note that this is a different SonarCloud organisation from the one aqualink-automate analyses under (iainchesworth), so its settings and token do not carry over.
  2. Project > Administration > Analysis Method: turn Automatic Analysis off. SonarCloud refuses a CI-based analysis while autoscan owns the project, and autoscan cannot read C or C++ from a compile database, so leaving it on means no C++ results at all.
  3. Project > Administration > New Code: set a number of days. 1 matches the nightly cadence; 2 means a skipped night is still caught by the next run. This one matters: the organisation's default is "previous version", which would never advance here because nothing bumps sonar.projectVersion per run - every commit would stay "new code" forever and the quality gate would never settle.
  4. Generate a token (My Account > Security, or a project analysis token) and add it as the repository secret SONAR_TOKEN under Settings > Secrets and variables > Actions. The workflow's preflight job checks for exactly this and skips the scan without it.
  5. Optionally add the quality-gate badge to README.md (it is there). Add it only after the first run: the badge 404s until the project has been analysed once.

The scan runs inside this repository's ubuntu:26.04 container (the sibling runs it directly on the hosted image) and has run every night since SONAR_TOKEN was set on 2026-09-05. If the container ever becomes the problem, the fallback is to build in the container and scan outside it, keeping the compile database's paths consistent between the two.

Toolchain version pins

A runner (self-hosted or GitHub-hosted) picking up a job is one problem; that runner actually having the right versions of the compiler, CMake, Qt, and vcpkg once it does is a separate one. ICL Forge ports the manifest-driven version check aqualink-automate and ci-runners both use, adapted to this repo's own architecture (see Why no separate drift-warning action below for what differs and why).

  1. One manifest, several sources. .github/toolchain-versions.json holds only the three pins that have no other canonical home in this repo: the MSVC toolset prefix (msvc_toolset), the Qt version (qt), and the exact LLVM point release the Windows LLVM leg (_ci-windows.yml) downloads as a win64 installer (llvm_windows_version - Windows has no versioned package to pin against the way apt does, and _toolchain-versions.yml asserts its major matches llvm_version so the two can't silently drift apart). Everything else this repo already pins somewhere is read from that real location instead of being duplicated into the manifest too: GCC/LLVM majors come from .github/toolchain/02-gcc-toolchain.sh and 03-llvm-toolchain.sh (the scripts that actually install them - copied verbatim from ci-runners so the fleet and this repo track the same toolchain), CMake's minimum from CMakePresets.json's cmakeMinimumRequired, and vcpkg's baseline from vcpkg.json's builtin-baseline. _toolchain-versions.yml is a small reusable workflow_call that reads the manifest plus those four other files once and exposes gcc_version / llvm_version / llvm_windows_version / msvc_toolset / qt_version / cmake_min / vcpkg_commit as outputs. Every workflow that used to hardcode a vcpkg-commit: "eaca4a5..." or version: "6.8.3" literal - _build.yml, ci.yml, msvc-analysis.yml, fuzz.yml, codeql.yml, interop.yml - instead calls it as its own toolchain-versions job and reads needs.toolchain-versions.outputs.*. Before this, the vcpkg commit alone was hardcoded independently in nine separate places across five workflow files; bumping it meant finding and editing all nine by hand, with no error if one was missed. Bump a version by editing whichever of the four files actually owns it - nothing else in this repo needs to change.
  2. Runtime assert, on every leg, both runner paths. The "Report and assert toolchain versions" step of the build-leg composite action (.github/actions/build-leg/action.yml, which every leg of ci.yml and both jobs of pr-gate.yml run) runs g++/clang++/ clang-cl --version or reads the MSVC environment's VCToolsVersion, compares it against the matching needs.toolchain-versions.outputs.* pin, and fails the job with an ::error:: annotation on a mismatch. It runs identically whether the leg landed on a self-hosted or GitHub-hosted runner - see the next section for why that is the right severity here, unlike the warn-only check aqualink-automate uses. Two kinds of leg only report: the macOS legs, whose Homebrew LLVM has no versioned pin, and windows-msvc-arm64, whose hosted image ships an older Build Tools generation than the x64 image the pin was resolved against.

Why no separate drift-warning action

aqualink-automate pairs its manifest with a second mechanism, check-toolchain-drift: a composite action that runs only on a self-hosted job, compares the installed compiler against the pin, and warns rather than fails. That shape fits aqualink-automate because its self-hosted legs skip the fresh-install step entirely and build straight against whatever ci-runners' Packer image happened to bake in - a mismatch there means the shared, externally-provisioned image has drifted, which is ci-runners' problem to fix, not a reason to block a PR against unrelated code.

ICL Forge's own design already differs in the one place that matters: every Linux leg runs inside a pinned ubuntu:26.04 container (the leg's container: in _ci-linux.yml, and the gate's Linux job in pr-gate.yml), so GCC/LLVM/Qt/ffmpeg/Ninja are installed fresh into that container on every run, self-hosted or GitHub-hosted alike - the host image's own toolchain, pre-baked or not, is never reachable from inside it. There is no self-hosted-only drift path for those tools to warn about; a mismatch there can only mean this repo's own install step is broken, on both runner types equally, which is exactly what should fail the build immediately. Two legs do depend on whatever the host actually has: Windows MSVC, which this workflow never installs, only asserts - and it already fails on both runner paths today, which is the stricter, appropriate choice for a leg whose bit-exact gold-reference output can depend on the exact toolset - and Windows LLVM, whose install step skips itself only when the host copy already matches the exact pin, so what it accepts is by construction what it would have installed. So the manifest above is ported in full; the separate warn-only self-hosted action is deliberately not, because there is no scenario in this repo where softening the check for self-hosted specifically would be correct. If toolchain pre-baking is ever added per the note above, this call is worth revisiting.