diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07de040..2dfc7a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ --- name: ci -on: - pull_request: +on: [push, pull_request] jobs: ci_job: name: test @@ -13,3 +12,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) diff --git a/README.md b/README.md index 0c34895..9333a36 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/elsesiy/kubectl-view-secret)](https://goreportcard.com/report/github.com/elsesiy/kubectl-view-secret) ![CI](https://github.com/elsesiy/kubectl-view-secret/actions/workflows/ci.yml/badge.svg) +[![codecov](https://codecov.io/github/elsesiy/kubectl-view-secret/graph/badge.svg?token=RODJX5GLDB)](https://codecov.io/github/elsesiy/kubectl-view-secret) [![Twitter](https://img.shields.io/badge/twitter-@elsesiy-blue.svg)](http://twitter.com/elsesiy) [![GitHub release](https://img.shields.io/github/release/elsesiy/kubectl-view-secret.svg)](https://github.com/elsesiy/kubectl-view-secret/releases)