version: 2.1 workflows: std: jobs: - yarn - lint: requires: - yarn - test: requires: - yarn - e2e-test: requires: - yarn - build: requires: - lint - test - e2e-test jobs: yarn: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: npm-v2-dependencies-{{ checksum "yarn.lock" }} - run: yarn global add node-gyp && yarn install - save_cache: key: npm-v2-dependencies-{{ checksum "yarn.lock" }} paths: - ./node_modules lint: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: npm-v2-dependencies-{{ checksum "yarn.lock" }} - run: yarn lint - run: yarn format:check test: docker: - image: "circleci/node:12" steps: - checkout - restore_cache: key: npm-v2-dependencies-{{ checksum "yarn.lock" }} - run: yarn test:ci e2e-test: docker: - image: "circleci/node:12" environment: DATABASE_URL: postgres://jeffyshewan:password@localhost:5432/testbdd JWT_SECRET: ARMA_eau_de_combat API_PORT: 3000 API_HOST: localhost API_PROTOCOL: http - image: "circleci/postgres:9.6.2-alpine" environment: POSTGRES_USER: jeffyshewan POSTGRES_DB: testbdd POSTGRES_PASSWORD: password steps: - checkout - restore_cache: key: npm-v2-dependencies-{{ checksum "yarn.lock" }} - run: name: connecting postgres command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: name: start e2e test command: yarn test:e2e - save_cache: key: npm-v2-dependencies-{{ checksum "yarn.lock" }} paths: - ./node_modules build: environment: IMAGE_NAME: jeffyshewan/build-on-ci docker: - image: "circleci/buildpack-deps:stretch" steps: - checkout - setup_remote_docker - run: name: Build and publish on DockerHub command: docker build -t $IMAGE_NAME:latest .