diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..0e936d1 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,108 @@ +# Use the latest 2.1 version of CircleCI pipeline process engine. +# See: https://circleci.com/docs/configuration-reference + +# For a detailed guide to building and testing with Node, read the docs: +# https://circleci.com/docs/language-javascript/ for more details +version: 2.1 + +# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects. +# See: https://circleci.com/docs/orb-intro/ +orbs: + # See the Node orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node + node: circleci/node@5.2 + +jobs: + # Below is the definition of your job to build and test your app, you can rename and customize it as you want. + test: + # Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub. + # See: https://circleci.com/docs/executor-intro/ & https://circleci.com/docs/configuration-reference/#executor-job + docker: + # Specify the version you desire here + # See: https://circleci.com/developer/images/image/cimg/node + - image: cimg/node:16.20.1 + + # Add steps to the job + # See: https://circleci.com/docs/jobs-steps/#steps-overview & https://circleci.com/docs/configuration-reference/#steps + steps: + # Checkout the code as the first step. + - checkout + - node/install-packages: + override-ci-command: npm install --legacy-peer-deps + - run: + name: Run linter + command: npm run lint + - run: + name: Run tests + command: npm run test + + build: + docker: + - image: cimg/node:16.20.1 + steps: + - checkout + - node/install-packages: + override-ci-command: npm install --legacy-peer-deps + - run: + name: Build app + command: npm run build + - persist_to_workspace: + root: out + paths: + - . + + deploy: + docker: + - image: cimg/node:16.20.1 + steps: + - add_ssh_keys: + fingerprints: + - 'SHA256:5aE7AmvtKBZR+3Zs0AakVuWjtQ+oRAiw3k714FR/KeU' + - attach_workspace: + at: /tmp/out + - checkout + - run: + name: Deploy to GitHub Pages + command: | + git fetch + git checkout gh-pages + rm -rf ./* + mv /tmp/out/* . + touch .nojekyll + git config user.email "1903291+hex22a@users.noreply.github.com" + git config user.name "CircleCI (on behalf of Crash)" + git add . + git commit -m "CircleCI deploy to GitHub Pages" + git push -u origin gh-pages +# Orchestrate jobs using workflows +# See: https://circleci.com/docs/workflows/ & https://circleci.com/docs/configuration-reference/#workflows +workflows: + deploy-gh-pages: # This is the name of the workflow, feel free to change it to better match your workflow. + # Inside the workflow, you define the jobs you want to run. + jobs: + - test: + filters: + tags: + only: /.*/ + branches: + ignore: + - gh-pages + # For running simple node tests, you could optionally use the node/test job from the orb to replicate and replace the job above in fewer lines. + # - node/test + - build: + filters: + tags: + only: /^\d+.\d+.\d+$/ + branches: + ignore: /.*/ + requires: + - test + + - deploy: + filters: + tags: + only: /^\d+.\d+.\d+$/ + branches: + ignore: /.*/ + requires: + - test + - build diff --git a/.eslintrc b/.eslintrc index 951d4d4..cc71088 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,5 @@ { - "extends": ["react-app", "airbnb-base"], + "extends": ["react-app", "airbnb-base", "prettier"], "parser": "@babel/eslint-parser", "ignorePatterns": [ "./node_modules/*" diff --git a/package-lock.json b/package-lock.json index 982a9fd..68a905b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "enzyme-to-json": "^3.6.2", "eslint": "^8.57.0", "eslint-config-airbnb-base": "^13.2.0", + "eslint-config-prettier": "^9.1.0", "eslint-config-react-app": "^7.0.1", "husky": "^1.3.1", "jest-dom": "^3.5.0", @@ -11173,6 +11174,18 @@ "eslint-plugin-import": "^2.17.2" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-config-react-app": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz", @@ -40543,6 +40556,12 @@ "object.entries": "^1.1.0" } }, + "eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true + }, "eslint-config-react-app": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz", diff --git a/package.json b/package.json index b0a58bf..4c1067e 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "enzyme-to-json": "^3.6.2", "eslint": "^8.57.0", "eslint-config-airbnb-base": "^13.2.0", + "eslint-config-prettier": "^9.1.0", "eslint-config-react-app": "^7.0.1", "husky": "^1.3.1", "jest-dom": "^3.5.0",