From b97828e95bc164387e2565ddbddbc624e3cc2d59 Mon Sep 17 00:00:00 2001 From: Pierre Huyghe Date: Sun, 20 Mar 2022 23:13:04 +0100 Subject: [PATCH] ci(codecov): fix code coverage (#74) --- .github/workflows/main.yml | 22 ++++++------ .github/workflows/release.yml | 10 +++--- apps/demo/jest.config.js | 1 + codecov.yml | 35 ++++++++++++++++--- libs/form-builder/jest.config.js | 1 + libs/form-context/jest.config.js | 1 + libs/form-editor/jest.config.js | 1 + libs/form-redux/jest.config.js | 1 + libs/form-validation-rule-list/jest.config.js | 1 + 9 files changed, 53 insertions(+), 20 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 74e9537..3ebe706 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,13 +25,13 @@ jobs: - run: yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline - run: npx nx affected --target=lint --parallel --max-parallel=3 - run: npx nx affected --target=build --parallel --max-parallel=3 - - run: npx nx affected --target=test --parallel --max-parallel=2 + - run: npx nx affected --target=test --parallel --max-parallel=2 --code-coverage - run: npx nx affected --target=e2e --parallel --max-parallel=2 - # - name: Codecov upload - # uses: codecov/codecov-action@v2 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} + - name: Codecov upload + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} pr: runs-on: ubuntu-latest @@ -54,11 +54,11 @@ jobs: - run: yarn install --frozen-lockfile --non-interactive --no-progress --prefer-offline - run: npx nx affected --base=origin/master --target=lint --parallel --max-parallel=3 - run: npx nx affected --base=origin/master --target=build --parallel --max-parallel=3 - - run: npx nx affected --base=origin/master --target=test --parallel --max-parallel=2 --coverage --outputFile=coverage-final.json --json + - run: npx nx affected --base=origin/master --target=test --parallel --max-parallel=2 --code-coverage - run: npx nx affected --base=origin/master --target=e2e --parallel --max-parallel=2 - # - name: Codecov upload - # uses: codecov/codecov-action@v2 - # with: - # verbose: true - # token: ${{ secrets.CODECOV_TOKEN }} + - name: Codecov upload + uses: codecov/codecov-action@v2 + with: + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ead680..322e9bc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,11 +32,11 @@ jobs: - name: Build run: yarn nx affected:build --base=last-release - name: Unit tests - run: yarn nx affected:test --base=last-release - # - name: Codecov upload - # uses: codecov/codecov-action@v2 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} + run: yarn nx affected:test --base=last-release --code-coverage + - name: Codecov upload + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} release: runs-on: ubuntu-latest diff --git a/apps/demo/jest.config.js b/apps/demo/jest.config.js index 5918ceb..a385249 100644 --- a/apps/demo/jest.config.js +++ b/apps/demo/jest.config.js @@ -7,4 +7,5 @@ module.exports = { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/apps/demo', + coverageReporters: ['html', 'lcov'], }; diff --git a/codecov.yml b/codecov.yml index 4f0299e..777579d 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,10 +3,22 @@ coverage: round: down status: project: - builder: - target: 70% + form-builder: + target: 90% flags: - - builder + - form-builder + form-redux: + target: 90% + flags: + - form-redux + form-context: + target: 90% + flags: + - form-context + form-validation-rule-list: + target: 90% + flags: + - form-validation-rule-list patch: default: enabled: no @@ -16,6 +28,21 @@ coverage: enabled: no if_not_found: success flags: - builder: + form-builder: paths: - libs/form-builder/src + form-redux: + paths: + - libs/form-redux/src + form-context: + paths: + - libs/form-context/src + form-validation-rule-list: + paths: + - libs/form-validation-rule-list/src + +ignore: + - "apps/demo/**/*" + - "apps/docsite/**/*" + - "libs/form-editor/**/*" + - "libs/examples/**/*" diff --git a/libs/form-builder/jest.config.js b/libs/form-builder/jest.config.js index ef5d1d6..ff81b2e 100644 --- a/libs/form-builder/jest.config.js +++ b/libs/form-builder/jest.config.js @@ -6,4 +6,5 @@ module.exports = { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/form-builder', + coverageReporters: ['html', 'lcov'], }; diff --git a/libs/form-context/jest.config.js b/libs/form-context/jest.config.js index dba52b6..5c3e3dc 100644 --- a/libs/form-context/jest.config.js +++ b/libs/form-context/jest.config.js @@ -6,4 +6,5 @@ module.exports = { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/form-context', + coverageReporters: ['html', 'lcov'], }; diff --git a/libs/form-editor/jest.config.js b/libs/form-editor/jest.config.js index 8097e2f..3f121e4 100644 --- a/libs/form-editor/jest.config.js +++ b/libs/form-editor/jest.config.js @@ -6,4 +6,5 @@ module.exports = { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/form-editor', + coverageReporters: ['html', 'lcov'], }; diff --git a/libs/form-redux/jest.config.js b/libs/form-redux/jest.config.js index 82c9c06..de99b44 100644 --- a/libs/form-redux/jest.config.js +++ b/libs/form-redux/jest.config.js @@ -11,4 +11,5 @@ module.exports = { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/form-redux', + coverageReporters: ['html', 'lcov'], }; diff --git a/libs/form-validation-rule-list/jest.config.js b/libs/form-validation-rule-list/jest.config.js index 191abe8..47a7eea 100644 --- a/libs/form-validation-rule-list/jest.config.js +++ b/libs/form-validation-rule-list/jest.config.js @@ -6,4 +6,5 @@ module.exports = { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], coverageDirectory: '../../coverage/libs/form-validation-rule-list', + coverageReporters: ['html', 'lcov'], };