diff --git a/.github/.codecov.yml b/.github/.codecov.yml new file mode 100644 index 00000000..f1cc62af --- /dev/null +++ b/.github/.codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + project: + default: + target: 80% \ No newline at end of file diff --git a/.gitignore b/.gitignore index 83e8e6d2..721c7a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ *.sublime-workspace # Custom -.cover/ -.test/ \ No newline at end of file +coverage.txt \ No newline at end of file diff --git a/Makefile b/Makefile index a85376e5..0afb6a6d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ all: test .PHONY: test test: check-line-endings ## run unit tests - ./scripts/test.sh + go test -race -v -coverprofile=coverage.txt -covermode=atomic ./... .PHONY: clean clean: diff --git a/README.md b/README.md index 2abee450..719c5884 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # Notation + +[![codecov](https://codecov.io/gh/notaryproject/notation-go/branch/main/graph/badge.svg)](https://codecov.io/gh/notaryproject/notation-go) + A collection of libraries for supporting Notation sign, verify, push, pull of oci artifacts. Based on Notary V2 standard. ## Table of Contents diff --git a/scripts/test.sh b/scripts/test.sh deleted file mode 100755 index 91431f18..00000000 --- a/scripts/test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -ex - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/../ - -rm -rf .cover/ .test/ -mkdir .cover/ .test/ -trap "rm -rf .test/" EXIT - -export CGO_ENABLED=0 -for pkg in `go list ./...`; do - go test -v -covermode=atomic \ - -coverprofile=".cover/$(echo $pkg | sed 's/\//_/g').cover.out" $pkg -done - -echo "mode: set" > .cover/cover.out && cat .cover/*.cover.out | grep -v mode: | sort -r | \ - awk '{if($1 != last) {print $0;last=$1}}' >> .cover/cover.out - -go tool cover -html=.cover/cover.out -o=.cover/coverage.html