Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Run coverage analysis in separate step, and save results
Browse files Browse the repository at this point in the history
Remove CircleCI 1.0 implementation which used scp to contact other
lanes.

Note we can't use an env var in store_artifacts clause
  • Loading branch information
bboreham committed Jul 30, 2018
1 parent e3576e1 commit 1a8794e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
34 changes: 28 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -89,6 +107,10 @@ workflows:
- lint
- unit-test
- build
- gen-coverage:
requires:
- unit-test
- smoke-tests
- deploy:
requires:
- smoke-tests
Expand Down
1 change: 0 additions & 1 deletion .lintignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions bin/circle-teardown-pre

This file was deleted.

7 changes: 1 addition & 6 deletions test/gen_coverage_reports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1a8794e

Please sign in to comment.