Due to the cost of running macOS in particular, you might want to run your CI on a machine you have locally.
It’s trivial to setup a self-hosted runner with Pamplejuce.
Install
Go to the Settings
page of your repository and click New self-hosted runner
.
Run the bash commands listed to setup and configure the runner.
Pick a memorable name for your runner like iLoveCheapCI
— you’ll need it later.
Running as a service
You’ll probably want to run the self-hosted runner as a service, starting the runner when your mac boots so it’s always available for jobs.
Run the following from your actions-runner
directory to set it up on mac and start the service:
./svc.sh install
./svc.sh start
Check out the extensive docs.
Changing your yaml
You’ll need to tell GitHub Actions you want to run on your mac instead.
To do this, edit the matrix
section of the config, replacing os: macOS-14
(or whatever you have it set to) with iLoveCheapCI
(whatever your machine name is).
The matrix config will forward that iLoveCheapCI
value to the job’s runs-on
for macOS.
Make sure you have git-lfs installed
This is the git protocol that lets you handle large files efficiently. You’ll need to install it on your local machine.
Via homebrew:
brew install git-lfs
Speed advantages and disadvantages
In addition to being able to use more processing power, self-hosted runners also have the advantage of not recreating the entire VM each run. Any dependencies installed will remain installed.
If you use something like sccache
, it also has the advantage of keeping the cache locally, which will be quite fast.
However, it has the disadvantage of having to reach over the network for all git and CMake dependencies.
Pamplejuce hardcodes the build step to use a max of 4 cores. To use all cores on your machine, remove the --parallel 4
argument in the build
step of the yaml.
Troubleshooting
You might see this issue when signing on macOS:
/usr/bin/security create-keychain -p *** signing_temp.keychain
security: SecKeychainCreate signing_temp.keychain: A keychain with the same name already exists.
Error: The process '/usr/bin/security' failed with exit code 48
Please see the open issue until I resolve in Pamplejuce.
Leave a Reply