Postlight uses CircleCI for it's Continuous Integration needs, and Codecov for it's test coverage.
Below we show how to configure our testing pipeline using Postlight's tooling instead of the JS Stack tutorial tools.
-
Make sure to Sign in using your Postlight-connected Github account and select All Repos since your fork of the
learn
repo is Private. -
Follow the instructions under
Dashboard -> Projects
to setup your fork of thelearn
repository on CircleCI. -
Add a config File to your repo. Below is a detailed explanation for this step.
The only file that will be changed here (compared to the js stack tutorial) is the .yml
config file specific to the CI provider we're using.
- Travis uses
.travis.yml
for its configuration. - CircleCI uses
.circleci/config.yml
which is very similar.
Assuming you are creating a brand new repository for the last part of the "JS stack from scratch" training, your config.yml
file should look like the following:
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# run tests
- run: npm test && npm run prod:build
- Once everything is set up, all we need to do is to push a commit to our fork of
learn
in order to trigger the building/testing of our app.
-
Similarly to CircleCI, Codecov will seemlessly set you up using your Postlight Github Account.
-
Once this is done, run
npm install -D codecov
or it's equivalentyarn add --dev codecov
to make sure thecodecov
command is available for us to use in our testing script. Why? because codecov will analyze ourJest
'scoverage
directory to generate it's coverage reports. -
Update the
test
script in yourpackage.json
to be:
"scripts": {
...
"test": "npm run lint && flow && jest --coverage && codecov --token=YOU_CODECOV_TOKEN",
...
}
That's it! Next time you run your tests they will be available on your codecov dashboard.
For yarn users it is