Skip to content

Commit

Permalink
Measure code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Sep 7, 2023
1 parent 5dda31b commit 1e5a8bc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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:
- "**/*_scale.go"
- "**/*mock*.go"
- "**/mocks/*.go"
19 changes: 19 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1e5a8bc

Please sign in to comment.