Julien Dudek 6 years ago
parent
commit
36352fa516
  1. 74
      .circleci/config.yml

74
.circleci/config.yml

@ -1,17 +1,18 @@
version: 2.1
workflows:
build_and_lint:
build_and_test:
jobs:
- build
- lint:
requires:
- build
- database
- test:
- tests:
requires:
- build
- db
- e2e:
requires:
- db
jobs:
build:
docker:
@ -19,10 +20,22 @@ jobs:
steps:
- checkout
- restore_cache:
key: yarn-packagesV3-{{ checksum "yarn.lock" }}
key: yarn-packages-v3{{ checksum "yarn.lock" }}
- run: yarn global add node-gyp && yarn install
- save_cache:
key: yarn-packagesV3-{{ checksum "yarn.lock" }}
key: yarn-packages-v3{{ checksum "yarn.lock" }}
paths:
- ./node_modules
tests:
docker:
- image: "circleci/node:12"
steps:
- checkout
- restore_cache:
key: yarn-packages-v3{{ checksum "yarn.lock" }}
- run: yarn test:ci
- save_cache:
key: yarn-packages-v3{{ checksum "yarn.lock" }}
paths:
- ./node_modules
lint:
@ -31,31 +44,44 @@ jobs:
steps:
- checkout
- restore_cache:
key: yarn-packagesV3-{{ checksum "yarn.lock" }}
key: yarn-packages-v3{{ checksum "yarn.lock" }}
- run: yarn lint && yarn format:check
test:
- save_cache:
key: yarn-packages-v3{{ checksum "yarn.lock" }}
paths:
- ./node_modules
db:
docker:
- image: "circleci/node:12"
- image: circleci/postgres:alpine
environment:
PG_USER: circleci-demo-go
PG_DB: circle_test
steps:
- checkout
- restore_cache:
key: yarn-packagesV3-{{ checksum "yarn.lock" }}
- run: yarn test:ci
database:
key: yarn-packages-v3{{ checksum "yarn.lock" }}
- save_cache:
key: yarn-packages-v3{{ checksum "yarn.lock" }}
paths:
- ./node_modules
e2e:
docker:
- image: "circleci/node:12"
steps:
- checkout
- restore_cache:
key: yarn-packages-v3{{ checksum "yarn.lock" }}
- run:
command: yarn test:e2e
environment:
DATABASE_URL: postgres://psqluer:psqlpassword@localhost:5432/psdb
JWT_SECRET: passedb
DATABASE_URL: postgres://$PG_USER@localhost:5432/$PG_DB
JWT_SECRET: yeet
API_PORT: 3000
API_HOST: localhost
API_PROTOCOL: http
- image: "circleci/postgres:9.6.2-alpine"
environment:
POSTGRES_USER: psqluer
POSTGRES_PASSWORD: psqlpassword
steps:
- checkout
- restore_cache:
key: yarn-packagesV3-{{ checksum "yarn.lock" }}
- run: yarn yarn test:e2e
- save_cache:
key: yarn-packages-v3{{ checksum "yarn.lock" }}
paths:
- ./node_modules
Loading…
Cancel
Save