Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #810 from grafana/circle-workflows
Browse files Browse the repository at this point in the history
split up circleCI jobs into parallel workflows
  • Loading branch information
Dieterbe authored Jan 23, 2018
2 parents 65b75bd + 9a770d7 commit 90fa7ed
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 13 deletions.
73 changes: 63 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
version: 2
jobs:
build:
working_directory: /home/circleci/.go_workspace/src/github.com/grafana/metrictank
machine: true
working_directory: /go/src/github.com/grafana/metrictank
docker:
- image: circleci/golang:1.9.2
steps:
- checkout
- run: scripts/build.sh
- run: scripts/build_tools.sh
- setup_remote_docker
- run: scripts/build_docker.sh
- run: mkdir build_docker && docker save -o build_docker/metrictank.tar grafana/metrictank
- persist_to_workspace:
root: .
paths:
- build
- build_docker

test:
working_directory: /go/src/github.com/grafana/metrictank
docker:
- image: circleci/golang:1.9.2
steps:
- checkout
- run: go test -v -race $(go list ./... | grep -v github.com/grafana/metrictank/chaos)

qa:
working_directory: /go/src/github.com/grafana/metrictank
docker:
- image: circleci/golang:1.9.2
steps:
- run: go version
- run: echo $GOPATH
- run: docker version
- run: docker-compose version
- checkout
- run: scripts/qa/gofmt.sh
- run: scripts/qa/go-generate.sh
Expand All @@ -17,12 +39,25 @@ jobs:
- run: scripts/qa/unused.sh
- run: scripts/qa/vendor.sh
- run: go vet ./...
- run: scripts/build.sh
- run: scripts/build_tools.sh
- run: scripts/build_docker.sh

qa-post-build:
working_directory: /home/circleci/.go_workspace/src/github.com/grafana/metrictank
machine: true
steps:
- checkout
- attach_workspace:
at: .
- run: scripts/qa/docs.sh
- run: go test -v -race $(go list ./... | grep -v github.com/grafana/metrictank/chaos)
- run: docker load -i build_docker/metrictank.tar
- run: scripts/qa/end2end.sh

deploy:
docker:
- image: circleci/ruby:2.3
steps:
- checkout
- attach_workspace:
at: .
- run: scripts/depends.sh
- run: scripts/build_packages.sh
- store_artifacts:
Expand All @@ -34,5 +69,23 @@ jobs:
if [ "${CIRCLE_BRANCH}" == "master" ]; then
scripts/push/packagecloud.sh
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker load -i build_docker/metrictank.tar
scripts/push/docker.sh
fi
workflows:
version: 2
build_accept_deploy:
jobs:
- build
- test
- qa
- qa-post-build:
requires:
- build
- deploy:
requires:
- build
- test
- qa
- qa-post-build
1 change: 0 additions & 1 deletion scripts/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ BUILD_TMP=$CODE_DIR/build_tmp # used for temporary data used to construct the pa
mkdir $BUILD_TMP
mkdir $BUILD_PKG

sudo apt-get update # otherwise the below install command doesn't work
sudo apt-get install rpm # to be able to make rpms

ARCH="$(uname -m)"
Expand Down
3 changes: 1 addition & 2 deletions scripts/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ set -x
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}

sudo apt install rubygems ruby-dev
sudo gem install bundler
which bundler &>/dev/null || sudo gem install bundler
bundle install

0 comments on commit 90fa7ed

Please sign in to comment.