Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test coverage check to CI.yaml #13

Merged
merged 10 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See http://docs.codecov.io/docs/coverage-configuration
coverage:
precision: 2 # 2 = xx.xx%, 0 = xx%
round: down
# For example: 20...60 would result in any coverage less than 20%
# would have a red background. The color would gradually change to
# green approaching 60%. Any coverage over 60% would result in a
# solid green color.
range: "60...80"

status:
# project will give us the diff in the total code coverage between a commit
# and its parent
project: yes
# Patch gives just the coverage of the patch
patch: yes
# changes tells us if there are unexpected code coverage changes in other files
# which were not changed by the diff
changes: yes

# See http://docs.codecov.io/docs/ignoring-paths
ignore:
- "docs/*"
- ".github/*"
- "resources/*"
- "test/*"
- "Makefile"

# See http://docs.codecov.io/docs/pull-request-comments-1
comment:
layout: "diff, files"
behavior: ""
# default = posts once then update, posts new if delete
# once = post once then updates
# new = delete old, post new
# spammy = post new
18 changes: 17 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,20 @@ jobs:
uses: github/codeql-action/upload-sarif@v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: gosec.sarif
sarif_file: gosec.sarif

code-coverage-report:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
with:
persist-credentials: false
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Run tests
run: make test
- name: Codecov
uses: codecov/codecov-action@v3.1.4
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ buildWin:

.PHONY: test
test:
go test ./...
go test -coverprofile cover.out -v ./...