From 31b2a1b9e2c83fa932fb04bf096bd54eca271afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Marqu=C3=ADnez=20Prado?= <25435858+inigomarquinez@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:52:34 +0200 Subject: [PATCH 1/4] test: add test coverage --- .gitignore | 5 ++++- package.json | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 38dfb409..bd08be82 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,7 @@ yarn-error.log* license-report.md .idea -.eslintcache \ No newline at end of file +.eslintcache + +# tests coverage +coverage \ No newline at end of file diff --git a/package.json b/package.json index f275a397..a4d4d11e 100644 --- a/package.json +++ b/package.json @@ -19,12 +19,13 @@ "build": "rollup -c", "prepare": "run-s build && husky install", "test": "npx @guidesmiths/license-checker --failOn AGPL --outputFileName License-report --errorReportFileName License-error | run-s test:unit test:lint test:build", + "coverage": "npm run test:unit -- --coverage", "test:build": "run-s build", "test:lint": "eslint src --ext .js,.jsx --config .eslintrc --ignore-path .eslintignore --cache", - "eslint:fix": "eslint . --ext .js,.jsx --fix", - "lint": "npm run test:lint", "test:unit": "cross-env CI=1 react-scripts test --env=jsdom --passWithNoTests", "test:watch": "react-scripts test --env=jsdom", + "eslint:fix": "eslint . --ext .js,.jsx --fix", + "lint": "npm run test:lint", "predeploy": "cd example && npm install && npm run build", "deploy": "gh-pages -d example/build", "release:patch": "git tag -l | xargs git tag -d && changelog -p && git add CHANGELOG.md && git commit -m 'chore: updated CHANGELOG.md' && npm version patch && git push origin && git push origin --tags", From c308040feddda34578c4e15a8b8f89153436f6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Marqu=C3=ADnez=20Prado?= <25435858+inigomarquinez@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:52:54 +0200 Subject: [PATCH 2/4] ci: add code climate gh action for test coverage --- .../workflows/code-climate-test-coverage.yml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/code-climate-test-coverage.yml diff --git a/.github/workflows/code-climate-test-coverage.yml b/.github/workflows/code-climate-test-coverage.yml new file mode 100644 index 00000000..de554bec --- /dev/null +++ b/.github/workflows/code-climate-test-coverage.yml @@ -0,0 +1,33 @@ +name: Code Climate Test Reporter + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: # added using https://github.com/step-security/secure-workflows + contents: read + +jobs: + code-climate: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 + with: + egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs + + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 + with: + node-version: '18.x' + - run: npm ci + - run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - run: chmod +x ./cc-test-reporter + - run: ./cc-test-reporter before-build + - run: npm run coverage + - run: ./cc-test-reporter format-coverage -t lcov coverage/lcov.info + - run: ./cc-test-reporter upload-coverage + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} From 0074b22f46ede27963359aeb655dd094632d61ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Marqu=C3=ADnez=20Prado?= <25435858+inigomarquinez@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:54:35 +0200 Subject: [PATCH 3/4] ci: add code climate gh action for test coverage --- .github/workflows/code-climate-test-coverage.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/code-climate-test-coverage.yml b/.github/workflows/code-climate-test-coverage.yml index de554bec..84eb8faf 100644 --- a/.github/workflows/code-climate-test-coverage.yml +++ b/.github/workflows/code-climate-test-coverage.yml @@ -3,8 +3,6 @@ name: Code Climate Test Reporter on: push: branches: [main] - pull_request: - branches: [main] permissions: # added using https://github.com/step-security/secure-workflows contents: read From 257d4db937a3bb40571d30616cfb45790bd057fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8D=C3=B1igo=20Marqu=C3=ADnez=20Prado?= <25435858+inigomarquinez@users.noreply.github.com> Date: Wed, 4 Oct 2023 13:55:11 +0200 Subject: [PATCH 4/4] docs: remove pr template to use the org pr template --- .github/PULL_REQUEST_TEMPLATE.md | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 1229a31c..00000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,20 +0,0 @@ -### Type: - -- [ ] CI/CD: helm, docker & CI/CD adjustments. -- [ ] feature: new capabilities. -- [ ] fix: bug, hotfix, etc. -- [ ] refactor: enhancements. -- [ ] style: changes in styles. -- [ ] other: docs, tests. - -### What's the focus of this PR: - -### How to review this PR: - -### Related work items - -### Before submitting this PR, I made sure: - -- [ ] There is no lint error in the code -- [ ] Build process passes successfully -- [ ] There are some tests