Now, let’s setup continuous integration to run our lint commands as tests! We are going to use CircleCI, primarily because Workflows allow us to create whatever CI/CD pipeline we want and Scheduled Workflows allow us to use CircleCI to run our monitors!
Let’s start with a simple CircleCI config file. Save the following to .circleci/config.yml
:
version: 2
jobs:
build:
docker:
- image: circleci/node:8
steps:
- checkout
- run: npm install
This CircleCI build does the following:
npm install
Read more about caching here: https://circleci.com/docs/2.0/caching/
Let’s add our lint commands after npm install
:
- run: npm run eslint
- run: npm run stylelint
Now, let’s enable CircleCI on your repository:
Your app should start building now!
Next, let’s setup the CircleCI Badge on your readme:
There is an art to setting up CircleCI Workflows for your app. At Dollar Shave Club, we run about 24 jobs for just one repository! In this workshop, your CircleCI jobs will be slow because we haven’t setup caching, which could be its own lesson.
For a more complex CircleCI config file, checkout IMS’s.
Here is our CircleCI Workflow at DSC:
dqa
is our version of Heroku’s review apps.