diff --git a/.circleci/config.yml b/.circleci/config.yml index a22f10385..6736299c0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: | diff --git a/.gitignore b/.gitignore index 8400a8714..622679bcc 100644 --- a/.gitignore +++ b/.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 diff --git a/Makefile b/Makefile index cbb9dcfb8..3e34f1c5e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index f8e51757a..602ca5d47 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/scripts/ginkgo.coverage.sh b/scripts/ginkgo.coverage.sh index 3ea5a1292..1fabe99cc 100755 --- a/scripts/ginkgo.coverage.sh +++ b/scripts/ginkgo.coverage.sh @@ -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 \ No newline at end of file