.circleci/config.yml
version: 2
jobs:
build:
docker:
- image: circleci/node:11.10.1-stretch
environment:
NODE_ENV: circleci
DATABASE_HOST: localhost
POSTGRES_USER: root
POSTGRES_PASSWORD: secretPassword
POSTGRES_DB: node_type_orm_graphql
- image: circleci/postgres:10.2-alpine-ram
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: secretPassword
POSTGRES_DB: node_type_orm_graphql
steps:
- checkout
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: apt-get Update And Installs
command: |
sudo apt-get update
sudo apt-get install postgresql-client
- run:
name: Setup Dependencies
command: yarn install
- run:
name: Setup Code Climate test-reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run:
name: Run Database Migrations
command: npm run typeorm:migration:run
- run:
name: Run Test and Coverage
command: |
./cc-test-reporter before-build
npm run test:coverage
./cc-test-reporter after-build --exit-code $?