From 83c67b33be47ba9f9f7beb24ea4e95b1e588d008 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Thu, 14 Mar 2024 10:35:43 +0100 Subject: [PATCH] Add codecov configuration file and simplify coverage profile generation A codecov.yml configuration file has been added to specify the coverage target and other codecov settings. The CI pipeline has also been streamlined to directly generate the coverage profile without using grep for filtering ignored code paths. This makes it easier to understand and maintain the testing and coverage reporting process. --- .github/workflows/codecov.yml | 7 ++----- codecov.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 0ea7337..81020b6 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -36,12 +36,9 @@ jobs: go-version: ${{ matrix.go }} - name: Run Tests run: | - go test -v -race --coverprofile=coverage.coverprofile.tmp --covermode=atomic ./... - - name: Remove ignored code from coverage profile - run: | - grep -v -E '(apg-go/cmd/apg/apg.go|apg-go/example-code)' coverage.coverprofile.tmp > coverage.coverprofile + go test -v -race --coverprofile=coverage.coverprofile --covermode=atomic ./... - name: Upload coverage to Codecov if: success() && matrix.go == '1.22' && matrix.os == 'ubuntu-latest' uses: codecov/codecov-action@v3 with: - token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..5a395e4 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: 2022-2023 The go-mail Authors +# +# SPDX-License-Identifier: CC0-1.0 + +coverage: + status: + project: + default: + target: 85% + threshold: 5% + base: auto + if_ci_failed: error + only_pulls: false + patch: + default: + target: 80% + base: auto + if_ci_failed: error + threshold: 5% + +comment: + require_changes: true + +ignore: + - "cmd/apg" + - "example-code"