Push unit test coverage results to codecov (#2719)

* push coverage results to coveralls

* change token name

* add codecov

* circleci config update

* missing references field

* Replace badge

* ignore .coverprofile

* fix cover.out missing

* COVERALLS_REPO_TOKEN in error message
This commit is contained in:
Cecile Robert-Michon 2018-04-20 11:18:24 -07:00 коммит произвёл GitHub
Родитель 4b81de6eca
Коммит 691cee374d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 36 добавлений и 68 удалений

Просмотреть файл

@ -1,4 +1,12 @@
version: 2
defaults: &defaults
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
experimental:
notify:
branches:
@ -6,18 +14,13 @@ experimental:
- master
jobs:
test:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
echo 'export PATH=$GOPATH/bin:$PATH' >> $BASH_ENV
echo 'export CLIENT_ID=${CLUSTER_SERVICE_PRINCIPAL_CLIENT_ID}' >> $BASH_ENV
echo 'export CLIENT_SECRET=${CLUSTER_SERVICE_PRINCIPAL_CLIENT_SECRET}' >> $BASH_ENV
echo 'export COVERALLS_TOKEN=${COVERALLS_TOKEN}' >> $BASH_ENV
- run:
name: Install dependencies
command: make bootstrap
@ -33,11 +36,7 @@ jobs:
- store_test_results:
path: test/junit
swarm-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -60,11 +59,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_logs
dcos-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -110,11 +105,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_logs
k8s-1.7-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -139,11 +130,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-linux-default-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -167,11 +154,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-windows-1.7-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -195,11 +178,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-1.9-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -224,11 +203,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-1.10-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -255,11 +230,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-1.8-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -284,11 +255,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-windows-1.8-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -312,11 +279,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-windows-1.9-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |
@ -340,11 +303,7 @@ jobs:
- store_artifacts:
path: /go/src/github.com/Azure/acs-engine/_output
k8s-windows-1.10-release-e2e:
working_directory: /go/src/github.com/Azure/acs-engine
docker:
- image: quay.io/deis/go-dev:v1.9.1
environment:
GOPATH: /go
<<: *defaults
steps:
- checkout
- run: |

1
.gitignore поставляемый
Просмотреть файл

@ -12,6 +12,7 @@ test/acs-engine-test/acs-engine-test
_dist/
bin/
.env
.coverprofile
test/junit/
test/acs-engine-test/acs-engine-test.exe

Просмотреть файл

@ -145,7 +145,7 @@ ci: bootstrap test-style build test lint
.PHONY: coverage
coverage:
@scripts/ginkgo.coverage.sh
@scripts/ginkgo.coverage.sh --codecov
devenv:
./scripts/devenv.sh

Просмотреть файл

@ -1,5 +1,5 @@
# Microsoft Azure Container Service Engine - Builds Docker Enabled Clusters
[![Coverage Status](https://coveralls.io/repos/github/Azure/acs-engine/badge.svg?branch=master)](https://coveralls.io/github/Azure/acs-engine?branch=master)
[![Coverage Status](https://codecov.io/gh/Azure/acs-engine/branch/master/graph/badge.svg)](https://codecov.io/gh/Azure/acs-engine)
[![CircleCI](https://circleci.com/gh/Azure/acs-engine/tree/master.svg?style=svg)](https://circleci.com/gh/Azure/acs-engine/tree/master)
## Overview

Просмотреть файл

@ -19,20 +19,25 @@ set -eo pipefail
covermode=${COVERMODE:-atomic}
coverdir=$(mktemp -d /tmp/coverage.XXXXXXXXXX)
profile="${coverdir}/cover.out"
coveragetxt="coverage.txt"
hash goveralls 2>/dev/null || go get github.com/mattn/goveralls
hash godir 2>/dev/null || go get github.com/Masterminds/godir
generate_cover_data() {
ginkgo -skipPackage test/e2e/dcos,test/e2e/kubernetes -cover -r .
find . -type f -name "*.coverprofile" | while read -r file; do mv $file ${coverdir}; done
echo "" > ${coveragetxt}
find . -type f -name "*.coverprofile" | while read -r file; do cat $file >> ${coveragetxt} && mv $file ${coverdir}; done
echo "mode: $covermode" >"$profile"
grep -h -v "^mode:" "$coverdir"/*.coverprofile >>"$profile"
}
push_to_coveralls() {
goveralls -coverprofile="${profile}" -repotoken $COVERALLS_TOKEN
goveralls -coverprofile="${profile}" -service=circle-ci -repotoken $COVERALLS_REPO_TOKEN || echo "push to coveralls failed"
}
push_to_codecov() {
bash <(curl -s https://codecov.io/bash) || echo "push to codecov failed"
}
generate_cover_data
@ -43,10 +48,13 @@ case "${1-}" in
go tool cover -html "${profile}"
;;
--coveralls)
if [ -z $COVERALLS_TOKEN ]; then
echo '$COVERALLS_TOKEN not set. Skipping pushing coverage report to coveralls.io'
if [ -z $COVERALLS_REPO_TOKEN ]; then
echo '$COVERALLS_REPO_TOKEN not set. Skipping pushing coverage report to coveralls.io'
exit
fi
push_to_coveralls
;;
--codecov)
push_to_codecov
;;
esac