diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2cdf36c..5918e78 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,17 @@ jobs: run: go vet ./... - name: Run Go test run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... - - name: Upload coverage to Codeclimate + + # Because the module path differs from the path, we have to to remove the prefix from + # the cover file. See also: + # https://github.com/paambaati/codeclimate-action/issues/109#issuecomment-751311299 + - name: Adjust code coverage report for CodeClimate + run: | + export GO_MODULE_NAME=(go mod edit -json | jq -r '.Module.Path') + sed -i "s%$GO_MODULE_NAME/%%" coverage.txt + + - name: Upload coverage to CodeClimate + if: ${{ github.event.name != 'pull_request' }} uses: paambaati/codeclimate-action@v5 with: coverageLocations: "coverage.txt:gocov"