Skip to content

Commit

Permalink
Add Code Coverage to the project
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Jain <[email protected]>
  • Loading branch information
reachjainrahul committed Oct 12, 2022
1 parent a69824b commit 9a647f6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ jobs:
mkdir -p $(go env GOCACHE)
sudo make unit-test
- name: Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage-unit.txt
flags: unit-tests
name: codecov-unit-test

golangci-lint:
needs: check-changes
if: ${{ needs.check-changes.outputs.has_changes == 'yes' }}
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ mock: docker-builder

# Run unit-tests
unit-test: mock
$(DOCKERIZE) go test -v -cover -count 1 $$(go list antrea.io/nephe/pkg/...) --ginkgo.v
$(DOCKERIZE) go test -coverprofile=coverage-unit.txt \
-covermode=atomic -count 1 $$(go list antrea.io/nephe/pkg/...)

# Run lint against code
golangci-lint: docker-builder
Expand Down
36 changes: 36 additions & 0 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
codecov:
branch: main
require_ci_to_pass: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no
require_base: no
require_head: no
after_n_builds: 1
show_carryforward_flags: true

github_checks:
annotations: true

coverage:
status:
patch:
default:
target: 70%
threshold: 5%
base: auto
only_pulls: true
flags:
- unit-tests
project:
default:
target: auto
threshold: 1%
flags:
- unit-tests

flag_management:
default_rules:
carryforward: true

0 comments on commit 9a647f6

Please sign in to comment.