is the best CI tool I have seen so far. Super easy to get started. It is more similar to TravisCI then others (Jenkins,

I signed up with my GitHub account and it automatically provides a list of your GitHub projects in the 'Add Projects' menu. Just select the project you want, select 'setup project', choose target OS and language, and follow the instructions. It uses yaml and Docker, sweet.


Circle CI infers a lot about your project from the code, so you may not need to customise any settings. If you do, the config.yaml file is where you do it.

There are seven primary sections, representing steps in the build/test/deploy process.

  • [docker, machine, and macos] executor environments
    • machine - Virtual Machine executor and settings e.g. time zone
      -- environment - environment variables e.g foo: bar
    • docker
    • macos
  • checkout - e.g. git clone
  • dependencies - e.g. npm install
  • database - prepare a database for tests. Default include Postgres, MySQL, Redis
  • compile - compile your project
  • test - run your tests
    • override, pre, post
  • deployment -

Each step in the above is run in its own context, so if you want an environment variables persisted you need to set that up in the Settings -> Contexts section. For SSH keys you can add in Project Settings -> Permissions -> SSH keys.


By default these directories are used: test/unit, test/integration, and test/functional. With node I usually have test folders in each module/lib in my app. I would say for unit testing, use **/*.spec.js, for integration put in /test/integration. The test locations can be overridden by:

    - test/integration/**/*.test.js
    - **/*.spec.js


If a test is green, the next (optional) step is deployment. The names below (production, staging, dev) relate to the current branch. You can also deploy based on tags.

    branch: production
      - ./
    branch: master
      - ./
    branch: dev
      - ./

Testing locally

You can install the CLI tool using:

curl -o /usr/local/bin/circleci && chmod +x /usr/local/bin/circleci

Then run circleci config validate -c .circleci/config.yaml to validate your config file. Or circleci build to execute your build step.

Example config

First we need to specify the latest version, which is 2.

version: 2
      - image: circleci/node:9.9.0

The first image is the primary image - where you will reference. After which you can specify dependency Docker images, if any. CircleCI maintains a library of pre-built images so you can target them directly.

    working_directory: ~/repo

  - checkout

  # Download and cache dependencies
  - restore_cache:
      - v1-dependencies-{{ checksum "package.json" }}
      # fallback to using the latest cache if no exact match is found
      - v1-dependencies-

  - run: yarn install

  - save_cache:
        - node_modules
      key: v1-dependencies-{{ checksum "package.json" }}
  # run tests!
  - run: yarn test