Run CI jobs

Run your CI jobs on your own machine.

CI is the set of automated checks that run when code changes. A worker can run those GitHub Actions jobs for you on a machine you already have.

Before you start

Check three things before you start.

A worker that's approved

Follow the install guide first. sulis-worker doctor should end with Everything checks out.

A workflow that asks for it

Only jobs that ask for runs-on: [self-hosted, sulis] run on the machine. Jobs that ask for anything else stay on GitHub's runners.

Linux with sudo, or a Mac with Homebrew

Linux runs CI itself and needs sudo once. A Mac runs CI in a small Linux VM, which needs Homebrew.

A worker gives CI the same predictable place to run as it gives agents. Read why agents need a worker.

Steps

Set up CI slots for your system.

A slot runs one job at a time. Pick the steps for your system.

On Linux

Run these four commands. They set up one slot. For two to four slots, change SULIS_CI_SLOTS=1.

D="$(~/.sulis/worker-venv/bin/python -c 'import os, sulis.worker as w; print(os.path.join(os.path.dirname(w.__file__), "ci_runner_machinery"))')"
chmod +x "$D"/*.sh
sudo env SULIS_CI_SLOTS=1 bash "$D/setup-root.sh"
sulis-worker restart

On a Mac

Install Colima, the tool that runs the VM. Then ask the worker to set up CI.

brew install colima
sulis-worker install --ci-vm

The terminal prints Starting the CI VM (this takes a few minutes)…. The VM enrols as its own device, named after your Mac with -ci added.

Approve that device in the console, the Sulis web app. Open the address the command prints and choose Confirm.

Check it worked

The health check shows the runner is ready.

Run this on the machine. On a Mac the command prints Done. and the number of CI slots first.

sulis-worker doctor

Look for a line that says CI runner ready, or one line per slot when there are several. A line that starts FAIL is followed by the command to run.

If a step fails

Find your message and apply the fix.

Colima is needed to run the CI VM

Run brew install colima, then sulis-worker install --ci-vm again.

The CI VM did not start

The message ends with the path of Colima's log. Read it, then run sulis-worker install --ci-vm again.

the runner cannot start

This appears in doctor on Linux. Run the four commands under "On Linux" again.

a CI job is running in slot

Setup waits for a running job. Run the setup command again when the job ends.

Remove it

Take CI off the machine.

On Linux

This takes away everything the CI setup added. It leaves the worker installed.

D="$(~/.sulis/worker-venv/bin/python -c 'import os, sulis.worker as w; print(os.path.join(os.path.dirname(w.__file__), "ci_runner_machinery"))')"
sudo bash "$D/setup-root.sh" --remove

On a Mac

This removes the VM and its disk. Then take the -ci device off the Devices screen in the console.

sulis-worker install --ci-vm --remove