Skip to content

Commit

Permalink
[NoMongo] Fix : CodeCov GitHub Action (#3271)
Browse files Browse the repository at this point in the history
* fix: codecov coverage report merging

* fix: update to latest version

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* refactor: remove redundant steps

* try alter approach

* refactor!: ignore docss/

* Update pull-request.yml

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
varshith257 and coderabbitai[bot] authored Jan 14, 2025
1 parent 9e5f4aa commit 8de0476
Showing 1 changed file with 32 additions and 19 deletions.
51 changes: 32 additions & 19 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,27 +245,50 @@ jobs:
uses: tj-actions/changed-files@v45

- name: Run Jest Tests
if: steps.changed-files.outputs.only_changed != 'true'
if: steps.changed-files.outputs.any_changed == 'true'
env:
NODE_V8_COVERAGE: './coverage/jest'
run: |
npm run test -- --watchAll=false --coverage
- name: Upload Jest Coverage to Codecov
if: steps.changed-files.outputs.any_changed == 'true'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/jest/lcov.info
flags: jest
fail_ci_if_error: true

- name: Run Vitest Tests
if: steps.changed-files.outputs.only_changed != 'true'
if: steps.changed-files.outputs.any_changed == 'true'
env:
NODE_V8_COVERAGE: './coverage/vitest'
run: |
npm run test:vitest:coverage
- name: Merge Coverage Reports
if: steps.changed-files.outputs.only_changed != 'true'
- name: Upload Vitest Coverage to Codecov
if: steps.changed-files.outputs.any_changed == 'true'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/vitest/lcov.info
flags: vitest
fail_ci_if_error: true

- name: Merge Jest and Vitest Coverage Reports
run: |
mkdir -p coverage
if ! npx lcov-result-merger 'coverage/*/lcov.info' > 'coverage/lcov.info'; then
echo "Failed to merge coverage reports"
exit 1
fi
mkdir -p ./coverage
npx lcov-result-merger './coverage/*/lcov.info' './coverage/lcov.info'
- name: Upload Combined Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
gcov_ignore: 'docs/'
files: ./coverage/lcov.info
flags: combined
fail_ci_if_error: true

- name: TypeScript compilation for changed files
run: |
Expand All @@ -275,16 +298,6 @@ jobs:
fi
done
- name: Present and Upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
gcov_ignore: 'docs/'
fail_ci_if_error: false
files: './coverage/lcov.info'
name: '${{env.CODECOV_UNIQUE_NAME}}'

- name: Test acceptable level of code coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
Expand Down

0 comments on commit 8de0476

Please sign in to comment.