Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add job for building binaries for releases #793

Merged
merged 1 commit into from
Oct 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 112 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ version: 2
jobs:
build:
docker:
- image: "jfbrandhorst/grpc-gateway-build-env"
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: dep ensure --vendor-only
- run: go build ./...
test:
docker:
- image: "jfbrandhorst/grpc-gateway-build-env"
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
GLOG_logtostderr: "1"
Expand All @@ -21,7 +21,7 @@ jobs:
- run: bash <(curl -s https://codecov.io/bash)
node_test:
docker:
- image: "jfbrandhorst/grpc-gateway-build-env"
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
Expand All @@ -34,7 +34,7 @@ jobs:
./node_modules/.bin/gulp
generate:
docker:
- image: "jfbrandhorst/grpc-gateway-build-env"
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
Expand All @@ -43,7 +43,7 @@ jobs:
- run: git diff --exit-code
lint:
docker:
- image: "jfbrandhorst/grpc-gateway-build-env"
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
Expand All @@ -52,18 +52,95 @@ jobs:
- run: make lint
bazel_build:
docker:
- image: "l.gcr.io/google/bazel:latest"
- image: l.gcr.io/google/bazel:latest
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m build --local_resources=400,1,1.0 //...
bazel_test:
docker:
- image: "l.gcr.io/google/bazel:latest"
- image: l.gcr.io/google/bazel:latest
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: bazel --batch --output_base=$HOME/.cache/_grpc_gateway_bazel --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m test --local_resources=400,1,1.0 --test_output=errors --features=race //...
build_linux_release:
docker:
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
CGO_ENABLED: "0"
GOOS: "linux"
GOARCH: "amd64"
steps:
- checkout
- run: mkdir -p release
- run: dep ensure --vendor-only
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-linux-x86_64 ./protoc-gen-grpc-gateway/
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-linux-x86_64 ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
paths:
- release
build_darwin_release:
docker:
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
CGO_ENABLED: "0"
GOOS: "darwin"
GOARCH: "amd64"
steps:
- checkout
- run: mkdir -p release
- run: dep ensure --vendor-only
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-darwin-x86_64 ./protoc-gen-grpc-gateway/
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-darwin-x86_64 ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
paths:
- release
build_windows_release:
docker:
- image: jfbrandhorst/grpc-gateway-build-env
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
CGO_ENABLED: "0"
GOOS: "windows"
GOARCH: "amd64"
steps:
- checkout
- run: mkdir -p release
- run: dep ensure --vendor-only
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-grpc-gateway-${VERSION}-windows-x86_64.exe ./protoc-gen-grpc-gateway/
- run: |
VERSION=$(git describe --tags --abbrev=0)
go build -o ./release/protoc-gen-swagger-${VERSION}-windows-x86_64.exe ./protoc-gen-swagger/
- persist_to_workspace:
root: ./
paths:
- release
publish_github_release:
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
at: ./release
- run:
name: "Publish Release on GitHub"
command: |
VERSION=$(git describe --tags --abbrev=0)
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./release/
workflows:
version: 2
all:
Expand All @@ -75,3 +152,31 @@ workflows:
- lint
- bazel_build
- bazel_test
- build_linux_release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- build_windows_release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- build_darwin_release:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- publish_github_release:
requires:
- build_linux_release
- build_darwin_release
- build_windows_release
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/