CI on ReviewOS
On this page 6
Postline's CI and its desktop release run on ReviewOS,
not on GitHub Actions. The code stays on GitHub: ReviewOS mirrors the
repository, runs .reviewos/workflows on every commit and tag the mirror
fetches, and posts the verdict back to the commit as the status
"ReviewOS / CI".
| File | Runs |
|---|---|
.reviewos/workflows/ci.yml | lint, type check, test, on every push and pull request |
.reviewos/workflows/release.yml | builds and publishes the DMG for an approved v* tag with passing CI, on manual dispatch |
.reviewos/workflows/deploy.yml | deploys a passing main commit or rolls back Postline's server, on manual dispatch |
Every job runs on Postline's own Mac runner, labelled
[self-hosted, macos-arm64, postline]. A runner takes a job only when it
carries every label the job asks for.
ReviewOS reads .reviewos/workflows in place of .github/workflows when the
directory exists, so nothing under .github/workflows runs there.
Reading a run
reviewos runs --repo stacks/postline
reviewos watch <run-number> --repo stacks/postline
reviewos logs <run-number> --repo stacks/postline --job test
reviewos run ci.yml --ref main --watch --repo stacks/postline
reviewos login signs the CLI in once; the token is kept in the keychain.
What the workflows assume
- No checkout step. The runner checks the commit out before the first step.
- Bun from Pantry. Each job starts with the Pantry action, pinned to a full commit. The runners refuse an action that is not pinned.
- SQLite for tests. A runner has no
.env, so the test job setsDB_CONNECTION=sqliteand migrates a fresh database before the suite. - The release publishes to GitHub by name. Inside a ReviewOS job
GITHUB_TOKEN,GITHUB_API_URLandGITHUB_REPOSITORYare ReviewOS's. The publish step sets the last two to GitHub's and uses theGH_RELEASE_TOKENsecret.
How it is set up
Recorded so it can be repeated on another machine. All of it is done.
-
The mirror.
mirrors.ymlin the ReviewOS repository listsstacksjs/postlinewithci: true; the instance applies it on every deploy (buddy mirror:apply mirrors.yml). -
The Mac runner, registered on the instance host for this repository alone:
./buddy runner:local --register --repository stacks/postline --name postline-macos-arm64 --labels self-hosted,macos-arm64,postlineOn the Mac it lives in
~/.local/share/reviewos/postline/: thereviewos-runnerbinary,runner.token(mode 0600) andstart.sh, kept running by the LaunchAgentorg.reviewos.postline-runner. Running the command again rotates the token.
The release publishes with the repository secret GH_RELEASE_TOKEN in
ReviewOS, a GitHub token with contents: write on stacksjs/postline. It is
set; v0.1.0 and v0.1.1 were released with it.
Checking on the runner
launchctl list | grep org.reviewos.postline-runner
tail -f ~/.local/share/reviewos/postline/runner.log
"Waiting for work" is healthy. "Runner capacity hold" names what it is short of. The runner needs 8 GB of free disk before it takes a job, and this Mac has run close to that.
Deploying the public site
The production environment uses the Postline runner's SSH identity for the
shared Hetzner server. ReviewOS also needs the site's
DOTENV_PRIVATE_KEY_PRODUCTION and a Hetzner token that can read the attached
server's inventory. The production environment is limited to main. DNS for
both Postline hostnames is managed in Porkbun.
reviewos run deploy.yml --repo stacks/postline --ref main --input operation=deploy --watch
This workflow checks the selected commit's ReviewOS / CI verdict before
deploying. It probes the public API and the short hostname after deployment.
If deployment or verification fails, it asks Stacks to roll back only sites
that switched to the failed release. To request the previous release manually,
dispatch the same workflow with operation=rollback.
The Mac runner and load
A runner can hold new work while the machine is busy:
REVIEWOS_RUNNER_MAX_LOAD_PER_CPU, compared with the one-minute load average
per CPU. Postline's runner sets it to 6, and both extremes are why.
- Too low refuses everything. On macOS the load average is a poor measure
of headroom: this Mac idles at 20 to 39 on 11 CPUs while
topreports the CPUs 40% idle. The other runners here use 1.5 per CPU, and one of them logged "Runner capacity hold" 9,905 times. - No limit loses jobs. With none, a lint job was taken while another runner had the load at 300. It could not renew its lease in time and the instance cancelled it: "The instance did not renew this job before its lease expired". That is a busy machine, not a broken workflow; run it again.
6 per CPU (66 here) passes the first case and holds for the second.