Skip to content

Commit

Permalink
Add test coverage via codecov.io (#48)
Browse files Browse the repository at this point in the history
- Measure test coverage via [codecov.io ](codecov.io)
- Update README to include coverage badge
  • Loading branch information
elsesiy committed Aug 13, 2024
1 parent 122b2e6 commit 22d8899
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: ci
on:
pull_request:
on: [push, pull_request]
jobs:
ci_job:
name: test
Expand All @@ -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 }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Thumbs.db
.idea
.vscode

kubectl-view-secret
kubectl-view-secret
coverage.txt
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected])](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)

Expand Down

0 comments on commit 22d8899

Please sign in to comment.