Skip to content

Commit

Permalink
chore: add coverage upload to Codecov (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
philprime authored Feb 7, 2025
1 parent 4cd92d9 commit b82807c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ jobs:
run: yarn install --frozen-lockfile
- name: Run Unit Tests
run: yarn test
- name: Push code coverage to codecov
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # [email protected]
with:
# Need to specify the token here, as the codecov action requires it for protected branches.
# If not set, this error is shown: `Token required because branch is protected`
token: ${{ secrets.CODECOV_TOKEN }}
# Do not fail the build if codecov fails to report the coverage.
fail_ci_if_error: false
flags: unit-tests

job_e2e_test:
name: ${{ matrix.wizard }} E2E Tests
Expand Down Expand Up @@ -101,3 +110,12 @@ jobs:
run: yarn install --frozen-lockfile
- name: Run End-to-End Tests
run: yarn test:e2e ${{ matrix.wizard }}
- name: Push code coverage to codecov
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # [email protected]
with:
# Need to specify the token here, as the codecov action requires it for protected branches.
# If not set, this error is shown: `Token required because branch is protected`
token: ${{ secrets.CODECOV_TOKEN }}
# Do not fail the build if codecov fails to report the coverage.
fail_ci_if_error: false
flags: e2e-tests
15 changes: 15 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Reference: https://docs.codecov.com/docs/codecovyml-reference

codecov:
# Codecov should wait for all other statuses to pass before sending its status.
require_ci_to_pass: true
notify:
# Codecov will wait for all CI statuses to complete before sending its status.
# Note: Codecov considers all non-codecov statuses to be CI statuses.
wait_for_ci: true

coverage:
# The coverage percentage that should be reached before the build is considered successful.
# Note: This is set to a low value, as the test coverage is not high yet.
# When adding more test coverage, consider increasing this value.
range: 40...100
1 change: 1 addition & 0 deletions e2e-tests/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ config({
});

export default {
collectCoverage: true,
testTimeout: 360000,
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
Expand Down

0 comments on commit b82807c

Please sign in to comment.