Skip to content

Continuous Integration

Julian Reyes Escrigas edited this page Jan 30, 2017 · 2 revisions

In this document, we'll explain how to setup a continuous integration tools using CircleCI.

CircleCI automatically infers many settings from the code and also you can create a circle.yml file on the project's root.

Add project

CircleCI have an awesome integration with Github, in order to add a project just go to https://circleci.com/, login with your GitHub account, go to Add Projects and follow the instructions

Add Projects view

By default, CircleCI will run the test on every commit that you push

Node.js configuration sample

machine:
  node:
    version: 7.1.0
  environment:
    CIRCLE_TEST: test

By default on node projects CircleCI will execute the following npm-scripts npm install and npm test on the dependencies and test stages respectively. If your project have defined those, you'are ready to use CircleCI

Databases

Projects use database frequently, CircleCI supports and have pre-installed PostgeSQL and MySQL and ready to use, in order to use them you have to manually set up

Let's assume your project is using PostgreSQL, need to populate the database with some src/sql/provision.sql file, and also we'll pass the environment DB_URL to our build in order to define the database connection settings

Node.js database configuration sample

machine:
  node:
    version: 5.8.0
  environment:
    DB_URL: postgres://ubuntu@localhost:5432/circle_test
  services:
    - postgresql
database:
  override:
    - psql -U ubuntu circle_test < src/sql/provision.sql

If you want to know more about Configuring CircleCI