From 148dbac3e9d0c37fbe8cb520cafede86335f58b6 Mon Sep 17 00:00:00 2001 From: Galimede Date: Sun, 10 Jan 2021 13:38:54 +0100 Subject: [PATCH] :construction_worker: Add cirlceci CI system --- .circleci/config.yml | 75 ++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++ src/common/config.js | 2 +- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..836e5b4 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,75 @@ +version: 2.1 +jobs: + install: + docker: + - image: cimg/node:15.5.1-browsers + steps: + - checkout + - restore_cache: + keys: + - yarn-packages-{{ checksum "yarn.lock" }}--{{ .Environment.CACHE_VERSION }} + - yarn-packages + - run: yarn global add node-gyp && yarn install + - save_cache: + key: yarn-packages-{{ checksum "yarn.lock" }}--{{ .Environment.CACHE_VERSION }} + paths: + - node_modules + test: + docker: + - image: cimg/node:15.5.1-browsers + steps: + - checkout + - restore_cache: + keys: + - yarn-packages-{{ checksum "yarn.lock" }}--{{ .Environment.CACHE_VERSION }} + - run: + - name: Launch test + - command : yarn test + build: + docker: + - image: cimg/node:15.5.1-browsers + steps: + - checkout + - restore_cache: + keys: + - yarn-packages-{{ checksum "yarn.lock" }}--{{ .Environment.CACHE_VERSION }} + - run: + - name: Build for production + - command : yarn run build + - run: + - name: Copy build to workspace + - command: | + ls + cp build/ /tmp/build -r + - store_artifacts: + path: /tmp/build + - persist_to_workspace: + root: /tmp + paths: + - build + deploy: + docker: + - image: cimg/node:15.5.1-browsers + working_directory: ~/deploy-netlfify + steps: + - attach_workspace: + at: /tmp + - run: + name: Deploy app + command: | + sudo npm install -g --silent netlify-cli + ls /tmp + netlify deploy --prod --auth $NETLIFY_AUTH_TOKEN --dir=/tmp/build --site $NETLIFY_SITE_ID + +workflows: + build_deploy: + jobs: + - install + - build: + requires: + - install + - deploy: + context: netlify_devops_final + requires: + # - install + - build \ No newline at end of file diff --git a/.gitignore b/.gitignore index 863c1df..2512fa3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ yarn-error.log* # Coverage Reports coverage + +# Local Netlify folder +.netlify \ No newline at end of file diff --git a/src/common/config.js b/src/common/config.js index bc3dc53..71b53a0 100644 --- a/src/common/config.js +++ b/src/common/config.js @@ -1,5 +1,5 @@ export const API_URL = process.env.NODE_ENV === "production" - ? "https://tobedefined.io/api" + ? process.env.PROD_BACK_URL || "URL_HERE" : "http://localhost:2020/api"; export default API_URL;