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
Extract env setup to a script #305
Changes from 2 commits
a23484d
597e6a8
c26bb88
9b741c4
fb340e8
5d9bae4
d62eede
4a549c3
82659a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
#!/bin/sh | ||
#!/bin/bash -e | ||
# Detect OS and architecture | ||
if [[ $(uname -s) == "Linux" ]]; then | ||
os="linux"; | ||
elif [[ $(uname -s) == "Darwin" ]]; then # MacOS | ||
os="osx"; | ||
else | ||
echo "unsupported OS, protoc not installed" | ||
exit 1; | ||
fi | ||
arch=$(uname -m) | ||
protoc_url=https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-${os}-${arch}.zip | ||
|
||
# Make sure you grab the latest version | ||
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip | ||
echo "fetching ${protoc_url}" | ||
curl -L -o "protoc.zip" ${protoc_url} | ||
|
||
# Unzip | ||
unzip protoc-3.6.1-linux-x86_64.zip -d protoc3 | ||
echo "extracting..." | ||
unzip -u protoc.zip -d protoc3 | ||
|
||
# Move protoc to /usr/local/bin/ | ||
echo "moving bin to /usr/local/" | ||
sudo mv protoc3/bin/* /usr/local/bin/ | ||
|
||
# Move protoc3/include to /usr/local/include/ | ||
sudo mv protoc3/include/* /usr/local/include/ | ||
echo "syncing include to /usr/local/include" | ||
sudo rsync -a protoc3/include/ /usr/local/include/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove sudo |
||
|
||
# Cleanup | ||
echo "cleaning up..." | ||
rm protoc.zip | ||
rm -rf protoc3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash -e | ||
./ci/install-protobuf.sh | ||
|
||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are accessing github.com a lot, i'd put it in a pramaeter $GITHUB There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the readability and code complexity tradeoff isn't worth the DRY-ness |
||
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger | ||
|
||
rm -rf $GOPATH/src/github.com/golang/protobuf | ||
git clone -b v1.2.0 https://github.com/golang/protobuf $GOPATH/src/github.com/golang/protobuf | ||
|
||
go install github.com/golang/protobuf/protoc-gen-go | ||
protoc --version | ||
|
||
./ci/genproto.sh | ||
|
||
go get -u github.com/kardianos/govendor | ||
govendor sync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if this fails? maybe put in && or $? && cmd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solved in 597e6a8