From c8aec6213d8779caeb3d71abc6e23d10e6feadfb Mon Sep 17 00:00:00 2001 From: anthony Date: Mon, 25 Oct 2021 10:03:39 +0200 Subject: [PATCH] :construction: Add build, test and test-e2e jobs --- .circleci/config.yml | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..298d6c7 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,64 @@ +globals: + images: + node: &node cimg/node:lts + postgres: &postgres circleci/postgres:9.6.5 + + + +version: 2 +jobs: + build: &shared-config + docker: + - image: *node + working_directory: ~/app + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - dependencies- + - run: yarn install + - save_cache: + paths: + - node_modules + key: dependencies-{{ checksum "package.json" }} + test: + <<: *shared-config + steps: + - checkout + - restore_cache: + key: dependencies-{{ checksum "package.json" }} + - run: yarn test + + test-e2e: + docker: + - image: *node + - image: *postgres + environment: + POSTGRES_DB: postgres + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + steps: + - checkout + - restore_cache: + keys: + - dependencies-{{ checksum "package.json" }} + - run: + command: yarn test:e2e + environment: + DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres + + + +workflows: + version: 2 + build-test-and-lint: + jobs: + - build + - test: + requires: + - build + - test-e2e: + requires: + - build