From b1d7e88dbb76055a9fb2e6b2479e879121bff723 Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 10:52:02 +0100 Subject: [PATCH 01/17] #2 add .gitlab-ci.yml file --- .gitlab-ci.yml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..8e8be239 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,58 @@ +image: node:10 + +stages: + - install + - build + - quality + +install: + stage: install + script: + - npm install + artifacts: + name: "artifacts" + untracked: true + expire_in: 60 mins + paths: + - .npm/ + - node_modules/ + +build: + stage: build + script: + - CI=false npm run build + artifacts: + paths: + - build + expire_in: 60 mins + dependencies: + - install + +linting: + stage: quality + script: + - npm run lint + dependencies: + - install + +test:unit: + stage: quality + script: + - npm run test:coverage + dependencies: + - install + coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ + +test:e2e: + stage: quality + image: cypress/browsers:chrome69 + dependencies: + - install + - build + script: + - npm run e2e:ci + artifacts: + paths: + - cypress/screenshots + - cypress/videos + expire_in: 1 day -- GitLab From 5180f9c1fea39182f30fdb49f4be4c38013167ff Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 11:00:10 +0100 Subject: [PATCH 02/17] #2: tried changing folder before building --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e8be239..693d8d01 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ stages: install: stage: install script: + - cd client - npm install artifacts: name: "artifacts" @@ -20,6 +21,7 @@ install: build: stage: build script: + - cd client - CI=false npm run build artifacts: paths: -- GitLab From ea2b38db4e84016fbfb769f2b99637299ce58fbd Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 11:04:27 +0100 Subject: [PATCH 03/17] #2: Changing folder on each script and artifact path --- .gitlab-ci.yml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 693d8d01..fd43e137 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,8 +15,8 @@ install: untracked: true expire_in: 60 mins paths: - - .npm/ - - node_modules/ + - client/.npm/ + - client/node_modules/ build: stage: build @@ -25,7 +25,7 @@ build: - CI=false npm run build artifacts: paths: - - build + - client/build expire_in: 60 mins dependencies: - install @@ -33,6 +33,7 @@ build: linting: stage: quality script: + - cd client - npm run lint dependencies: - install @@ -40,21 +41,9 @@ linting: test:unit: stage: quality script: + - cd client - npm run test:coverage dependencies: - install coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ -test:e2e: - stage: quality - image: cypress/browsers:chrome69 - dependencies: - - install - - build - script: - - npm run e2e:ci - artifacts: - paths: - - cypress/screenshots - - cypress/videos - expire_in: 1 day -- GitLab From dca61f9c887534e8bb40dcf53de9a3fbf66f12e2 Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 11:27:59 +0100 Subject: [PATCH 04/17] #2: Added eslint to the project --- client/.eslintrc.js | 25 +++++++ client/package-lock.json | 143 +++++++++++++++++++++++++++++++++------ client/package.json | 12 +++- 3 files changed, 159 insertions(+), 21 deletions(-) create mode 100644 client/.eslintrc.js diff --git a/client/.eslintrc.js b/client/.eslintrc.js new file mode 100644 index 00000000..eacf3549 --- /dev/null +++ b/client/.eslintrc.js @@ -0,0 +1,25 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": [ + "react", + "@typescript-eslint" + ], + "rules": { + } +}; diff --git a/client/package-lock.json b/client/package-lock.json index 24b4bff5..4a876ccd 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -2393,18 +2393,70 @@ "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==" }, "@typescript-eslint/eslint-plugin": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.0.tgz", - "integrity": "sha512-DJgdGZW+8CFUTz5C/dnn4ONcUm2h2T0itWD85Ob5/V27Ndie8hUoX5HKyGssvR8sUMkAIlUc/AMK67Lqa3kBIQ==", + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.1.tgz", + "integrity": "sha512-yW2epMYZSpNJXZy22Biu+fLdTG8Mn6b22kR3TqblVk50HGNV8Zya15WAXuQCr8tKw4Qf1BL4QtI6kv6PCkLoJw==", "requires": { - "@typescript-eslint/experimental-utils": "4.15.0", - "@typescript-eslint/scope-manager": "4.15.0", + "@typescript-eslint/experimental-utils": "4.15.1", + "@typescript-eslint/scope-manager": "4.15.1", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "lodash": "^4.17.15", "regexpp": "^3.0.0", "semver": "^7.3.2", "tsutils": "^3.17.1" + }, + "dependencies": { + "@typescript-eslint/experimental-utils": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.1.tgz", + "integrity": "sha512-9LQRmOzBRI1iOdJorr4jEnQhadxK4c9R2aEAsm7WE/7dq8wkKD1suaV0S/JucTL8QlYUPU1y2yjqg+aGC0IQBQ==", + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.15.1", + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/typescript-estree": "4.15.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", + "integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1" + } + }, + "@typescript-eslint/types": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", + "integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==" + }, + "@typescript-eslint/typescript-estree": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", + "integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", + "integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "eslint-visitor-keys": "^2.0.0" + } + } } }, "@typescript-eslint/experimental-utils": { @@ -2421,14 +2473,53 @@ } }, "@typescript-eslint/parser": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.0.tgz", - "integrity": "sha512-L6Dtbq8Bc7g2aZwnIBETpmUa9XDKCMzKVwAArnGp5Mn7PRNFjf3mUzq8UeBjL3K8t311hvevnyqXAMSmxO8Gpg==", + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz", + "integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==", "requires": { - "@typescript-eslint/scope-manager": "4.15.0", - "@typescript-eslint/types": "4.15.0", - "@typescript-eslint/typescript-estree": "4.15.0", + "@typescript-eslint/scope-manager": "4.15.1", + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/typescript-estree": "4.15.1", "debug": "^4.1.1" + }, + "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", + "integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1" + } + }, + "@typescript-eslint/types": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", + "integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==" + }, + "@typescript-eslint/typescript-estree": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", + "integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", + "integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "eslint-visitor-keys": "^2.0.0" + } + } } }, "@typescript-eslint/scope-manager": { @@ -5464,11 +5555,11 @@ } }, "eslint": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.19.0.tgz", - "integrity": "sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.20.0.tgz", + "integrity": "sha512-qGi0CTcOGP2OtCQBgWZlQjcTuP0XkIpYFj25XtRTQSHC+umNnp7UMshr2G8SLsRFYDdAPFeHOsiteadmMH02Yw==", "requires": { - "@babel/code-frame": "^7.0.0", + "@babel/code-frame": "7.12.11", "@eslint/eslintrc": "^0.3.0", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -5480,7 +5571,7 @@ "eslint-utils": "^2.1.0", "eslint-visitor-keys": "^2.0.0", "espree": "^7.3.1", - "esquery": "^1.2.0", + "esquery": "^1.4.0", "esutils": "^2.0.2", "file-entry-cache": "^6.0.0", "functional-red-black-tree": "^1.0.1", @@ -5507,6 +5598,14 @@ "v8-compile-cache": "^2.0.3" }, "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "requires": { + "@babel/highlight": "^7.10.4" + } + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -5609,6 +5708,12 @@ "confusing-browser-globals": "^1.0.10" } }, + "eslint-config-strongloop": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-strongloop/-/eslint-config-strongloop-2.1.0.tgz", + "integrity": "sha1-dj3Rmt/OiNewBR5uJV8a43eDtMY=", + "dev": true + }, "eslint-import-resolver-node": { "version": "0.3.4", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz", @@ -14137,9 +14242,9 @@ }, "dependencies": { "ajv": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.0.4.tgz", - "integrity": "sha512-xzzzaqgEQfmuhbhAoqjJ8T/1okb6gAzXn/eQRNpAN1AEUoHJTNF9xCDRTtf/s3SKldtZfa+RJeTs+BQq+eZ/sw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.1.0.tgz", + "integrity": "sha512-svS9uILze/cXbH0z2myCK2Brqprx/+JJYK5pHicT/GQiBfzzhUVAIT6MwqJg8y4xV/zoGsUeuPuwtoiKSGE15g==", "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", diff --git a/client/package.json b/client/package.json index 3b69eed1..4781aa36 100644 --- a/client/package.json +++ b/client/package.json @@ -21,7 +21,8 @@ "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "lint": "eslint --ignore-path .gitignore ." }, "eslintConfig": { "extends": [ @@ -41,5 +42,12 @@ "last 1 safari version" ] }, - "proxy": "http://localhost:5000/api/" + "proxy": "http://localhost:5000/api/", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^4.15.1", + "@typescript-eslint/parser": "^4.15.1", + "eslint": "^7.20.0", + "eslint-config-strongloop": "^2.1.0", + "eslint-plugin-react": "^7.22.0" + } } -- GitLab From aa8de6be3683834e666fdc0835206dca7132824b Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 11:32:43 +0100 Subject: [PATCH 05/17] #2: Added node environment to eslint --- client/.eslintrc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/.eslintrc.js b/client/.eslintrc.js index eacf3549..6bd7839f 100644 --- a/client/.eslintrc.js +++ b/client/.eslintrc.js @@ -1,7 +1,8 @@ module.exports = { "env": { "browser": true, - "es2021": true + "es2021": true, + "node": true }, "extends": [ "eslint:recommended", -- GitLab From 30c96aefa8be7d5d12568f06fe922685e4870f44 Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 11:38:55 +0100 Subject: [PATCH 06/17] #2: Added script for test:coverage --- client/package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/package.json b/client/package.json index 4781aa36..e1e298dc 100644 --- a/client/package.json +++ b/client/package.json @@ -22,7 +22,8 @@ "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint --ignore-path .gitignore ." + "lint": "eslint --ignore-path .gitignore .", + "test:coverage": "react-scripts test --coverage" }, "eslintConfig": { "extends": [ @@ -50,4 +51,4 @@ "eslint-config-strongloop": "^2.1.0", "eslint-plugin-react": "^7.22.0" } -} +} \ No newline at end of file -- GitLab From 176e8dd84af95576f4b69ea0673a5d7b726e82af Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 11:55:22 +0100 Subject: [PATCH 07/17] #2: Changed coverage expression --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fd43e137..f2ae15d2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,5 +45,5 @@ test:unit: - npm run test:coverage dependencies: - install - coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/ - + coverage: /All\sfiles.*?\s+(\d+.\d+)/ + -- GitLab From 606dc4b450ca7b144d5a069dc847e6d4c80ae02f Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 12:11:47 +0100 Subject: [PATCH 08/17] #2: Changed regex for coverage --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f2ae15d2..e43fa9fd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,5 +45,5 @@ test:unit: - npm run test:coverage dependencies: - install - coverage: /All\sfiles.*?\s+(\d+.\d+)/ + coverage: /All files\s*\|\s*([\d\.]+)/ -- GitLab From 39823fde0ac07f0223c69535831049e45ca2809e Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 12:27:23 +0100 Subject: [PATCH 09/17] added coverage report and pipeline status to branch --- client/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/README.md b/client/README.md index da908d16..c4f50ce6 100644 --- a/client/README.md +++ b/client/README.md @@ -1,3 +1,6 @@ + +[](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system/-/commits/issue/2-test-front-end) +[](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system/-/commits/issue/2-test-front-end) # Client This documents describes how to install and run the client. -- GitLab From 99bfdd2823675d5d4b05ff2bd76a780993dbd213 Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 15:20:46 +0100 Subject: [PATCH 10/17] #2 Removed coverage badges from client readme --- client/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/README.md b/client/README.md index c4f50ce6..da908d16 100644 --- a/client/README.md +++ b/client/README.md @@ -1,6 +1,3 @@ - -[](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system/-/commits/issue/2-test-front-end) -[](https://gitlab.liu.se/tddd96-grupp11/teknikattan-scoring-system/-/commits/issue/2-test-front-end) # Client This documents describes how to install and run the client. -- GitLab From 243f7d904da82f59d39cfa21ecaf99aca5e9a64d Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 15:30:13 +0100 Subject: [PATCH 11/17] #2: Merged with dev branch --- .gitignore | 3 +- .gitlab-ci.yml | 51 +---- .gitlab/client.gitlab-ci.yml | 48 +++++ .gitlab/server.gitlab-ci.yml | 18 ++ .vscode/extensions.json | 3 +- .vscode/settings.json | 21 +- .vscode/tasks.json | 6 +- README.md | 2 + client/.eslintrc | 34 +++ client/.eslintrc.js | 26 --- client/.prettierrc | 6 + client/package-lock.json | 386 +++++++++++++++++++++++++++++----- client/package.json | 24 ++- client/src/App.test.tsx | 14 +- client/src/App.tsx | 27 ++- client/src/index.tsx | 14 +- client/src/reportWebVitals.ts | 18 +- client/src/setupTests.ts | 2 +- server/requirements.txt | Bin 1728 -> 1828 bytes server/test.py | 69 ------ server/tests/__init__.py | 18 ++ server/tests/test_app.py | 42 ++++ 22 files changed, 584 insertions(+), 248 deletions(-) create mode 100644 .gitlab/client.gitlab-ci.yml create mode 100644 .gitlab/server.gitlab-ci.yml create mode 100644 client/.eslintrc delete mode 100644 client/.eslintrc.js create mode 100644 client/.prettierrc delete mode 100644 server/test.py create mode 100644 server/tests/__init__.py create mode 100644 server/tests/test_app.py diff --git a/.gitignore b/.gitignore index 0d14ca4d..9f28e5cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ __pycache__ *.db */env -*.coverage \ No newline at end of file +*.coverage +.pytest_cache \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e43fa9fd..1c7b2a5c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,49 +1,6 @@ -image: node:10 - stages: - - install - - build - - quality - -install: - stage: install - script: - - cd client - - npm install - artifacts: - name: "artifacts" - untracked: true - expire_in: 60 mins - paths: - - client/.npm/ - - client/node_modules/ - -build: - stage: build - script: - - cd client - - CI=false npm run build - artifacts: - paths: - - client/build - expire_in: 60 mins - dependencies: - - install - -linting: - stage: quality - script: - - cd client - - npm run lint - dependencies: - - install + - setup + - test -test:unit: - stage: quality - script: - - cd client - - npm run test:coverage - dependencies: - - install - coverage: /All files\s*\|\s*([\d\.]+)/ - +include: + - local: .gitlab/server.gitlab-ci.yml diff --git a/.gitlab/client.gitlab-ci.yml b/.gitlab/client.gitlab-ci.yml new file mode 100644 index 00000000..2d5697d6 --- /dev/null +++ b/.gitlab/client.gitlab-ci.yml @@ -0,0 +1,48 @@ +image: node:10 + +stages: + - install + - build + - quality + +install: + stage: install + script: + - cd client + - npm install + artifacts: + name: "artifacts" + untracked: true + expire_in: 60 mins + paths: + - client/.npm/ + - client/node_modules/ + +build: + stage: build + script: + - cd client + - CI=false npm run build + artifacts: + paths: + - client/build + expire_in: 60 mins + dependencies: + - install + +linting: + stage: quality + script: + - cd client + - npm run lint + dependencies: + - install + +test:unit: + stage: quality + script: + - cd client + - npm run test:coverage + dependencies: + - install + coverage: /All files\s*\|\s*([\d\.]+)/ diff --git a/.gitlab/server.gitlab-ci.yml b/.gitlab/server.gitlab-ci.yml new file mode 100644 index 00000000..481e31bb --- /dev/null +++ b/.gitlab/server.gitlab-ci.yml @@ -0,0 +1,18 @@ +image: python + +cache: + paths: + - server/env/ + +before_script: + - python --version + - pip install virtualenv + - cd server/ + - python -m venv env + - source env/bin/activate + - pip install -r requirements.txt + +test-server: + stage: test + script: + - pytest --cov app tests/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json index d849a6db..9421e18e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -5,6 +5,7 @@ "pranaygp.vscode-css-peek", "dbaeumer.vscode-eslint", "ms-vsliveshare.vsliveshare", - "cssho.vscode-svgviewer" + "cssho.vscode-svgviewer", + "esbenp.prettier-vscode" ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 81f7de10..896cb947 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,13 @@ { + //editor "editor.formatOnSave": true, "editor.formatOnPaste": false, "editor.tabCompletion": "on", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + "source.organizeImports": true + }, + //python "python.venvPath": "${workspaceFolder}\\server", "python.analysis.extraPaths": ["server"], "python.terminal.activateEnvironment": true, @@ -11,5 +17,18 @@ "--line-length", "119" ], - "git.ignoreLimitWarning": true + //eslint + "eslint.workingDirectories": ["./client"], + "eslint.options": { + "configFile":"./.eslintrc" + }, + //git + "git.ignoreLimitWarning": true, + //language specific + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescriptreact]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 415547a1..7178e876 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -29,14 +29,12 @@ "label": "Test Server", "type": "shell", "group": "build", - "command": "${workspaceFolder}/server/env/Scripts/python test.py", + "command": "env/Scripts/pytest.exe --cov app tests/", "problemMatcher": [], "options": { "cwd": "${workspaceFolder}/server" }, - "presentation": { - "group": "Client/Server" - } + }, { "label": "Client + Server", diff --git a/README.md b/README.md index 339bd33f..d924ff12 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + + # Scoring system for Teknikåttan This is the scoring system for Teknikåttan! diff --git a/client/.eslintrc b/client/.eslintrc new file mode 100644 index 00000000..193fae78 --- /dev/null +++ b/client/.eslintrc @@ -0,0 +1,34 @@ + { + "env": { + "browser": true, + "es6": true, + "node": true + }, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "project": ["tsconfig.json"], + "ecmaVersion": 2021, + "sourceType": "module" + }, + + "settings": { + "react": { + "version": "detect" + } + }, + "extends": [ + "airbnb-typescript", + "plugin:@typescript-eslint/recommended", + "plugin:react/recommended", + "prettier/@typescript-eslint", + "plugin:prettier/recommended" + ], + "rules": { + "semi":"off", + "react/jsx-one-expression-per-line": "off" + + } +} diff --git a/client/.eslintrc.js b/client/.eslintrc.js deleted file mode 100644 index 6bd7839f..00000000 --- a/client/.eslintrc.js +++ /dev/null @@ -1,26 +0,0 @@ -module.exports = { - "env": { - "browser": true, - "es2021": true, - "node": true - }, - "extends": [ - "eslint:recommended", - "plugin:react/recommended", - "plugin:@typescript-eslint/recommended" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": 12, - "sourceType": "module" - }, - "plugins": [ - "react", - "@typescript-eslint" - ], - "rules": { - } -}; diff --git a/client/.prettierrc b/client/.prettierrc new file mode 100644 index 00000000..76ee677f --- /dev/null +++ b/client/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": false, + "trailingComma": "none", + "singleQuote": true, + "printWidth": 80 + } \ No newline at end of file diff --git a/client/package-lock.json b/client/package-lock.json index 4a876ccd..c8b2a048 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -2393,67 +2393,73 @@ "integrity": "sha512-37RSHht+gzzgYeobbG+KWryeAW8J33Nhr69cjTqSYymXVZEN9NbRYWoYlRtDhHKPVT1FyNKwaTPC1NynKZpzRA==" }, "@typescript-eslint/eslint-plugin": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.1.tgz", - "integrity": "sha512-yW2epMYZSpNJXZy22Biu+fLdTG8Mn6b22kR3TqblVk50HGNV8Zya15WAXuQCr8tKw4Qf1BL4QtI6kv6PCkLoJw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.2.0.tgz", + "integrity": "sha512-zBNRkzvLSwo6y5TG0DVcmshZIYBHKtmzD4N+LYnfTFpzc4bc79o8jNRSb728WV7A4Cegbs+MV5IRAj8BKBgOVQ==", + "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.15.1", - "@typescript-eslint/scope-manager": "4.15.1", + "@typescript-eslint/experimental-utils": "4.2.0", + "@typescript-eslint/scope-manager": "4.2.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", - "lodash": "^4.17.15", "regexpp": "^3.0.0", "semver": "^7.3.2", "tsutils": "^3.17.1" }, "dependencies": { "@typescript-eslint/experimental-utils": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.1.tgz", - "integrity": "sha512-9LQRmOzBRI1iOdJorr4jEnQhadxK4c9R2aEAsm7WE/7dq8wkKD1suaV0S/JucTL8QlYUPU1y2yjqg+aGC0IQBQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.2.0.tgz", + "integrity": "sha512-5BBj6BjgHEndBaQQpUVzRIPERz03LBc0MCQkHwUaH044FJFL08SwWv/sQftk7gf0ShZ2xZysz0LTwCwNt4Xu3w==", + "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.15.1", - "@typescript-eslint/types": "4.15.1", - "@typescript-eslint/typescript-estree": "4.15.1", + "@typescript-eslint/scope-manager": "4.2.0", + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/typescript-estree": "4.2.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/scope-manager": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", - "integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.2.0.tgz", + "integrity": "sha512-Tb402cxxObSxWIVT+PnBp5ruT2V/36yj6gG4C9AjkgRlZpxrLAzWDk3neen6ToMBGeGdxtnfFLoJRUecGz9mYQ==", + "dev": true, "requires": { - "@typescript-eslint/types": "4.15.1", - "@typescript-eslint/visitor-keys": "4.15.1" + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/visitor-keys": "4.2.0" } }, "@typescript-eslint/types": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", - "integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.2.0.tgz", + "integrity": "sha512-xkv5nIsxfI/Di9eVwN+G9reWl7Me9R5jpzmZUch58uQ7g0/hHVuGUbbn4NcxcM5y/R4wuJIIEPKPDb5l4Fdmwg==", + "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", - "integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.2.0.tgz", + "integrity": "sha512-iWDLCB7z4MGkLipduF6EOotdHNtgxuNKnYD54nMS/oitFnsk4S3S/TE/UYXQTra550lHtlv9eGmp+dvN9pUDtA==", + "dev": true, "requires": { - "@typescript-eslint/types": "4.15.1", - "@typescript-eslint/visitor-keys": "4.15.1", + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/visitor-keys": "4.2.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", + "lodash": "^4.17.15", "semver": "^7.3.2", "tsutils": "^3.17.1" } }, "@typescript-eslint/visitor-keys": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", - "integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.2.0.tgz", + "integrity": "sha512-WIf4BNOlFOH2W+YqGWa6YKLcK/EB3gEj2apCrqLw6mme1RzBy0jtJ9ewJgnrZDB640zfnv8L+/gwGH5sYp/rGw==", + "dev": true, "requires": { - "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/types": "4.2.0", "eslint-visitor-keys": "^2.0.0" } } @@ -2473,50 +2479,56 @@ } }, "@typescript-eslint/parser": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz", - "integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.2.0.tgz", + "integrity": "sha512-54jJ6MwkOtowpE48C0QJF9iTz2/NZxfKVJzv1ha5imigzHbNSLN9yvbxFFH1KdlRPQrlR8qxqyOvLHHxd397VA==", + "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.15.1", - "@typescript-eslint/types": "4.15.1", - "@typescript-eslint/typescript-estree": "4.15.1", + "@typescript-eslint/scope-manager": "4.2.0", + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/typescript-estree": "4.2.0", "debug": "^4.1.1" }, "dependencies": { "@typescript-eslint/scope-manager": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", - "integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.2.0.tgz", + "integrity": "sha512-Tb402cxxObSxWIVT+PnBp5ruT2V/36yj6gG4C9AjkgRlZpxrLAzWDk3neen6ToMBGeGdxtnfFLoJRUecGz9mYQ==", + "dev": true, "requires": { - "@typescript-eslint/types": "4.15.1", - "@typescript-eslint/visitor-keys": "4.15.1" + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/visitor-keys": "4.2.0" } }, "@typescript-eslint/types": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", - "integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.2.0.tgz", + "integrity": "sha512-xkv5nIsxfI/Di9eVwN+G9reWl7Me9R5jpzmZUch58uQ7g0/hHVuGUbbn4NcxcM5y/R4wuJIIEPKPDb5l4Fdmwg==", + "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", - "integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.2.0.tgz", + "integrity": "sha512-iWDLCB7z4MGkLipduF6EOotdHNtgxuNKnYD54nMS/oitFnsk4S3S/TE/UYXQTra550lHtlv9eGmp+dvN9pUDtA==", + "dev": true, "requires": { - "@typescript-eslint/types": "4.15.1", - "@typescript-eslint/visitor-keys": "4.15.1", + "@typescript-eslint/types": "4.2.0", + "@typescript-eslint/visitor-keys": "4.2.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", + "lodash": "^4.17.15", "semver": "^7.3.2", "tsutils": "^3.17.1" } }, "@typescript-eslint/visitor-keys": { - "version": "4.15.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", - "integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.2.0.tgz", + "integrity": "sha512-WIf4BNOlFOH2W+YqGWa6YKLcK/EB3gEj2apCrqLw6mme1RzBy0jtJ9ewJgnrZDB640zfnv8L+/gwGH5sYp/rGw==", + "dev": true, "requires": { - "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/types": "4.2.0", "eslint-visitor-keys": "^2.0.0" } } @@ -5700,6 +5712,100 @@ } } }, + "eslint-config-airbnb": { + "version": "18.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-18.2.1.tgz", + "integrity": "sha512-glZNDEZ36VdlZWoxn/bUR1r/sdFKPd1mHPbqUtkctgNG4yT2DLLtJ3D+yCV+jzZCc2V1nBVkmdknOJBZ5Hc0fg==", + "dev": true, + "requires": { + "eslint-config-airbnb-base": "^14.2.1", + "object.assign": "^4.1.2", + "object.entries": "^1.1.2" + } + }, + "eslint-config-airbnb-base": { + "version": "14.2.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz", + "integrity": "sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==", + "dev": true, + "requires": { + "confusing-browser-globals": "^1.0.10", + "object.assign": "^4.1.2", + "object.entries": "^1.1.2" + } + }, + "eslint-config-airbnb-typescript": { + "version": "12.3.1", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-12.3.1.tgz", + "integrity": "sha512-ql/Pe6/hppYuRp4m3iPaHJqkBB7dgeEmGPQ6X0UNmrQOfTF+dXw29/ZjU2kQ6RDoLxaxOA+Xqv07Vbef6oVTWw==", + "dev": true, + "requires": { + "@typescript-eslint/parser": "^4.4.1", + "eslint-config-airbnb": "^18.2.0", + "eslint-config-airbnb-base": "^14.2.0" + }, + "dependencies": { + "@typescript-eslint/parser": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz", + "integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "4.15.1", + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/typescript-estree": "4.15.1", + "debug": "^4.1.1" + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", + "integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1" + } + }, + "@typescript-eslint/types": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", + "integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", + "integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", + "integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.15.1", + "eslint-visitor-keys": "^2.0.0" + } + } + } + }, + "eslint-config-prettier": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz", + "integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==", + "dev": true + }, "eslint-config-react-app": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-6.0.0.tgz", @@ -5738,6 +5844,19 @@ } } }, + "eslint-import-resolver-typescript": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.4.0.tgz", + "integrity": "sha512-useJKURidCcldRLCNKWemr1fFQL1SzB3G4a0li6lFGvlc5xGe1hY343bvG07cbpCzPuM/lK19FIJB3XGFSkplA==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "resolve": "^1.17.0", + "tsconfig-paths": "^3.9.0" + } + }, "eslint-module-utils": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz", @@ -5874,6 +5993,16 @@ "@typescript-eslint/experimental-utils": "^4.0.1" } }, + "eslint-plugin-json": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-json/-/eslint-plugin-json-2.1.2.tgz", + "integrity": "sha512-isM/fsUxS4wN1+nLsWoV5T4gLgBQnsql3nMTr8u+cEls1bL8rRQO5CP5GtxJxaOfbcKqnz401styw+H/P+e78Q==", + "dev": true, + "requires": { + "lodash": "^4.17.19", + "vscode-json-languageservice": "^3.7.0" + } + }, "eslint-plugin-jsx-a11y": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz", @@ -5899,6 +6028,15 @@ } } }, + "eslint-plugin-prettier": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz", + "integrity": "sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, "eslint-plugin-react": { "version": "7.22.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.22.0.tgz", @@ -6414,6 +6552,12 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, "fast-glob": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", @@ -9575,6 +9719,12 @@ "minimist": "^1.2.5" } }, + "jsonc-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", + "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", + "dev": true + }, "jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -12004,6 +12154,21 @@ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "pretty-bytes": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.5.0.tgz", @@ -12477,6 +12642,84 @@ "webpack-dev-server": "3.11.0", "webpack-manifest-plugin": "2.2.0", "workbox-webpack-plugin": "5.1.4" + }, + "dependencies": { + "@typescript-eslint/eslint-plugin": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.15.1.tgz", + "integrity": "sha512-yW2epMYZSpNJXZy22Biu+fLdTG8Mn6b22kR3TqblVk50HGNV8Zya15WAXuQCr8tKw4Qf1BL4QtI6kv6PCkLoJw==", + "requires": { + "@typescript-eslint/experimental-utils": "4.15.1", + "@typescript-eslint/scope-manager": "4.15.1", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.15.1.tgz", + "integrity": "sha512-9LQRmOzBRI1iOdJorr4jEnQhadxK4c9R2aEAsm7WE/7dq8wkKD1suaV0S/JucTL8QlYUPU1y2yjqg+aGC0IQBQ==", + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.15.1", + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/typescript-estree": "4.15.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.15.1.tgz", + "integrity": "sha512-V8eXYxNJ9QmXi5ETDguB7O9diAXlIyS+e3xzLoP/oVE4WCAjssxLIa0mqCLsCGXulYJUfT+GV70Jv1vHsdKwtA==", + "requires": { + "@typescript-eslint/scope-manager": "4.15.1", + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/typescript-estree": "4.15.1", + "debug": "^4.1.1" + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.15.1.tgz", + "integrity": "sha512-ibQrTFcAm7yG4C1iwpIYK7vDnFg+fKaZVfvyOm3sNsGAerKfwPVFtYft5EbjzByDJ4dj1WD8/34REJfw/9wdVA==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1" + } + }, + "@typescript-eslint/types": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.15.1.tgz", + "integrity": "sha512-iGsaUyWFyLz0mHfXhX4zO6P7O3sExQpBJ2dgXB0G5g/8PRVfBBsmQIc3r83ranEQTALLR3Vko/fnCIVqmH+mPw==" + }, + "@typescript-eslint/typescript-estree": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.15.1.tgz", + "integrity": "sha512-z8MN3CicTEumrWAEB2e2CcoZa3KP9+SMYLIA2aM49XW3cWIaiVSOAGq30ffR5XHxRirqE90fgLw3e6WmNx5uNw==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "@typescript-eslint/visitor-keys": "4.15.1", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.15.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.15.1.tgz", + "integrity": "sha512-tYzaTP9plooRJY8eNlpAewTOqtWW/4ff/5wBjNVaJ0S0wC4Gpq/zDVRTJa5bq2v1pCNQ08xxMCndcvR+h7lMww==", + "requires": { + "@typescript-eslint/types": "4.15.1", + "eslint-visitor-keys": "^2.0.0" + } + } } }, "read-pkg": { @@ -15002,6 +15245,43 @@ "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" }, + "vscode-json-languageservice": { + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-3.11.0.tgz", + "integrity": "sha512-QxI+qV97uD7HHOCjh3MrM1TfbdwmTXrMckri5Tus1/FQiG3baDZb2C9Y0y8QThs7PwHYBIQXcAc59ZveCRZKPA==", + "dev": true, + "requires": { + "jsonc-parser": "^3.0.0", + "vscode-languageserver-textdocument": "^1.0.1", + "vscode-languageserver-types": "3.16.0-next.2", + "vscode-nls": "^5.0.0", + "vscode-uri": "^2.1.2" + } + }, + "vscode-languageserver-textdocument": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz", + "integrity": "sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==", + "dev": true + }, + "vscode-languageserver-types": { + "version": "3.16.0-next.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.2.tgz", + "integrity": "sha512-QjXB7CKIfFzKbiCJC4OWC8xUncLsxo19FzGVp/ADFvvi87PlmBSCAtZI5xwGjF5qE0xkLf0jjKUn3DzmpDP52Q==", + "dev": true + }, + "vscode-nls": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-5.0.0.tgz", + "integrity": "sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA==", + "dev": true + }, + "vscode-uri": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz", + "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==", + "dev": true + }, "w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -16496,4 +16776,4 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" } } -} +} \ No newline at end of file diff --git a/client/package.json b/client/package.json index e1e298dc..0b20527e 100644 --- a/client/package.json +++ b/client/package.json @@ -17,19 +17,27 @@ "axios": "^0.21.1", "web-vitals": "^1.1.0" }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "4.2.0", + "@typescript-eslint/parser": "4.2.0", + "eslint": "7.19.0", + "eslint-config-airbnb": "^18.2.1", + "eslint-config-airbnb-typescript": "^12.3.1", + "eslint-config-prettier": "^7.2.0", + "eslint-import-resolver-typescript": "^2.4.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-json": "^2.1.2", + "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-react": "^7.22.0", + "prettier": "^2.2.1" + }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint --ignore-path .gitignore .", - "test:coverage": "react-scripts test --coverage" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] + "lint": "eslint \"./src/**/*.{js,ts,tsx}\"" }, "browserslist": { "production": [ diff --git a/client/src/App.test.tsx b/client/src/App.test.tsx index 2a68616d..3a7a8cc5 100644 --- a/client/src/App.test.tsx +++ b/client/src/App.test.tsx @@ -1,9 +1,9 @@ -import React from 'react'; -import { render, screen } from '@testing-library/react'; -import App from './App'; +import React from 'react' +import { render, screen } from '@testing-library/react' +import App from './App' test('renders learn react link', () => { - render(<App />); - const linkElement = screen.getByText(/learn react/i); - expect(linkElement).toBeInTheDocument(); -}); + render(<App />) + const linkElement = screen.getByText(/learn react/i) + expect(linkElement).toBeInTheDocument() +}) diff --git a/client/src/App.tsx b/client/src/App.tsx index 6d9c9bdb..931b58fa 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,20 +1,19 @@ -import React from 'react'; -import logo from './logo.svg'; -import './App.css'; -import { useState, useEffect } from "react"; -import axios from "axios"; +import axios from 'axios' +import React, { useEffect, useState } from 'react' +import './App.css' +import logo from './logo.svg' interface Message { - message: string; + message: string } -function App() { - const [currentMessage, setCurrentMessage] = useState<Message>(); +const App: React.FC = () => { + const [currentMessage, setCurrentMessage] = useState<Message>() useEffect(() => { - axios.get<Message>("users/test").then(response=> { - setCurrentMessage(response.data); - }); - }, []); + axios.get<Message>('users/test').then((response) => { + setCurrentMessage(response.data) + }) + }, []) return ( <div className="App"> @@ -34,7 +33,7 @@ function App() { <p>Current message is {currentMessage?.message}</p> </header> </div> - ); + ) } -export default App; +export default App diff --git a/client/src/index.tsx b/client/src/index.tsx index ef2edf8e..e7b11a23 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -1,17 +1,17 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import './index.css'; -import App from './App'; -import reportWebVitals from './reportWebVitals'; +import React from 'react' +import ReactDOM from 'react-dom' +import App from './App' +import './index.css' +import reportWebVitals from './reportWebVitals' ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') -); +) // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); +reportWebVitals() diff --git a/client/src/reportWebVitals.ts b/client/src/reportWebVitals.ts index 49a2a16e..57a24a21 100644 --- a/client/src/reportWebVitals.ts +++ b/client/src/reportWebVitals.ts @@ -1,15 +1,15 @@ -import { ReportHandler } from 'web-vitals'; +import { ReportHandler } from 'web-vitals' const reportWebVitals = (onPerfEntry?: ReportHandler) => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); + getCLS(onPerfEntry) + getFID(onPerfEntry) + getFCP(onPerfEntry) + getLCP(onPerfEntry) + getTTFB(onPerfEntry) + }) } -}; +} -export default reportWebVitals; +export default reportWebVitals diff --git a/client/src/setupTests.ts b/client/src/setupTests.ts index 8f2609b7..52aaef1d 100644 --- a/client/src/setupTests.ts +++ b/client/src/setupTests.ts @@ -2,4 +2,4 @@ // allows you to do things like: // expect(element).toHaveTextContent(/react/i) // learn more: https://github.com/testing-library/jest-dom -import '@testing-library/jest-dom'; +import '@testing-library/jest-dom' diff --git a/server/requirements.txt b/server/requirements.txt index 15f3fb46c43a7c2d2eee3959e3fce08db255efc2..31bb42fb147e77cea0e83c9af0230046efacb0b4 100644 GIT binary patch delta 99 zcmX@WyM%AUDn`*{hJ1!HhE#?khD3&RAZ-hTrkfWs#xq-|G88kEfCbDL^cal5n3sWz dp@5+hC=QX;Wq=p}(gspt2!ud#^H-MBi~uFz6X5^= delta 17 ZcmZ3&cYt@pD#pzx7{i!1r?4Ji1OPwR28{p! diff --git a/server/test.py b/server/test.py deleted file mode 100644 index f69c5a7b..00000000 --- a/server/test.py +++ /dev/null @@ -1,69 +0,0 @@ -from app import create_app, db -import unittest -import json - - -class Test(unittest.TestCase): - def setUp(self): - """Before each test, set up a blank database""" - self.app = create_app("configmodule.TestingConfig") - self.app.testing = True - - self.client = self.app.test_client() - - with self.app.app_context(): - db.drop_all() - db.create_all() - - # Called after every test - def tearDown(self): - with self.app.app_context(): - db.session.remove() - db.drop_all() - - def test_user(self): - # Create user - rv = self.client.post( - "/api/users/", - data=json.dumps({"email": "test@test.se", "password": "abc123"}), - ) - rv_dict = json.loads(rv.data.decode()) - - assert rv.status_code == 200 - assert rv_dict["id"] == 1 - assert "password" not in rv_dict - assert rv_dict["email"] == "test@test.se" - - # Try loggin with wrong PASSWORD - rv = self.client.post("/api/users/login", data=json.dumps({"email": "test@test.se", "password": "abc1234"})) - assert rv.status_code == 401 - - # Try loggin with wrong Email - rv = self.client.post("/api/users/login", data=json.dumps({"email": "test1@test.se", "password": "abc1234"})) - assert rv.status_code == 401 - - # Try loggin with right PASSWORD - rv = self.client.post("/api/users/login", data=json.dumps({"email": "test@test.se", "password": "abc123"})) - rv_dict = json.loads(rv.data.decode()) - assert rv.status_code == 200 - headers = {"Authorization": "Bearer " + rv_dict["access_token"]} - - # Get the current user - rv = self.client.get("/api/users/", headers=headers) - rv_dict = json.loads(rv.data.decode()) - assert rv.status_code == 200 - assert rv_dict["email"] == "test@test.se" - - rv = self.client.put("/api/users/", data=json.dumps({"name": "carl carlsson"}), headers=headers) - rv_dict = json.loads(rv.data.decode()) - assert rv.status_code == 200 - assert rv_dict["name"] == "Carl Carlsson" - - def test_empty(self): - # Try loggin withou any users - rv = self.client.post("/api/users/login", data=json.dumps({"email": "test@test.se", "password": "abc123"})) - assert rv.status_code == 401 - - -if __name__ == "__main__": - unittest.main() diff --git a/server/tests/__init__.py b/server/tests/__init__.py new file mode 100644 index 00000000..0d8c1354 --- /dev/null +++ b/server/tests/__init__.py @@ -0,0 +1,18 @@ +import pytest +from app import create_app, db + + +@pytest.fixture +def app(): + app = create_app("configmodule.TestingConfig") + + with app.app_context(): + db.drop_all() + db.create_all() + + return app + + +@pytest.fixture +def client(app): + return app.test_client() diff --git a/server/tests/test_app.py b/server/tests/test_app.py new file mode 100644 index 00000000..2ee26647 --- /dev/null +++ b/server/tests/test_app.py @@ -0,0 +1,42 @@ +from tests import app, client +import json + + +def test_app(client): + + # Create user + rv = client.post( + "/api/users/", + data=json.dumps({"email": "test@test.se", "password": "abc123"}), + ) + rv_dict = json.loads(rv.data.decode()) + + assert rv.status_code == 200 + assert rv_dict["id"] == 1 + assert "password" not in rv_dict + assert rv_dict["email"] == "test@test.se" + + # Try loggin with wrong PASSWORD + rv = client.post("/api/users/login", data=json.dumps({"email": "test@test.se", "password": "abc1234"})) + assert rv.status_code == 401 + + # Try loggin with wrong Email + rv = client.post("/api/users/login", data=json.dumps({"email": "test1@test.se", "password": "abc1234"})) + assert rv.status_code == 401 + + # Try loggin with right PASSWORD + rv = client.post("/api/users/login", data=json.dumps({"email": "test@test.se", "password": "abc123"})) + rv_dict = json.loads(rv.data.decode()) + assert rv.status_code == 200 + headers = {"Authorization": "Bearer " + rv_dict["access_token"]} + + # Get the current user + rv = client.get("/api/users/", headers=headers) + rv_dict = json.loads(rv.data.decode()) + assert rv.status_code == 200 + assert rv_dict["email"] == "test@test.se" + + rv = client.put("/api/users/", data=json.dumps({"name": "carl carlsson"}), headers=headers) + rv_dict = json.loads(rv.data.decode()) + assert rv.status_code == 200 + assert rv_dict["name"] == "Carl Carlsson" -- GitLab From d73836db5142e3893ec59aeb077da05560c27d8a Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 15:36:49 +0100 Subject: [PATCH 12/17] #2: Removed unused stages --- .gitlab-ci.yml | 3 ++- .gitlab/client.gitlab-ci.yml | 21 ++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1c7b2a5c..c07a74ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - - setup + - install - test include: - local: .gitlab/server.gitlab-ci.yml + - local: .gitlab/client.gitlab-ci.yml diff --git a/.gitlab/client.gitlab-ci.yml b/.gitlab/client.gitlab-ci.yml index 2d5697d6..81e0f1e1 100644 --- a/.gitlab/client.gitlab-ci.yml +++ b/.gitlab/client.gitlab-ci.yml @@ -1,10 +1,5 @@ image: node:10 -stages: - - install - - build - - quality - install: stage: install script: @@ -18,20 +13,8 @@ install: - client/.npm/ - client/node_modules/ -build: - stage: build - script: - - cd client - - CI=false npm run build - artifacts: - paths: - - client/build - expire_in: 60 mins - dependencies: - - install - linting: - stage: quality + stage: test script: - cd client - npm run lint @@ -39,7 +22,7 @@ linting: - install test:unit: - stage: quality + stage: test script: - cd client - npm run test:coverage -- GitLab From 30fb141ef493dcc79afad098969a70df5c7104e9 Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 15:43:54 +0100 Subject: [PATCH 13/17] #2: Added separate stages for client and server --- .gitlab-ci.yml | 6 ++++-- .gitlab/server.gitlab-ci.yml | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c07a74ca..01004fdd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,8 @@ stages: - - install - - test + - server-install + - server-test + - client-install + - client-test include: - local: .gitlab/server.gitlab-ci.yml diff --git a/.gitlab/server.gitlab-ci.yml b/.gitlab/server.gitlab-ci.yml index 481e31bb..e4f75df4 100644 --- a/.gitlab/server.gitlab-ci.yml +++ b/.gitlab/server.gitlab-ci.yml @@ -5,6 +5,7 @@ cache: - server/env/ before_script: + stage: server-install - python --version - pip install virtualenv - cd server/ @@ -13,6 +14,6 @@ before_script: - pip install -r requirements.txt test-server: - stage: test + stage: server-test script: - pytest --cov app tests/ -- GitLab From bcbaca6be3bf003c084c10a0aa7b057a5cdfc05c Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 15:48:20 +0100 Subject: [PATCH 14/17] #2: Refactored server yml file --- .gitlab-ci.yml | 1 - .gitlab/server.gitlab-ci.yml | 23 ++++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 01004fdd..bc3e1186 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,4 @@ stages: - - server-install - server-test - client-install - client-test diff --git a/.gitlab/server.gitlab-ci.yml b/.gitlab/server.gitlab-ci.yml index e4f75df4..33d3934c 100644 --- a/.gitlab/server.gitlab-ci.yml +++ b/.gitlab/server.gitlab-ci.yml @@ -1,19 +1,16 @@ -image: python -cache: - paths: - - server/env/ - -before_script: - stage: server-install - - python --version - - pip install virtualenv - - cd server/ - - python -m venv env - - source env/bin/activate - - pip install -r requirements.txt test-server: + image: python + cache: + paths: + - server/env/ stage: server-test script: + - python --version + - pip install virtualenv + - cd server/ + - python -m venv env + - source env/bin/activate + - pip install -r requirements.txt - pytest --cov app tests/ -- GitLab From f51367b1028c3f8ca2e90153b2686a32ee15373d Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 15:49:37 +0100 Subject: [PATCH 15/17] #2: added client prefix to stages in client yml file --- .gitlab/client.gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab/client.gitlab-ci.yml b/.gitlab/client.gitlab-ci.yml index 81e0f1e1..2881ef9d 100644 --- a/.gitlab/client.gitlab-ci.yml +++ b/.gitlab/client.gitlab-ci.yml @@ -1,7 +1,7 @@ image: node:10 install: - stage: install + stage: client-install script: - cd client - npm install @@ -14,7 +14,7 @@ install: - client/node_modules/ linting: - stage: test + stage: client-test script: - cd client - npm run lint @@ -22,7 +22,7 @@ linting: - install test:unit: - stage: test + stage: client-test script: - cd client - npm run test:coverage -- GitLab From aaa6f54308e52abd145e1e47666c50d74657ca4f Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 15:55:30 +0100 Subject: [PATCH 16/17] #2: Re-added test:coverage script --- client/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/package.json b/client/package.json index 0b20527e..f85e71cc 100644 --- a/client/package.json +++ b/client/package.json @@ -37,7 +37,8 @@ "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint \"./src/**/*.{js,ts,tsx}\"" + "lint": "eslint \"./src/**/*.{js,ts,tsx}\"", + "test:coverage": "react-scripts test --coverage" }, "browserslist": { "production": [ -- GitLab From b101a307d131538c3435ae2b4684de5b733e474d Mon Sep 17 00:00:00 2001 From: Albin Henriksson <albhe428@student.liu.se> Date: Tue, 16 Feb 2021 16:01:15 +0100 Subject: [PATCH 17/17] #2: Removed non-functioning linting task --- .gitlab/client.gitlab-ci.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.gitlab/client.gitlab-ci.yml b/.gitlab/client.gitlab-ci.yml index 2881ef9d..42d3266e 100644 --- a/.gitlab/client.gitlab-ci.yml +++ b/.gitlab/client.gitlab-ci.yml @@ -13,14 +13,6 @@ install: - client/.npm/ - client/node_modules/ -linting: - stage: client-test - script: - - cd client - - npm run lint - dependencies: - - install - test:unit: stage: client-test script: -- GitLab