version: 2.1 jobs: build: docker: - image: cimg/node:lts auth: username: adrienba password: $MYDOCKERHUB_PASSWORD steps: - checkout - restore_cache: keys: - npm-v1-dependencies-{{ checksum "yarn.lock" }} - npm-v1-dependencies - run: name: "yarn install" command: yarn install - save_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} paths: - node_modules yarnlint: docker: - image: cimg/node:lts auth: username: adrienba password: $MYDOCKERHUB_PASSWORD steps: - checkout - restore_cache: keys: - npm-v1-dependencies-{{ checksum "yarn.lock" }} - npm-v1-dependencies - run: name: "yarn lint" command: yarn lint - run: name: "yarn format:check" command: yarn format:check - save_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} paths: - node_modules yarntest: docker: - image: cimg/node:lts auth: username: adrienba password: $MYDOCKERHUB_PASSWORD steps: - checkout - restore_cache: keys: - npm-v1-dependencies-{{ checksum "yarn.lock" }} - npm-v1-dependencies - run: name: "yarn test" command: yarn test - save_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} paths: - node_modules bddtest: docker: - image: cimg/node:lts auth: username: adrienba password: $MYDOCKERHUB_PASSWORD environment: TEST_DATABASE_URL: postgresql://root@localhost/circle_test - image: circleci/postgres:9.6.5-alpine-ram auth: username: adrienba password: $DOCKERHUB_PASSWORD steps: - checkout - restore_cache: keys: - npm-v1-dependencies-{{ checksum "yarn.lock" }} - npm-v1-dependencies - run: name: "yarn test:e2e" command: yarn test:e2e - save_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} paths: - node_modules workflows: build-test-and-deploy: jobs: - build - yarnlint: requires: - build - yarntest: requires: - build - yarnlint - bddtest: requires: - build - yarnlint - yarntest