You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.2 KiB
84 lines
2.2 KiB
version: 2.1
|
|
executors:
|
|
node-executor:
|
|
docker:
|
|
- image: circleci/node:12
|
|
auth:
|
|
username: $DOCKERHUB_LOGIN
|
|
password: $DOCKERHUB_PASSWORD
|
|
node-and-postgresql-executor:
|
|
docker:
|
|
- image: circleci/node:12
|
|
auth:
|
|
username: $DOCKERHUB_LOGIN
|
|
password: $DOCKERHUB_PASSWORD
|
|
- image: circleci/postgres:9.6.2-alpine
|
|
auth:
|
|
username: $DOCKERHUB_LOGIN
|
|
password: $DOCKERHUB_PASSWORD
|
|
environment:
|
|
DATABASE_URL: "postgres://postgres@localhost:5432/psdb"
|
|
JWT_SECRET: string
|
|
API_PORT: 3000
|
|
API_HOST: localhost
|
|
API_PROTOCOL: http
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: password
|
|
POSTGRES_DB: psdb
|
|
jobs:
|
|
build:
|
|
executor: node-executor
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: Install dependencies
|
|
command: yarn global add node-gyp && yarn install
|
|
- save_cache:
|
|
name: Save Yarn package cache
|
|
key: npm-v7-dependencies-{{ checksum "yarn.lock" }}
|
|
paths:
|
|
- ./node_modules
|
|
lint:
|
|
executor: node-executor
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
name: Restore yarn package cache
|
|
key: npm-v7-dependencies-{{ checksum "yarn.lock" }}
|
|
- run:
|
|
name: Analyse code with tslint and format with prettier
|
|
command: yarn lint && yarn format:check
|
|
test:
|
|
executor: node-executor
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
name: Restore yarn package cache
|
|
key: npm-v7-dependencies-{{ checksum "yarn.lock" }}
|
|
- run:
|
|
name: Run test with jest
|
|
command: yarn test:ci
|
|
test_end_to_end:
|
|
executor: node-and-postgresql-executor
|
|
steps:
|
|
- checkout
|
|
- restore_cache:
|
|
name: Restore yarn package cache
|
|
key: npm-v7-dependencies-{{ checksum "yarn.lock" }}
|
|
- run:
|
|
name: Run end to end test
|
|
command: yarn test:e2e
|
|
workflows:
|
|
version: 2
|
|
integration:
|
|
jobs:
|
|
- build
|
|
- lint:
|
|
requires:
|
|
- build
|
|
- test:
|
|
requires:
|
|
- build
|
|
- test_end_to_end:
|
|
requires:
|
|
- build
|