diff --git a/.codecov.yaml b/.codecov.yaml new file mode 100644 index 0000000000..e9a4ca5bd2 --- /dev/null +++ b/.codecov.yaml @@ -0,0 +1,16 @@ +# Copyright SecureKey Technologies Inc. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 + +coverage: + status: + project: + default: + target: 85% + patch: + default: + target: 85% + only_pulls: true + +ignore: + - "test/integration" diff --git a/.gitignore b/.gitignore index fbecf0fe24..c8a8dd0c56 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .DS_Store .vscode debug.test +coverage.txt vendor/ scripts/_go/pkg/ scripts/_go/bin/ diff --git a/README.md b/README.md index 8053a4e6ac..68434ff7d2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ # Hyperledger Fabric Client SDK for Go +[![Release](https://img.shields.io/github/release/hyperledger/fabric-sdk-go.svg?style=flat-square)](https://github.com/hyperledger/fabric-sdk-go/releases/latest) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://raw.githubusercontent.com/hyperledger/fabric-sdk-go/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/hyperledger/fabric-sdk-go?status.svg)](https://godoc.org/github.com/hyperledger/fabric-sdk-go) + [![Build Status](https://dev.azure.com/hyperledger/fabric-sdk-go/_apis/build/status/hyperledger.fabric-sdk-go?branchName=master)](https://dev.azure.com/hyperledger/fabric-sdk-go/_build/latest?definitionId=19&branchName=master) +[![codecov](https://codecov.io/gh/hyperledger/fabric-sdk-go/branch/master/graph/badge.svg)](https://codecov.io/gh/hyperledger/fabric-sdk-go) [![Go Report Card](https://goreportcard.com/badge/github.com/hyperledger/fabric-sdk-go)](https://goreportcard.com/report/github.com/hyperledger/fabric-sdk-go) -[![GoDoc](https://godoc.org/github.com/hyperledger/fabric-sdk-go?status.svg)](https://godoc.org/github.com/hyperledger/fabric-sdk-go) This SDK enables Go developers to build solutions that interact with [Hyperledger Fabric](http://hyperledger-fabric.readthedocs.io/en/latest/). diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml index ec0f1945ca..6f721ceaf6 100644 --- a/ci/azure-pipelines.yml +++ b/ci/azure-pipelines.yml @@ -26,6 +26,8 @@ jobs: # TODO: resolve dependencies between dependencies.sh and install_deps.yml - script: make unit-test displayName: Run checks and unit test + - script: bash <(curl https://codecov.io/bash) + displayName: Upload coverage to Codecov - job: IntegrationTest pool: diff --git a/test/scripts/unit.sh b/test/scripts/unit.sh index 5046f48e00..8092bc64eb 100755 --- a/test/scripts/unit.sh +++ b/test/scripts/unit.sh @@ -105,7 +105,7 @@ GO_LDFLAGS="${GO_LDFLAGS} -X ${PROJECT_MODULE}/test/metadata.ProjectPath=${PROJE GO_LDFLAGS="${GO_LDFLAGS} -X ${PROJECT_MODULE}/test/metadata.ChannelConfigPath=test/fixtures/fabric/${FABRIC_SDKGO_CODELEVEL_VER}/channel" GO_LDFLAGS="${GO_LDFLAGS} -X ${PROJECT_MODULE}/test/metadata.CryptoConfigPath=test/fixtures/fabric/${FABRIC_CRYPTOCONFIG_VERSION}/crypto-config" GO_LDFLAGS="${GO_LDFLAGS} -X ${PROJECT_MODULE}/test/metadata.TestRunID=${FABRIC_SDKGO_TESTRUN_ID}" -${GO_CMD} test ${RACEFLAG} -cover -tags "testing ${GO_TAGS}" ${GO_TESTFLAGS} -ldflags="${GO_LDFLAGS}" ${PKGS[@]} -p 1 -timeout=40m +${GO_CMD} test ${RACEFLAG} -coverprofile=coverage.txt -covermode=atomic -tags "testing ${GO_TAGS}" ${GO_TESTFLAGS} -ldflags="${GO_LDFLAGS}" ${PKGS[@]} -p 1 -timeout=40m echo "Unit tests finished successfully" cd ${PWD_ORIG}