CI/CD
The first thing we're going to do is automating the tests. The CI will run the backend and frontend tests for each commit pushed.
Later, we will also automate the deployment of the app when we push to the master branch.
The end goal is to automate the pipeline from commit to deploy.

CircleCI
CircleCI is a popular platform offering CI in the cloud. You get one container for free. Let's get started:
Create a folder named
.circleciand add a fileconfig.yml.Populate the
config.ymlwith the contents of the sample.ymlbellow.Change
"test": "echo \"Error: no test specified\" && exit 1"to"test": "jest"inpackages/api.Commit and push up to GitHub
Go to CircleCI and watch your build.
When tests are broken, CircleCI will let you know:

We can also see the build status on the commits:

Environment variables
Locally, we are reading the .env file. But this file is not committed to the repo. We have to setup the environment variables on CircleCI.
Go to the project's settings by clicking on the cog next to the project name:

Scroll down to BUILD SETTINGS and click Environment Variables then Add Variable.
Add the variables from the .env file:

The tests should now be passing:


Last updated
Was this helpful?