From 36352fa5169651ba45c9682ca8b90906a05f6fce Mon Sep 17 00:00:00 2001 From: Julien Dudek Date: Mon, 2 Nov 2020 15:08:13 +0100 Subject: [PATCH] test --- .circleci/config.yml | 74 ++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 78e9947..7c69b38 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,17 +1,18 @@ version: 2.1 workflows: - build_and_lint: + build_and_test: jobs: - build - lint: requires: - build - - database - - test: + - tests: requires: - build - - + - db + - e2e: + requires: + - db jobs: build: docker: @@ -19,10 +20,22 @@ jobs: steps: - checkout - restore_cache: - key: yarn-packagesV3-{{ checksum "yarn.lock" }} + key: yarn-packages-v3{{ checksum "yarn.lock" }} - run: yarn global add node-gyp && yarn install - save_cache: - key: yarn-packagesV3-{{ checksum "yarn.lock" }} + key: yarn-packages-v3{{ checksum "yarn.lock" }} + paths: + - ./node_modules + tests: + docker: + - image: "circleci/node:12" + steps: + - checkout + - restore_cache: + key: yarn-packages-v3{{ checksum "yarn.lock" }} + - run: yarn test:ci + - save_cache: + key: yarn-packages-v3{{ checksum "yarn.lock" }} paths: - ./node_modules lint: @@ -31,31 +44,44 @@ jobs: steps: - checkout - restore_cache: - key: yarn-packagesV3-{{ checksum "yarn.lock" }} + key: yarn-packages-v3{{ checksum "yarn.lock" }} - run: yarn lint && yarn format:check - test: + - save_cache: + key: yarn-packages-v3{{ checksum "yarn.lock" }} + paths: + - ./node_modules + db: docker: - - image: "circleci/node:12" + - image: circleci/postgres:alpine + environment: + PG_USER: circleci-demo-go + PG_DB: circle_test + steps: - checkout - restore_cache: - key: yarn-packagesV3-{{ checksum "yarn.lock" }} - - run: yarn test:ci - database: + key: yarn-packages-v3{{ checksum "yarn.lock" }} + + - save_cache: + key: yarn-packages-v3{{ checksum "yarn.lock" }} + paths: + - ./node_modules + e2e: docker: - image: "circleci/node:12" + steps: + - checkout + - restore_cache: + key: yarn-packages-v3{{ checksum "yarn.lock" }} + - run: + command: yarn test:e2e environment: - DATABASE_URL: postgres://psqluer:psqlpassword@localhost:5432/psdb - JWT_SECRET: passedb + DATABASE_URL: postgres://$PG_USER@localhost:5432/$PG_DB + JWT_SECRET: yeet API_PORT: 3000 API_HOST: localhost API_PROTOCOL: http - - image: "circleci/postgres:9.6.2-alpine" - environment: - POSTGRES_USER: psqluer - POSTGRES_PASSWORD: psqlpassword - steps: - - checkout - - restore_cache: - key: yarn-packagesV3-{{ checksum "yarn.lock" }} - - run: yarn yarn test:e2e + - save_cache: + key: yarn-packages-v3{{ checksum "yarn.lock" }} + paths: + - ./node_modules