Split into several jobs
Run build, lint and unit-test steps in a container, using a pre-built image to save rebuilding at CircleCI Move a couple of scripts up to config.yml for clarity
This commit is contained in:
1 parent
b13eb5ada5
commit
b3e77e81ea
4 files changed
+61
-34
No files matched your search
+60
-13
@@ -1,6 +1,39 @@
|
|||||||
version: 2
|
version: 2
|
||||||
|
defaults: &defaults
|
||||||
|
docker:
|
||||||
|
- image: weaveworks/weavebuild:circle20-50a4e941
|
||||||
|
working_directory: /go/src/github.com/weaveworks/weave
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
lint:
|
||||||
|
<<: *defaults
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: git submodule update --init
|
||||||
|
- run: make DEBUG=1 BUILD_IN_CONTAINER=false lint
|
||||||
|
|
||||||
|
unit-test:
|
||||||
|
<<: *defaults
|
||||||
|
parallelism: 2
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run: COVERDIR=test/coverage make BUILD_IN_CONTAINER=false tests
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
<<: *defaults
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- setup_remote_docker
|
||||||
|
- run: git submodule update --init
|
||||||
|
- run: make COVERAGE=true BUILD_IN_CONTAINER=false SUDO= exes all
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths:
|
||||||
|
- weave.tar.gz
|
||||||
|
- tools/runner/runner
|
||||||
|
- test/tls/tls
|
||||||
|
|
||||||
|
smoke-tests:
|
||||||
machine:
|
machine:
|
||||||
image: circleci/classic:201709-01
|
image: circleci/classic:201709-01
|
||||||
environment:
|
environment:
|
||||||
@@ -13,23 +46,16 @@ jobs:
|
|||||||
- run: mkdir $CIRCLE_ARTIFACTS
|
- run: mkdir $CIRCLE_ARTIFACTS
|
||||||
# copy source dir and submodule update --init
|
# copy source dir and submodule update --init
|
||||||
- run: bin/circle-dependencies-post-sources
|
- run: bin/circle-dependencies-post-sources
|
||||||
- restore_cache:
|
- attach_workspace:
|
||||||
key: v1-cache-{{ checksum "build/Dockerfile" }}-{{ checksum "build/build.sh" }}
|
at: /home/circleci/src/github.com/weaveworks/weave
|
||||||
# kick off creation of test VMs
|
# kick off creation of test VMs
|
||||||
- run:
|
- run:
|
||||||
command: bin/provision_test_vms.sh
|
command: bin/provision_test_vms.sh
|
||||||
background: true
|
background: true
|
||||||
# create build image and make all
|
|
||||||
- run: bin/circle-dependencies-post
|
|
||||||
- save_cache:
|
|
||||||
key: v1-cache-{{ checksum "build/Dockerfile" }}-{{ checksum "build/build.sh" }}
|
|
||||||
paths:
|
|
||||||
- "~/docker"
|
|
||||||
# when VMs are ready, copy built software to them
|
# when VMs are ready, copy built software to them
|
||||||
- run:
|
- run:
|
||||||
command: bin/circle-test-pre
|
command: bin/circle-test-pre
|
||||||
background: true
|
background: true
|
||||||
- run: bin/circle-test-unit
|
|
||||||
- run:
|
- run:
|
||||||
command: bin/circle-test-smoke
|
command: bin/circle-test-smoke
|
||||||
no_output_timeout: 360s
|
no_output_timeout: 360s
|
||||||
@@ -44,8 +70,29 @@ jobs:
|
|||||||
command: $SRCDIR/bin/circle-teardown-pre
|
command: $SRCDIR/bin/circle-teardown-pre
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /tmp/artifacts
|
path: /tmp/artifacts
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
<<: *defaults
|
||||||
|
steps:
|
||||||
|
- setup_remote_docker
|
||||||
|
# Rebuild without coverage and push to dockerhub
|
||||||
|
- deploy: bin/circle-deploy-master
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
build_test:
|
||||||
|
jobs:
|
||||||
|
- lint
|
||||||
|
- unit-test
|
||||||
|
- build
|
||||||
|
- smoke-tests:
|
||||||
|
requires:
|
||||||
|
- lint
|
||||||
|
- unit-test
|
||||||
|
- build
|
||||||
- deploy:
|
- deploy:
|
||||||
command: |
|
requires:
|
||||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
- smoke-tests
|
||||||
bin/circle-deploy-master
|
filters:
|
||||||
fi
|
branches:
|
||||||
|
only: master
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd "$SRCDIR"
|
|
||||||
git submodule update --init
|
|
||||||
cd "$SRCDIR/build"
|
|
||||||
../tools/rebuild-image weaveworks/weavebuild . Dockerfile build.sh
|
|
||||||
touch "$SRCDIR/.build.uptodate"
|
|
||||||
sudo chown -R ubuntu /usr/local/go
|
|
||||||
cd "$SRCDIR"
|
|
||||||
make testrunner
|
|
||||||
make COVERAGE=true RM= exes all
|
|
||||||
@@ -6,4 +6,4 @@ docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
|||||||
cd $SRCDIR
|
cd $SRCDIR
|
||||||
make clean-bin
|
make clean-bin
|
||||||
# CircleCI doesn't let us install the qemu module to do ARM docker builds
|
# CircleCI doesn't let us install the qemu module to do ARM docker builds
|
||||||
make publish ALL_ARCHITECTURES=amd64 UPDATE_LATEST=latest-only
|
make publish ALL_ARCHITECTURES=amd64 UPDATE_LATEST=latest-only SUDO= BUILD_IN_CONTAINER=false
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
cd $SRCDIR
|
|
||||||
make DEBUG=1 lint
|
|
||||||
COVERDIR=test/coverage make RM= tests
|
|
||||||
Reference in new issue
Block a user