# Use the latest 2.1 version of CircleCI pipeline process engine. # See: https://circleci.com/docs/2.0/configuration-reference version: 2.1 orbs: # The Node.js orb contains a set of prepackaged CircleCI configuration you can utilize # Orbs reduce the amount of configuration required for common tasks. # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node node: circleci/node@4.7 jobs: # Below is the definition of your job to build and test your app, you can rename and customize it as you want. build-and-test: # These next lines define a Docker executor: https://circleci.com/docs/2.0/executor-types/ # You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub. # A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/node docker: - image: cimg/node:16.10 # Then run your tests! # CircleCI will report the results back to your VCS provider. steps: # Checkout the code as the first step. - checkout # Next, the node orb's install-packages step will install the dependencies from a package.json. # The orb install-packages step will also automatically cache them for faster future runs. - node/install-packages: # If you are using yarn, change the line below from "npm" to "yarn" pkg-manager: yarn - run: name: Run tests command: yarn test build: &shared-config docker: - image: circleci/node:lts-fermium working_directory: ~/repo steps: - checkout - restore_cache: keys: - dependencies-{{ checksum "package.json" }}-v1 - dependencies- - run: yarn install - save_cache: paths: - node_modules key: dependencies-{{ checksum "package.json" }}-v1 lint: <<: *shared-config steps: - checkout - restore_cache: key: dependencies-{{ checksum "package.json" }}-v1 - run: yarn lint - run: yarn format:check back-test-unit: <<: *shared-config steps: - checkout - restore_cache: key: dependencies-{{ checksum "package.json" }}-v1 - run: command: yarn test environment: DATABASE_URL: postgres://psqluer:psqlpassword@localhost:5432/psqluer back-test-e2e: docker: - image: circleci/node:lts-fermium - image: circleci/postgres:9.6.5 environment: POSTGRES_DB: psqluer POSTGRES_USER: psqluer POSTGRES_PASSWORD: psqlpassword working_directory: ~/repo steps: - checkout - restore_cache: key: dependencies-{{ checksum "package.json" }}-v1 - run: command: yarn test:e2e environment: DATABASE_URL: postgres://psqluer:psqlpassword@localhost:5432/psqluer workflows: build-test-and-lint: jobs: - build - back-test-unit: requires: - build - back-test-e2e: requires: - build - lint: requires: - build sample: jobs: - build-and-test