CI/CD
What is CI/CD?
CI/CD (which stands for Continuous Integration, Continuous Delivery/Deployment) is, in theory, exactly what it says on the tin.
Continuous Integration
Continuous Integration refers to frequently (and automatically) uploading and merging code to the main repository. This keeps code merges small (reducing the chances and sizes of merge conflicts), and therefore more manageable. However, that's only one part of code integration - the other is continuous and automated testing. CI/CD is only made possible by continuous and automated builds and tests which run every time code is pushed to the main repository.
Continuous Delivery
Continuous Delivery refers to the project always being delivered in a functional, ready-to-go state, and handles any final stages needed to package the project and get it into a deployment ready state. Since this project is built with Nix, all dependencies are fixed and known ahead of time, so there's nothing extra to do here.
Continuous Deployment
Continuous Deployment is exactly what it sounds like - automatically deploying a project to production after the continuous delivery process of the pipeline finishes its build. For this project, we aren't employing continuous deployment for anything but the docs website - see below for details on that.
Execution
The CI/CD pipeline for this project is run entirely using GitHub Actions. The typical workflow looks something like this:
- Check out the repo with
actions/checkout - Install Nix with
cachix/install-nix-action - Set up Nix output caching with
cachix/cachix-action - Build the environment and run all tests using
devenv --profile cicd test1 - If that succeeds, the builds are passing!
- Upload to Cachix so we can just download the builds next time
If you're curious about any specific workflow, they're all well commented.
-
This profile inherits from all the others, so it builds everything. ↩