Skip to content

Commit

Permalink
Merge pull request #49 from gengo/feature/optimize-ci
Browse files Browse the repository at this point in the history
Configure Travis CI
  • Loading branch information
yugui committed Sep 4, 2015
2 parents 9078b50 + f75ddca commit 18f5c56
Show file tree
Hide file tree
Showing 9 changed files with 269 additions and 44 deletions.
23 changes: 23 additions & 0 deletions .travis.build-protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh -eu
protoc_version=$1
if test -z "${protoc_version}"; then
echo "Usage: .travis.build-protoc.sh protoc-version"
exit 1
fi
if ! $HOME/local/bin/protoc-${protoc_version} --version 2>/dev/null; then
rm -rf $HOME/local

mkdir -p $HOME/tmp
cd $HOME/tmp
wget https://github.com/google/protobuf/archive/v${protoc_version}.tar.gz
tar xvzf v${protoc_version}.tar.gz
cd protobuf-${protoc_version}
./autogen.sh
./configure --prefix=$HOME/local --program-suffix=-${protoc_version}
make -j 4
make install
fi
ln -sf $HOME/local/bin/protoc-${protoc_version} $HOME/local/bin/protoc

echo \$ $HOME/local/bin/protoc --version
$HOME/local/bin/protoc --version
37 changes: 20 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
branches:
only:
- master
language: go

sudo: false
go:
- 1.3
- 1.5
- tip
cache:
directories:
- $HOME/local
before_install:
- cd /tmp
- wget https://github.com/google/protobuf/archive/v3.0.0-alpha-2.tar.gz
- tar xvzf v3.0.0-alpha-2.tar.gz
- cd protobuf-3.0.0-alpha-2
- ./autogen.sh
- ./configure
- make
- sudo make install
- ./.travis.build-protoc.sh 3.0.0-beta-1
- go get github.com/golang/lint/golint
- go get golang.org/x/tools/cmd/vet
install:
- go get github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
script:
- make examples
- test -z "$(git -C $GOPATH/src/github.com/gengo/grpc-gateway status --porcelain)"
- make realclean && make examples
- test -z "$(git status --porcelain)" || (git status; git diff; exit 1)
- go test -v github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/... --logtostderr
- golint github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
- golint github.com/gengo/grpc-gateway/runtime
- go tool vet $GOPATH/src/github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway
- go tool vet $GOPATH/src/github.com/gengo/grpc-gateway/runtime
- golint github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/...
- golint github.com/gengo/grpc-gateway/runtime/...
- golint github.com/gengo/grpc-gateway/utilities/...
- go vet github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/...
- go vet github.com/gengo/grpc-gateway/runtime/...
- go vet github.com/gengo/grpc-gateway/utilities/...
env:
global:
- "PATH=$PATH:$HOME/local/bin"
4 changes: 4 additions & 0 deletions examples/examplepb/a_bit_of_everything.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions examples/examplepb/echo_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions examples/examplepb/flow_combination.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/sub/message.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions protoc-gen-grpc-gateway/descriptor/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,35 +72,36 @@ func (r *Registry) newMethod(svc *Service, md *descriptor.MethodDescriptorProto,
pathTemplate string
)
switch {
case opts.Get != "":
case opts.GetGet() != "":
httpMethod = "GET"
pathTemplate = opts.Get
pathTemplate = opts.GetGet()
if opts.Body != "" {
return nil, fmt.Errorf("needs request body even though http method is GET: %s", md.GetName())
}

case opts.Put != "":
case opts.GetPut() != "":
httpMethod = "PUT"
pathTemplate = opts.Put
pathTemplate = opts.GetPut()

case opts.Post != "":
case opts.GetPost() != "":
httpMethod = "POST"
pathTemplate = opts.Post
pathTemplate = opts.GetPost()

case opts.Delete != "":
case opts.GetDelete() != "":
httpMethod = "DELETE"
pathTemplate = opts.Delete
pathTemplate = opts.GetDelete()
if opts.Body != "" {
return nil, fmt.Errorf("needs request body even though http method is DELETE: %s", md.GetName())
}

case opts.Patch != "":
case opts.GetPatch() != "":
httpMethod = "PATCH"
pathTemplate = opts.Patch
pathTemplate = opts.GetPatch()

case opts.Custom != nil:
httpMethod = opts.Custom.Kind
pathTemplate = opts.Custom.Path
case opts.GetCustom() != nil:
custom := opts.GetCustom()
httpMethod = custom.Kind
pathTemplate = custom.Path

default:
glog.Errorf("No pattern specified in google.api.HttpRule: %s", md.GetName())
Expand Down
6 changes: 6 additions & 0 deletions third_party/googleapis/google/api/annotations.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 18f5c56

Please sign in to comment.