From 676262a78388408e8ef3da9f95fd2bfb79ae94e3 Mon Sep 17 00:00:00 2001 From: Hugo Nollet Date: Wed, 13 Oct 2021 20:18:27 +0200 Subject: [PATCH] TP DONE --- .circleci/Dockerfile | 11 ++++ .circleci/config.yml | 116 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 .circleci/Dockerfile create mode 100644 .circleci/config.yml diff --git a/.circleci/Dockerfile b/.circleci/Dockerfile new file mode 100644 index 0000000..3bc928c --- /dev/null +++ b/.circleci/Dockerfile @@ -0,0 +1,11 @@ +FROM cimg/node:16.10.0 + +COPY ../ app + +WORKDIR /app + +RUN yarn install + +EXPOSE 80 + +CMD ["yarn", "start"] \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..826ea49 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,116 @@ +version: 2.1 +jobs: + build: + docker: + - image: cimg/node:16.10.0 + auth: + username: hgnllt + password: $DOCKERHUB_PASSWORD + steps: + - checkout + - restore_cache: + keys: + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + - npm-v1-dependencies + - run: + name: Run yarn install + command: yarn install + - save_cache: + name: Save cache + key: npm-v1-dependencies-{{ checksum "yarn.lock" }} + paths: + - node_modules + lint: + docker: + - image: cimg/node:16.10.0 + auth: + username: hgnllt + password: $DOCKERHUB_PASSWORD + steps: + - checkout + - restore_cache: + keys: + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + - npm-v1-dependencies + - run: + name: Run yarn lint + command: yarn lint + - run: + name: Run yarn format check + command: yarn format:check + unit_test: + docker: + - image: cimg/node:16.10.0 + auth: + username: hgnllt + password: $DOCKERHUB_PASSWORD + steps: + - checkout + - restore_cache: + keys: + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + - npm-v1-dependencies + - run: + name: Run yarn test + command: yarn test + e2e_test: + docker: + - image: cimg/node:16.10.0 + auth: + username: hgnllt + password: $DOCKERHUB_PASSWORD + - image: circleci/postgres:9.6-alpine + auth: + username: hgnllt + password: $DOCKERHUB_PASSWORD + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: devops + steps: + - checkout + - restore_cache: + keys: + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + - npm-v1-dependencies + - run: + name: Run yarn end to end test + environment: + DATABASE_URL: postgres://postgres:password@localhost:5432/devops + command: yarn test:e2e + generate_doc: + docker: + - image: cimg/node:16.10.0 + auth: + username: hgnllt + password: $DOCKERHUB_PASSWORD + steps: + - checkout + - restore_cache: + keys: + - npm-v1-dependencies-{{ checksum "yarn.lock" }} + - npm-v1-dependencies + - run: + name: Generate the documentation + command: yarn doc:build + - store_artifacts: + path: docs + +workflows: + build_test_docs: + jobs: + - build + - lint: + requires: + - build + - unit_test: + requires: + - build + - e2e_test: + requires: + - build + - generate_doc: + requires: + - lint + - unit_test + - e2e_test \ No newline at end of file