diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1f2c2f6..a997591 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,9 +17,15 @@ jobs: go-version: 1.15 - name: Check-out code uses: actions/checkout@v2 + with: + fetch-depth: 2 - name: Run unit tests run: | make test + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + file: coverage.txt tidy: runs-on: [ubuntu-latest] diff --git a/Makefile b/Makefile index 8965ad4..a443a5d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ all: test .PHONY: test test: - $(GO) test -v ./... + $(GO) test -v -coverprofile coverage.txt -covermode=atomic -coverpkg=antrea.io/libOpenflow/common/...,antrea.io/libOpenflow/openflow15/...,antrea.io/libOpenflow/protocol/...,antrea.io/libOpenflow/util/... antrea.io/libOpenflow/... # code linting .golangci-bin: diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 0000000..779333e --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,32 @@ +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: false + project: + default: + target: auto + threshold: 0.1% + +flag_management: + default_rules: + carryforward: true