diff --git a/.github/.codecov.yml b/.github/.codecov.yml new file mode 100644 index 00000000..0b3e2618 --- /dev/null +++ b/.github/.codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + project: + default: + target: 89% \ No newline at end of file diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml index 9e28463c..5facb6f1 100644 --- a/.github/workflows/reusable-build.yml +++ b/.github/workflows/reusable-build.yml @@ -20,8 +20,5 @@ jobs: check-latest: true - name: Run unit tests run: make test - - name: Upload coverage report - uses: actions/upload-artifact@master - with: - name: notation-coverage-report-${{ github.sha }} - path: .cover/ \ No newline at end of file + - name: Upload coverage to codecov.io + uses: codecov/codecov-action@v3 \ No newline at end of file diff --git a/.gitignore b/.gitignore index f8ef0940..53dc08f4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,4 @@ .vscode # 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 ffbd94cb..2f1ca888 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # notation-core-go + +[![codecov](https://codecov.io/gh/notaryproject/notation-core-go/branch/main/graph/badge.svg)](https://codecov.io/gh/notaryproject/notation-core-go) + Contains support for Notary v2 signature envelope, and format specific implementation 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