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 diff --git a/.github/workflows/code-climate-test-coverage.yml b/.github/workflows/code-climate-test-coverage.yml new file mode 100644 index 00000000..84eb8faf --- /dev/null +++ b/.github/workflows/code-climate-test-coverage.yml @@ -0,0 +1,31 @@ +name: Code Climate Test Reporter + +on: + push: + 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 }} 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",