diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..0c08aab --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,6 @@ +coverage: + status: + project: + default: + target: 100% + threshold: 0% diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index c9ce076..27f7582 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -39,14 +39,10 @@ jobs: run: go build -v ./... - name: Go test - run: go test -v -coverprofile=coverage.out ./... + run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - - name: Go coverage - env: - CODE_COVERAGE_THRESHOLD: 100 - run: ./scripts/coverage.sh + diff --git a/scripts/coverage.sh b/scripts/coverage.sh deleted file mode 100755 index 2e5dc93..0000000 --- a/scripts/coverage.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -COVERAGE_FILE=coverage.out - -if [ -z "$CODE_COVERAGE_THRESHOLD" ] -then - echo "No code coverage threshold is set." - exit 0 -fi - -echo "Code coverage threshold ${CODE_COVERAGE_THRESHOLD}%" - -if [ ! -e "$COVERAGE_FILE" ] -then - echo "Coverage file ${COVERAGE_FILE} is not found." - exit 1 -fi - -CODE_COVERAGE=$(go tool cover -func=coverage.out | grep "total:" | grep -E -o '[0-9]+\.[0-9]+') - -if awk "BEGIN { exit !($CODE_COVERAGE < $CODE_COVERAGE_THRESHOLD)}" -then - echo "Current code coverage ${CODE_COVERAGE}% is below the ${CODE_COVERAGE_THRESHOLD}% threshold." - exit 1 -fi