diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..bcbeb6b --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,19 @@ +# ref: https://docs.codecov.com/docs/codecovyml-reference +coverage: + range: 80..100 + round: down + precision: 1 + status: + # ref: https://docs.codecov.com/docs/commit-status + project: + default: + # Avoid false negatives + threshold: 1% + +ignore: + - "poet.go" + - "cmd" + - "release" + - "**/*_scale.go" + - "**/*mock*.go" + - "**/mocks/*.go" diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 47f2160..d66250e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,8 +1,5 @@ name: Go -env: - go-version: "1.19" - on: pull_request: push: @@ -17,7 +14,8 @@ jobs: - name: set up go uses: actions/setup-go@v4 with: - go-version: ${{ env.go-version }} + check-latest: true + go-version-file: "go.mod" - name: fmt, tidy run: | make install @@ -35,7 +33,8 @@ jobs: - name: set up go uses: actions/setup-go@v4 with: - go-version: ${{ env.go-version }} + check-latest: true + go-version-file: "go.mod" - name: setup env run: make install - name: lint @@ -57,7 +56,8 @@ jobs: - name: set up go uses: actions/setup-go@v4 with: - go-version: ${{ env.go-version }} + check-latest: true + go-version-file: "go.mod" - name: setup env run: make install - name: Clear test cache @@ -74,3 +74,22 @@ jobs: with: report_paths: "**/unit-tests.xml" annotate_only: true + + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: set up go + uses: actions/setup-go@v4 + with: + check-latest: true + go-version-file: "go.mod" + - name: setup env + run: make install + - name: test coverage + run: make cover + - name: Upload to codecov.io + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/Makefile b/Makefile index bc11ebf..0ad7cb2 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ lint-github-action: .PHONY: lint-github-action cover: - go test -coverprofile=cover.out -timeout 0 -p 1 $(UNIT_TESTS) + go test -coverprofile=cover.out -timeout 0 -p 1 -coverpkg=./... $(UNIT_TESTS) .PHONY: cover staticcheck: