From b82807c3524e11e3ac4d2364451ca207e2506b40 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Fri, 7 Feb 2025 10:08:07 +0100 Subject: [PATCH] chore: add coverage upload to Codecov (#781) --- .github/workflows/build.yml | 18 ++++++++++++++++++ codecov.yml | 15 +++++++++++++++ e2e-tests/jest.config.ts | 1 + 3 files changed, 34 insertions(+) create mode 100644 codecov.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40af213c..7aae3bf1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 # pin@v5.3.1 + 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 @@ -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 # pin@v5.3.1 + 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 diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..bf1842b7 --- /dev/null +++ b/codecov.yml @@ -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 \ No newline at end of file diff --git a/e2e-tests/jest.config.ts b/e2e-tests/jest.config.ts index d4d109c4..956a21bc 100644 --- a/e2e-tests/jest.config.ts +++ b/e2e-tests/jest.config.ts @@ -5,6 +5,7 @@ config({ }); export default { + collectCoverage: true, testTimeout: 360000, testEnvironment: 'node', testMatch: ['**/*.test.ts'],