diff --git a/README.md b/README.md index eee90b7337bd2b61212a8d47d5498c540cb9c90e..b476d70eaf4e7f394905611ab9f6303ae40abdd7 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,12 @@ SPDX-License-Identifier: CC0-1.0 # go-lunatask -[![Go Reference](https://godocs.io/git.secluded.site/go-lunatask?status.svg)][godocs.io] -[![Go Reference](https://pkg.go.dev/badge/git.secluded.site/go-lunatask.svg)][pkg.go.dev] +[![Godocs.io Reference](https://godocs.io/git.secluded.site/go-lunatask?status.svg)][godocs.io] +[![Pkg.go.dev Reference](https://pkg.go.dev/badge/git.secluded.site/go-lunatask.svg)][pkg.go.dev] [![Go Report Card](https://goreportcard.com/badge/git.secluded.site/go-lunatask)](https://goreportcard.com/report/git.secluded.site/go-lunatask) -[![REUSE](https://api.reuse.software/badge/git.secluded.site/go-lunatask)](https://api.reuse.software/info/git.secluded.site/go-lunatask) -[![Liberapay](https://img.shields.io/liberapay/receives/Amolith.svg?logo=liberapay)](https://liberapay.com/Amolith/) +![Test coverage](https://img.shields.io/badge/coverage-84.6%25-brightgreen) +[![REUSE compatibility](https://api.reuse.software/badge/git.secluded.site/go-lunatask)](https://api.reuse.software/info/git.secluded.site/go-lunatask) +[![Liberapay donation status](https://img.shields.io/liberapay/receives/Amolith.svg?logo=liberapay)](https://liberapay.com/Amolith/) [godocs.io]: https://godocs.io/git.secluded.site/go-lunatask [pkg.go.dev]: https://pkg.go.dev/git.secluded.site/go-lunatask diff --git a/Taskfile.yaml b/Taskfile.yaml index e60bfec4caed27c3a24a6cec21efc9036ef1957a..5b17d8d3b2e90f293969337da334c3a1c264dc38 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -48,6 +48,17 @@ tasks: cmds: - go test -v ./... + badge: + desc: Update coverage badge + cmds: + - | + pct=$(go test -cover ./... 2>&1 | grep -oP 'coverage: \K[0-9.]+') + if [ "$pct" = "" ]; then echo "Failed to get coverage"; exit 1; fi + color=red; [ "$(echo "$pct >= 50" | bc)" -eq 1 ] && color=yellow + [ "$(echo "$pct >= 80" | bc)" -eq 1 ] && color=brightgreen + sed -i "s|coverage-[0-9.]*%25-[a-z]*|coverage-${pct}%25-${color}|" README.md + echo "Updated badge to ${pct}% (${color})" + vuln: cmds: - go install golang.org/x/vuln/cmd/govulncheck@latest