mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Add codecov to Go unit tests (#282)
Adds code coverage to Go unit tests. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Integrated automated unit test coverage reporting with Codecov integration * Restructured test execution to separate unit and end-to-end tests into distinct workflows <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -33,8 +33,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make -B generate
|
make -B generate
|
||||||
git diff --exit-code
|
git diff --exit-code
|
||||||
- name: Running unit tests
|
- name: Run unit tests
|
||||||
run: make test
|
run: make test-unit
|
||||||
|
- name: Upload coverage reports to Codecov
|
||||||
|
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 #v6.0.1
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
flags: unit
|
||||||
e2e:
|
e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -44,5 +49,5 @@ jobs:
|
|||||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
|
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c #v6.4.0
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
- name: Running e2e tests
|
- name: Run e2e tests
|
||||||
run: make test-e2e
|
run: make -B test-e2e
|
||||||
|
|||||||
+2
-2
@@ -10,8 +10,8 @@ Dockerfile.cross
|
|||||||
# Test binary, built with `go test -c`
|
# Test binary, built with `go test -c`
|
||||||
*.test
|
*.test
|
||||||
|
|
||||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
# Output of the go coverage tool.
|
||||||
*.out
|
coverage.txt
|
||||||
|
|
||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ docs/api-reference.md: $(shell find api) docs/.crd-ref-docs.yaml
|
|||||||
lint:
|
lint:
|
||||||
@golangci-lint run ./...
|
@golangci-lint run ./...
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test-unit
|
||||||
test: setup-envtest
|
test-unit: setup-envtest
|
||||||
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v $$(go list ./... | grep -v /e2e) -coverprofile cover.out
|
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./... -coverprofile=coverage.txt
|
||||||
|
|
||||||
test-e2e: build-image
|
test-e2e: build-image
|
||||||
cd ./test/e2e && IMG_REF=${IMG_REF} go test ./... -v -count 1
|
cd ./test/e2e && IMG_REF=${IMG_REF} go test ./... -v -count 1
|
||||||
|
|||||||
Reference in New Issue
Block a user