diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07de040..685a429 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,3 +13,9 @@ jobs: uses: actions/checkout@v4 - name: Test run: make test + - name: Generate coverage report + run: make test-cov + - name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 2c4c438..c46c5bd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ Thumbs.db .idea .vscode -kubectl-view-secret \ No newline at end of file +kubectl-view-secret +coverage.txt diff --git a/Makefile b/Makefile index fe26ed9..864713a 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,16 @@ SOURCES := $(shell find . -name '*.go') BINARY := kubectl-view-secret +COV_REPORT := "coverage.txt" build: kubectl-view-secret test: $(SOURCES) go test -v -short -race -timeout 30s ./... +test-cov: + go test ./... -coverprofile=$(COV_REPORT) + go tool cover -html=$(COV_REPORT) + clean: @rm -rf $(BINARY)