build: new workflow for PR:s and branches.

This commit is contained in:
Leonard Gram 2018-07-26 16:46:36 +02:00
parent 62d3655da4
commit bfe41d3cf1
2 changed files with 81 additions and 45 deletions

View File

@ -5,9 +5,11 @@ aliases:
ignore: /.*/
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
- &filter-not-release
- &filter-not-release-or-master
tags:
ignore: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: master
- &filter-only-master
branches:
only: master
@ -156,18 +158,39 @@ jobs:
- dist/grafana*
- scripts/*.sh
- scripts/publish
- store_artifacts:
path: dist
build-deploy-docker-master:
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- run: docker info
- run: echo $GRAFANA_VERSION
- run: ./build.sh ${GRAFANA_VERSION}
build:
docker:
- image: grafana/build-container:1.0.0
working_directory: /go/src/github.com/grafana/grafana
steps:
- checkout
- run:
name: prepare build tools
command: '/tmp/bootstrap.sh'
- run:
name: build and package grafana
command: './scripts/build/build.sh'
- run:
name: sign packages
command: './scripts/build/sign_packages.sh'
- run:
name: sha-sum packages
command: 'go run build.go sha-dist'
- persist_to_workspace:
root: .
paths:
- dist/grafana*
build-docker:
docker:
- image: docker:stable-git
steps:
- checkout
- setup_remote_docker
- run: docker info
- run: echo $GRAFANA_VERSION
- run: cd packaging/docker && ./build.sh ${GRAFANA_VERSION}
build-enterprise:
docker:
@ -253,24 +276,24 @@ jobs:
workflows:
version: 2
test-and-build:
build-master:
jobs:
- build-all:
filters: *filter-not-release
filters: *filter-only-master
- build-enterprise:
filters: *filter-only-master
- codespell:
filters: *filter-not-release
filters: *filter-only-master
- gometalinter:
filters: *filter-not-release
filters: *filter-only-master
- test-frontend:
filters: *filter-not-release
filters: *filter-only-master
- test-backend:
filters: *filter-not-release
filters: *filter-only-master
- mysql-integration-test:
filters: *filter-not-release
filters: *filter-only-master
- postgres-integration-test:
filters: *filter-not-release
filters: *filter-only-master
- deploy-master:
requires:
- build-all
@ -281,18 +304,6 @@ workflows:
- mysql-integration-test
- postgres-integration-test
filters: *filter-only-master
- build-deploy-docker-master:
requires:
- build-all
- test-backend
- test-frontend
- codespell
- gometalinter
- mysql-integration-test
- postgres-integration-test
filters:
branches:
only: grafana-docker
- deploy-enterprise-master:
requires:
- build-all
@ -331,3 +342,32 @@ workflows:
- mysql-integration-test
- postgres-integration-test
filters: *filter-only-release
build-branches-and-prs:
jobs:
- build:
filters: *filter-not-release-or-master
- codespell:
filters: *filter-not-release-or-master
- gometalinter:
filters: *filter-not-release-or-master
- test-frontend:
filters: *filter-not-release-or-master
- test-backend:
filters: *filter-not-release-or-master
- mysql-integration-test:
filters: *filter-not-release-or-master
- postgres-integration-test:
filters: *filter-not-release-or-master
- build-docker:
requires:
- build
- test-backend
- test-frontend
- codespell
- gometalinter
- mysql-integration-test
- postgres-integration-test
filters:
branches:
only: grafana-docker

View File

@ -14,12 +14,14 @@ echo "current dir: $(pwd)"
if [ "$CIRCLE_TAG" != "" ]; then
echo "Building releases from tag $CIRCLE_TAG"
CC=${CCX64} go run build.go -includeBuildNumber=false build
OPT="-includeBuildNumber=false"
else
echo "Building incremental build for $CIRCLE_BRANCH"
CC=${CCX64} go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build
OPT="-buildNumber=${CIRCLE_BUILD_NUM}"
fi
CC=${CCX64} go run build.go ${OPT} build
yarn install --pure-lockfile --no-progress
echo "current dir: $(pwd)"
@ -28,14 +30,8 @@ if [ -d "dist" ]; then
rm -rf dist
fi
if [ "$CIRCLE_TAG" != "" ]; then
echo "Building frontend from tag $CIRCLE_TAG"
go run build.go -includeBuildNumber=false build-frontend
echo "Packaging a release from tag $CIRCLE_TAG"
go run build.go -goos linux -pkg-arch amd64 -includeBuildNumber=false package-only latest
else
echo "Building frontend for $CIRCLE_BRANCH"
go run build.go -buildNumber=${CIRCLE_BUILD_NUM} build-frontend
echo "Packaging incremental build for $CIRCLE_BRANCH"
go run build.go -goos linux -pkg-arch amd64 -buildNumber=${CIRCLE_BUILD_NUM} package-only latest
fi
echo "Building frontend"
go run build.go ${OPT} build-frontend
echo "Packaging"
go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest