From 23266c3d7ca69c38646c67f42280b2acee6bd6d7 Mon Sep 17 00:00:00 2001 From: Jonas-Taha El Sesiy Date: Tue, 13 Aug 2024 13:36:25 -0700 Subject: [PATCH 1/2] Add test coverage via codecov.io --- .github/workflows/ci.yml | 6 ++++++ .gitignore | 3 ++- Makefile | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) 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) From b9c8b93fb1f81294200f8e480b665da024184357 Mon Sep 17 00:00:00 2001 From: Jonas-Taha El Sesiy Date: Tue, 13 Aug 2024 13:40:30 -0700 Subject: [PATCH 2/2] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) 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)