Skip to content

CI CD Workflow Explained

Ryan Jung edited this page Apr 27, 2023 · 1 revision

The CI/CD workflow for Everything makes use of the Nx framework to determine what apps need to be redeployed based on the changes introduced to the repo. The goal of CI/CD is to maintain the invariant that any code merged into main is ready for deployment and that when it is merged into main it is automatically deployed. Additionally, apps should only deploy if they are affected by a change. There's no need to redeploy our JPAL project if a change only affects SFTT, for example!

All of this is handled via Github actions. Specifically, the ci-cd.yml workflow spec in .github/workflows.

Within this file you will see a few "jobs".

The "pre-deploy" job runs the test, lint, and build commands implemented by default on all Nx apps. This runs on every pull request and change in main. If something passes this check, it must be deployable.

Once a change is in main, we want to automatically deploy the change, but each deployment will look very different. Some will include bundling the code and uploading it, others just need to ping an external system that will automatically analyze everything and deploy the relevant code. These systems need to work together in a flexible manner.

To accommodate this, we introduce a new job for each app. The job contains a complex Github workflow expression that essentially says: "only run me for deployment from main, and if I'm affected by this change!"

Each job then defines the steps needed for deployment. Since pre-everything deployments were handled by Github actions (and actions are a great system) this makes deployment as relatively painless.

Introducing a new deployment is as simple as extending the ci-cd.yml workflow spec to handle a new job for a new app. Since all deployments are some variation of deploying to Amplify, App Runner, Lambda, SAM, etc. there shouldn't be anything too complex that cannot be represented in a workflow.

However, there's always bugs in deployment jobs. That's why you can also choose to manually run a deployment from the Actions tab!

image

You might need this to test a deployment, deploy without changes to the code, etc.

Clone this wiki locally