Continuous Integration
The aim is to have an ultra fast and simple CI.
The CI is powered by github actions and the aims are:
- Full CI run should only take 1 min for the entire monorepo.
- CI costs should happily fit inside githubs free tier. That’s 2000 minutes a month. However none of these minutes are currently used as this is a public repo and runs are not counted towards this total.
- Try and use some of the new generation of Rust based tools to keep every stage as fast as possible.
Mandatory Checks
The main branch is protected and requires all merges to come via a pull request (PR). Before the PR is merged the CI is run and in the github settings for branch protection the ‘Main CI’ has to successfully pass. The UI is a bit confusing, to add a CI job it must be ‘named’. See the snippet below for an example.
The CI is powered by Dependabot is enabled on the repo and runs everyday. In general the number of dependencies is kept as low as possible. However the aim is to only have items updated on a weekly basis.
Sonarqube offers a free tier for public projects and runs as a quality gate on every PR.
Oracle Cloud VM setup
Oracle Cloud’s free tier is used to host a linux VM running a Turborepo remote cache. The VM is simply configured to use the free AMD x64 instance and the Ubuntu 22.10 image. I did try the Oracle Linux image and found it to be slow and unreliable. The VM would often get stuck.
If the VM needs to be recreated the following steps are required.
- Terminate the old VM. It will hang around a few hours till Oracle remove it.
- Create a new free tier x64 based Ubuntu image.
- Opt to have Oracle create the public/private keys and download them.
- To use the private key you need to change its permissions e.g
chmod 400 ssh-key-2024-03-11.key
- SSH into the new VM e.g.
ssh -i ssh-key-2024-03-11.key ubuntu@<ip address>
- sudo apt-get update
- sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Install nano
sudo apt-get install nano
- create a .env file
nano .env
- Add the following to the .env and save it
Make sure sudo docker run --restart always -d --env-file=.env -p 3000:3000 ducktors/turborepo-remote-cache
15. Update the github actions and dependabot secrets with the new URL. NOTE!!! don’t have a trailing slash at the end of the url e.g. use http://<ip address>:3000
not http://<ip address>:3000/
as some versions of turborepo fail to work with the trailing slash.