diff --git a/.circleci/config.yml b/.circleci/config.yml index d9b17328..544cde9e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,5 @@ version: 2.1 -orbs: - codecov: codecov/codecov@4.1.0 - executors: executor_node_18: docker: @@ -114,14 +111,6 @@ jobs: - command_checkout_cache_install - command_test_and_build - job_upload_coverage: - description: Upload coverage to Codecov - executor: executor_node_20 - steps: - - command_restore_workspace - - codecov/upload: - file: coverage/*.json - job_publish_to_npm: description: Publish package to npm executor: executor_node_20 @@ -175,16 +164,6 @@ workflows: branches: only: /.*/ - - job_upload_coverage: - requires: - - job_node_18_test_and_build - - job_node_20_test_and_build - - job_node_21_test_and_build - - job_node_22_test_and_build - filters: - branches: - only: /main/ - - job_publish_to_npm: context: npm requires: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b769a02c..6dd71aac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,14 +17,30 @@ jobs: uses: './.github/workflows/lint-test-build.yml' job_upload_coverage: - name: Upload Coverage + name: Upload Coverage Report to Codecov runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref_type == 'branch' needs: job_lint_test_build steps: - - run: echo "not implemented yet..." + - name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies + uses: manferlo81/action-checkout-node-install@v0 + with: + node-version: ${{ env.NODE_VERSION }} + env: + NODE_VERSION: 20.x + + - name: Collect Coverage + run: npm test + env: + COVERAGE: CI + + - name: Upload Coverage Report + uses: codecov/codecov-action@v4 + with: + directory: coverage + token: ${{ secrets.CODECOV_TOKEN }} job_create_release: name: Create GitHub Release diff --git a/.github/workflows/lint-test-build.yml b/.github/workflows/lint-test-build.yml index 7069a5f6..d4488739 100644 --- a/.github/workflows/lint-test-build.yml +++ b/.github/workflows/lint-test-build.yml @@ -50,7 +50,7 @@ jobs: - name: Test run: npm test env: - SKIP_COVERAGE: true + COVERAGE: SKIP - name: Build run: npm run build diff --git a/jest.config.mjs b/jest.config.mjs index e42fbc8a..f94bb8f3 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -1,14 +1,16 @@ +const { COVERAGE } = process.env; + /** @type { import("jest").Config } */ const config = { cacheDirectory: 'node_modules/.cache/jest', preset: 'ts-jest', - collectCoverage: !process.env.SKIP_COVERAGE, + collectCoverage: COVERAGE !== 'SKIP', collectCoverageFrom: [ 'src/**/*.ts', ], coverageDirectory: 'coverage', - coverageReporters: process.env.CI + coverageReporters: COVERAGE === 'CI' ? ['json', 'clover', 'cobertura'] : ['html', 'text'],