version: 2.1 workflow: build: jobs: - build lint: requires: - build test: requires: - build e2e: requires: - build jobs: build: docker: - image: cimg/node:14.10.1 steps: - checkout - restore_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} - run: yarn global add node-gyp && yarn install - save_cache: paths: - ~./cache/yarn key: npm-v1-dependencies-{{ checksum "yarn.lock" }} lint: docker: - image: cimg/node:14.10.1 steps: - checkout - restore_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} - run: yarn lint && yarn format:check test: docker: - image: cimg/node:14.10.1 steps: - checkout - restore_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} - run: yarn test:ci e2e: docker: - image: cimg/node:14.10.1 environment DATABASE_URL:postgres://psqluer:psqlpassword@localhost:5432/psdb JWT_SECRET:keke API_PORT:3000 API_HOST:localhost API_PROTOCOL:http - image: circleci/postgres:9.6.2-alpine environment POSTGRE_USER:keke POSTGRE_DB:mydb POSTGRE_PASSWORD:keke steps: - checkout - restore_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} - run: name: time to launch command: dockerize wait tcp://localhost:5432 -timeout 1m - run: name: e2e test command: yarn test:e2e build_docker: environment IMAGE_NAME: 698148/my-awesome docker: - image: circleci/buildpack-deps:stretch steps: - checkout - run: bash scripts/generate.sh > Dockerfile - run: docker login -u $698148 -p $n698k148* - run: docker build -t $698148/$IMAGE_NAME:app . - run: docker push $698148/$IMAGE_NAME:$IMAGE_TAG && sleep 10