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

Replace travis with CircleCI for easier testing #772

Merged
merged 2 commits into from
Oct 10, 2018
Merged
Show file tree
Hide file tree
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
36 changes: 36 additions & 0 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM golang:latest

## Warm apt cache
RUN apt-get update

# Install swagger-codegen
ENV SWAGGER_CODEGEN_VERSION=2.2.2
RUN apt-get install -y openjdk-8-jre wget && \
wget http://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${SWAGGER_CODEGEN_VERSION}/swagger-codegen-cli-${SWAGGER_CODEGEN_VERSION}.jar \
-O /usr/local/bin/swagger-codegen-cli.jar && \
apt-get remove -y wget
ENV SWAGGER_CODEGEN="java -jar /usr/local/bin/swagger-codegen-cli.jar"

# Install protoc
ENV PROTOC_VERSION=3.1.0
RUN apt-get install -y wget unzip && \
wget https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \
-O /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
unzip /protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/ && \
rm -f /protoc-${PROTOC_VERSION}-linux-x86_64.zip && \
apt-get remove -y unzip wget

# Install node
ENV NODE_VERSION=v6.1
RUN apt-get install -y wget bzip2 && \
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash && \
apt-get remove -y wget

# Install dep
RUN apt-get install -y wget && \
wget -qO- https://raw.githubusercontent.com/golang/dep/master/install.sh | sh && \
apt-get remove -y wget

# Clean up
RUN apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
22 changes: 22 additions & 0 deletions .circleci/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## gRPC-Gateway CI testing setup

Contained within is the CI test setup for the Gateway. It runs on Circle CI.

### I want to regenerate the files after making changes!

Great, it should be as simple as thus (run from the root of the directory):

```bash
$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \
/bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \
make realclean && \
make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"'
```

If this has resulted in some file changes in the repo, please ensure you check those in with your merge request.

### Whats up with the Dockerfile?

The `Dockerfile` in this folder is used as the build environment when regenerating the files (see above).
The canonical repository for this Dockerfile is `jfbrandhorst/grpc-gateway-build-env`. Please request access
before attempting to make any changes to the Dockerfile.
97 changes: 97 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
version: 2
jobs:
build:
docker:
- image: "golang:latest"
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: dep ensure --vendor-only
- run: go build ./...
test:
docker:
- image: "golang:latest"
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
environment:
GLOG_logtostderr: "1"
steps:
- checkout
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: dep ensure --vendor-only
- run: go test -race -coverprofile=coverage.txt ./...
- run: bash <(curl -s https://codecov.io/bash)
node_test:
docker:
- image: "jfbrandhorst/grpc-gateway-build-env"
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: >
. $HOME/.nvm/nvm.sh &&
cd examples/browser &&
npm install gulp-cli &&
npm install &&
./node_modules/.bin/gulp
generate:
docker:
- image: "jfbrandhorst/grpc-gateway-build-env"
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: make realclean
- run: make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}" # Set in Docker image
- run: git diff --exit-code
lint:
docker:
- image: "golang:latest"
working_directory: /go/src/github.com/grpc-ecosystem/grpc-gateway
steps:
- checkout
- run: curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- run: dep ensure --vendor-only
- run: go get github.com/golang/lint/golint
- run: make lint
bazel_build:
docker:
- 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"
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
//...
workflows:
version: 2
all:
jobs:
- build
- test
- node_test
- generate
- lint
- bazel_build
- bazel_test
82 changes: 0 additions & 82 deletions .travis.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .travis/bazel-build.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .travis/bazel-test.sh

This file was deleted.

20 changes: 0 additions & 20 deletions .travis/install-bazel.sh

This file was deleted.

19 changes: 0 additions & 19 deletions .travis/install-protoc.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .travis/install-swagger-codegen.sh

This file was deleted.

13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,16 @@ with us through the issue tracker.

### Code reviews
All submissions, including submissions by project members, require review.

### I want to regenerate the files after making changes!

Great, it should be as simple as thus (run from the root of the directory):

```bash
$ docker run -v $(pwd):/go/src/github.com/grpc-ecosystem/grpc-gateway --rm jfbrandhorst/grpc-gateway-build-env \
/bin/bash -c 'cd /go/src/github.com/grpc-ecosystem/grpc-gateway && \
make realclean && \
make examples SWAGGER_CODEGEN="${SWAGGER_CODEGEN}"'
```

If this has resulted in some file changes in the repo, please ensure you check those in with your merge request.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ generate: $(RUNTIME_GO)

$(GO_PLUGIN):
dep ensure -vendor-only
go install ./vendor/$(GO_PLUGIN_PKG)
go build -o $@ $(GO_PLUGIN_PKG)
go build -o $@ ./vendor/$(GO_PLUGIN_PKG)

$(RUNTIME_GO): $(RUNTIME_PROTO) $(GO_PLUGIN)
protoc -I $(PROTOC_INC_PATH) --plugin=$(GO_PLUGIN) -I $(GOPATH)/src/$(GO_PTYPES_ANY_PKG) -I. --go_out=$(PKGMAP):. $(RUNTIME_PROTO)
Expand Down
17 changes: 0 additions & 17 deletions bin/coverage

This file was deleted.

Loading