From 80440df9f6aadfa69d57d6dfac6a6596a1531de5 Mon Sep 17 00:00:00 2001 From: Chiara Date: Thu, 5 Nov 2020 21:00:54 +0100 Subject: [PATCH 1/4] :sparkles: : consigne 4 (add lint and test) --- .circleci/config.yml | 23 +++++++++++++++++++++++ package.json | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4b9e2fd..a9d18c7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,11 @@ version: 2.1 # Define the jobs we want to run for this project +workflow: + build: + jobs: + - build + - lint + - tu jobs: build: docker: @@ -13,3 +19,20 @@ jobs: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} paths: - ./node_modules + 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 + + tu: + docker: + - image: cimg/node:14.10.1 + steps: + - checkout + - restore_cache: + key: npm-v1-dependencies-{{ checksum "yarn.lock" }} + - run: yarn test:ci diff --git a/package.json b/package.json index a4f54c1..96ef36c 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"./**/*.{yaml,yml}\"", - "format:check": "prettier --list-different \"src/**/*.ts\" \"test/**/*.ts\" \"./**/*.{yaml,yml}\"", + "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "format:check": "prettier --list-different \"src/**/*.ts\" \"test/**/*.ts\"", "generate": "hygen" }, "dependencies": { From ebab2401f3a6e55c0d64dd4924c33e822696b2ed Mon Sep 17 00:00:00 2001 From: Chiara Date: Thu, 5 Nov 2020 21:31:09 +0100 Subject: [PATCH 2/4] :sparkles: : postgres & e2e test --- .circleci/config.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a9d18c7..f85b653 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,7 @@ workflow: - build - lint - tu + - teste2e jobs: build: docker: @@ -36,3 +37,23 @@ jobs: - restore_cache: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} - run: yarn test:ci + teste2e: + docker: + - image: cimg/node:14.10.1 + environment: + DATABASE_URL: postgres://root:chiara@localhost:5432/circle-test_test + JWT_SECRET: ok + API_PORT: 3000 + API_HOST: localhost + API_PROTOCOL: http + - image: circleci/postgres:9.6.2-alpine + environment: + POSTGRES_USER: root + POSTGRES_BD: circle-test_test + POSTEGRES_PASSWORD: chiara + steps: + - checkout + - restore_cache: + key: npm-v1-dependencies-{{ checksum "yarn.lock" }} + - run: + command: yarn test:e2e From ce5c3a1a42eb90ea4f26b5814373de8dd45a2e55 Mon Sep 17 00:00:00 2001 From: Chiara Date: Thu, 5 Nov 2020 21:38:59 +0100 Subject: [PATCH 3/4] :bug: : fix --- .circleci/config.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f85b653..ebf75b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,9 +4,15 @@ workflow: build: jobs: - build - - lint - - tu - - teste2e + - lint: + requires: + - build + - tu: + requires: + - build + - teste2e: + requires: + - build jobs: build: docker: From ed863cfbdccb9f2244e2d9b39a7ec6ad84d83f99 Mon Sep 17 00:00:00 2001 From: Chiara Date: Thu, 5 Nov 2020 22:38:10 +0100 Subject: [PATCH 4/4] :sparkles: : docker --- .circleci/config.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index ebf75b2..b5f51f2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,12 @@ workflow: - teste2e: requires: - build + - dockerfile: + requires: + - build + - lint + - teste2e + - tu jobs: build: docker: @@ -63,3 +69,19 @@ jobs: key: npm-v1-dependencies-{{ checksum "yarn.lock" }} - run: command: yarn test:e2e + dockerfile: + environment: + IMAGE_NAME: skullkid59600/my-awesome-ci-expr + docker: + - image: circleci/buildpack-deps:stretch + steps: + - checkout + - setup_remote_docker: + version: 19.03.13 + - run: yarn start + - run: docker image build --tag $IMAGE_NAME:app . + - run: docker save -o image $IMAGE_NAME + - persist_to_workspace: + root: /tmp/dir + path: + - ./image