Run coverage analysis in separate step, and save results

Remove CircleCI 1.0 implementation which used scp to contact other
lanes.

Note we can't use an env var in store_artifacts clause
This commit is contained in:
Bryan Boreham committed 2018-07-30 10:18:57 +00:00
1 parent e3576e13a7
commit 1a8794e90f
4 files changed
+29 -22

No files matched your search

+28 -6
View File
@@ -1,7 +1,7 @@
version: 2
defaults: &defaults
docker:
- image: weaveworks/weavebuild:circle20-50a4e941
- image: weaveworks/weavebuild:circle20-2e6504d3
working_directory: /go/src/github.com/weaveworks/weave
jobs:
@@ -18,6 +18,10 @@ jobs:
steps:
- checkout
- run: COVERDIR=test/coverage make BUILD_IN_CONTAINER=false tests
- persist_to_workspace:
root: .
paths:
- test/coverage
build:
<<: *defaults
@@ -62,11 +66,25 @@ jobs:
- run:
command: bin/circle-destroy-vms
background: true
- deploy:
command: cd $SRCDIR/test; ./gen_coverage_reports.sh
# run goveralls; copy coverage reports to artifacts dir
- deploy:
command: $SRCDIR/bin/circle-teardown-pre
- persist_to_workspace:
root: .
paths:
- test/coverage
- store_artifacts:
path: /tmp/artifacts
gen-coverage:
<<: *defaults
environment:
CIRCLE_ARTIFACTS: /tmp/artifacts
steps:
- checkout
- run: mkdir $CIRCLE_ARTIFACTS
- attach_workspace:
at: .
- run: cd test; ./gen_coverage_reports.sh
- run: goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=test/profile.cov -service=circleci
- run: cp test/coverage.* $CIRCLE_ARTIFACTS
- store_artifacts:
path: /tmp/artifacts
@@ -89,6 +107,10 @@ workflows:
- lint
- unit-test
- build
- gen-coverage:
requires:
- unit-test
- smoke-tests
- deploy:
requires:
- smoke-tests
-1
View File
@@ -4,7 +4,6 @@
# avoid breaking the build on make lint:
bin/circle-deploy-issues
bin/circle-deploy-master
bin/circle-teardown-pre
bin/circle-test-teardown
bin/circle-test-unit
bin/install-wordepress
-9
View File
@@ -1,9 +0,0 @@
#!/bin/bash
set -e
if [ "$CIRCLE_NODE_INDEX" = "0" ] ; then
go get github.com/mattn/goveralls
goveralls -repotoken $COVERALLS_REPO_TOKEN -coverprofile=$SRCDIR/test/profile.cov -service=circleci
cd $SRCDIR/test; cp coverage.* $CIRCLE_ARTIFACTS
fi
+1 -6
View File
@@ -3,13 +3,8 @@
set -ex
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -n "$CIRCLECI" ]; then
for i in $(seq 1 $(($CIRCLE_NODE_TOTAL - 1))); do
scp node$i:/home/ubuntu/src/github.com/weaveworks/weave/test/coverage/* ./coverage/ || true
done
fi
# 'cover' tool is from github.com/weaveworks/build-tools/cover
go get github.com/weaveworks/build-tools/cover
cover ./coverage/* >profile.cov
go tool cover -html=profile.cov -o coverage.html
go tool cover -func=profile.cov -o coverage.txt