*: clean up test and other scripts, update travis

This commit is contained in:
Gyu-Ho Lee 2016-10-31 20:59:24 -07:00
parent 3fee72780d
commit 4649ed54e6
7 changed files with 88 additions and 46 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# binary file
dbtester

View File

@ -3,12 +3,8 @@ language: go
sudo: false
go:
- 1.7.3
- tip
addons:
apt:
packages:
- libpcap-dev
script:
- ./test
- ./scripts/tests.sh

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
set -e
# for now, be conservative about what version of protoc we expect
if ! [[ $(protoc --version) =~ "3.0.0" ]]; then
echo "could not find protoc 3.0.0, is it installed + in PATH?"
exit 255
fi
go get -v github.com/gogo/protobuf/proto;
go get -v github.com/gogo/protobuf/protoc-gen-gogo;
go get -v github.com/gogo/protobuf/gogoproto;
go get -v github.com/gogo/protobuf/protoc-gen-gofast;
protoc \
--gofast_out=plugins=grpc:. \
--proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. \
*.proto;

28
scripts/genproto.sh Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
if ! [[ "$0" =~ "scripts/genproto.sh" ]]; then
echo "must be run from repository root"
exit 255
fi
# for now, be conservative about what version of protoc we expect
if ! [[ $(protoc --version) =~ "3.0.0" ]]; then
echo "could not find protoc 3.0.0, is it installed + in PATH?"
exit 255
fi
echo "Installing gogo/protobuf..."
GOGOPROTO_ROOT="$GOPATH/src/github.com/gogo/protobuf"
rm -rf $GOGOPROTO_ROOT
go get -v github.com/gogo/protobuf/{proto,protoc-gen-gogo,gogoproto,protoc-gen-gofast}
go get -v golang.org/x/tools/cmd/goimports
pushd "${GOGOPROTO_ROOT}"
git reset --hard HEAD
make install
popd
printf "Generating agent\n"
protoc --gofast_out=plugins=grpc:. \
--proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. \
agent/*.proto;

View File

@ -1,4 +1,10 @@
#!/usr/bin/env bash
set -e
if ! [[ "$0" =~ "scripts/tests.sh" ]]; then
echo "must be run from repository root"
exit 255
fi
IGNORE_PKGS="(vendor)"
TESTS=`find . -name \*_test.go | while read a; do dirname $a; done | sort | uniq | egrep -v "$IGNORE_PKGS"`
@ -22,4 +28,3 @@ if [ -n "${vetRes}" ]; then
fi
echo "Success";

50
scripts/update-vendor-glide.sh Executable file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env bash
set -e
if ! [[ "$0" =~ "scripts/update-vendor-glide.sh" ]]; then
echo "must be run from repository root"
exit 255
fi
# update depedency
# 1. edit glide.yaml with version, git SHA
# 2. run ./script-update-vendor-glide.sh
# 3. it automatically detects new git SHA, and vendors updates to cmd/vendor directory
#
# add depedency
# 1. run ./script-update-vendor-glide.sh github.com/USER/PROJECT#^1.0.0
# OR
# ./script-update-vendor-glide.sh github.com/USER/PROJECT#9b772b54b3bf0be1eec083c9669766a56332559a
# ./script-update-vendor-glide.sh golang.org/x/time#711ca1cb87636abec28122ef3bc6a77269d433f3
# 2. make sure glide.yaml and glide.lock are updated
GLIDE_ROOT="$GOPATH/src/github.com/Masterminds/glide"
GLIDE_SHA=21ff6d397ccca910873d8eaabab6a941c364cc70
go get -d -u github.com/Masterminds/glide
pushd "${GLIDE_ROOT}"
# git reset --hard HEAD
git reset --hard ${GLIDE_SHA}
go install
popd
GLIDE_VC_ROOT="$GOPATH/src/github.com/sgotti/glide-vc"
GLIDE_VC_SHA=d96375d23c85287e80296cdf48f9d21c227fa40a
go get -d -u github.com/sgotti/glide-vc
pushd "${GLIDE_VC_ROOT}"
# git reset --hard HEAD
git reset --hard ${GLIDE_VC_SHA}
go install
popd
rm -rf ./vendor
if [ -n "$1" ]; then
echo "glide get on $(echo $1)"
glide get --strip-vendor $1
else
echo "glide update on *"
glide update --strip-vendor
fi;
glide vc --no-tests --only-code

View File

@ -1,20 +0,0 @@
#!/usr/bin/env bash
set -e
GLIDE_ROOT="$GOPATH/src/github.com/Masterminds/glide"
go get -v github.com/Masterminds/glide
go get -v github.com/sgotti/glide-vc
GLIDE_SHA=3e49dce57f4a3a1e9bc55475065235766000d2f0
pushd "${GLIDE_ROOT}"
# git reset --hard HEAD
git reset --hard ${GLIDE_SHA}
go install
popd
rm -rf vendor
glide --verbose update --delete --strip-vendor --strip-vcs --update-vendored --skip-test
# glide --verbose update --delete --strip-vendor --strip-vcs --update-vendored --skip-test --force
glide vc --only-code --no-tests