Skip to content

Commit

Permalink
use godep for reproducible builds
Browse files Browse the repository at this point in the history
  • Loading branch information
mreiferson committed Oct 15, 2013
1 parent 09b3827 commit f648107
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 54 deletions.
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ env:
- GOARCH=amd64
- GOARCH=386
install:
- go get github.com/bitly/go-nsq
- go get github.com/bitly/go-simplejson
- go get github.com/mreiferson/go-snappystream
- go get github.com/bitly/go-hostpool
- go get github.com/bmizerany/assert
- go get code.google.com/p/go.tools/go/vcs || true
- "sed -i -e '26s/}/}\\nreturn nil, nil/' $HOME/gopath/src/code.google.com/p/go.tools/go/vcs/discovery.go"
- go get github.com/kr/godep
script:
- pushd $TRAVIS_BUILD_DIR
- export PATH="$HOME/gopath/bin:$PATH"
- ./test.sh
- popd
notifications:
email: false
49 changes: 49 additions & 0 deletions Godeps
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"ImportPath": "github.com/bitly/nsq",
"GoVersion": "go version go1.1.2 darwin/amd64",
"Packages": [
"./..."
],
"Deps": [
{
"ImportPath": "code.google.com/p/snappy-go/snappy",
"Comment": "",
"Rev": "12e4b4183793"
},
{
"ImportPath": "github.com/bitly/go-nsq",
"Comment": "v0.3.3-alpha",
"Rev": "4d7f86de2099a4b71d17b26b7fa7fa1a81c88e4c"
},
{
"ImportPath": "github.com/bitly/go-hostpool",
"Comment": "",
"Rev": "58b95b10d6ca26723a7f46017b348653b825a8d6"
},
{
"ImportPath": "github.com/bitly/go-simplejson",
"Comment": "v0.5.0-alpha",
"Rev": "fc395a5db941cf38922b1ccbc083640cd76fe4bc"
},
{
"ImportPath": "github.com/mreiferson/go-snappystream",
"Comment": "v0.1.1",
"Rev": "97c96e6648e99c2ce4fe7d169aa3f7368204e04d"
},
{
"ImportPath": "github.com/bmizerany/assert",
"Comment": "",
"Rev": "e17e99893cb6509f428e1728281c2ad60a6b31e3"
},
{
"ImportPath": "github.com/kr/pretty",
"Comment": "",
"Rev": "bc9499caa0f45ee5edb2f0209fbd61fbf3d9018f"
},
{
"ImportPath": "github.com/kr/text",
"Comment": "",
"Rev": "6807e777504f54ad073ecef66747de158294b639"
}
]
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ all: $(BINARIES) $(EXAMPLES)

$(BLDDIR)/%:
mkdir -p $(dir $@)
cd $* && go build ${GOFLAGS} -o $(abspath $@)
godep go build ${GOFLAGS} -o $(abspath $@) ./$*

$(BINARIES): %: $(BLDDIR)/%
$(EXAMPLES): %: $(BLDDIR)/apps/%
Expand Down
20 changes: 0 additions & 20 deletions dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,6 @@ arch=$(go env GOARCH)
version=$(cat $DIR/util/binary_version.go | grep "const BINARY_VERSION" | awk '{print $NF}' | sed 's/"//g')
goversion=$(go version | awk '{print $3}')

TMPGOPATH=$(mktemp -d -t nsqgopath)
mkdir -p $TMPGOPATH/src
mkdir -p $TMPGOPATH/pkg/${os}_${arch}
mkdir -p $TMPGOPATH/src/github.com/bitly/nsq

git archive HEAD | tar -x -C $TMPGOPATH/src/github.com/bitly/nsq

export GOPATH="$TMPGOPATH:$GOROOT"

echo "... getting dependencies"
go get -v github.com/bitly/go-nsq
go get -v github.com/bitly/go-simplejson
go get -v github.com/mreiferson/go-snappystream
go get -v github.com/bitly/go-hostpool
go get -v github.com/bmizerany/assert

pushd $TMPGOPATH/src/github.com/bitly/nsq

echo "... running tests"
./test.sh || exit 1

Expand All @@ -43,5 +25,3 @@ for os in linux darwin; do
popd
make clean
done

popd
35 changes: 9 additions & 26 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,18 @@
set -e
# a helper script to run tests in the appropriate directories

for dir in nsqd nsqlookupd util/pqueue; do
echo "testing $dir"
pushd $dir >/dev/null
go test -test.v -timeout 60s
popd >/dev/null
done

# build and run nsqlookupd
pushd nsqlookupd >/dev/null
go build
echo "starting nsqlookupd"
./nsqlookupd >/dev/null 2>&1 &
echo "building and starting nsqlookupd"
godep go build -o nsqlookupd/nsqlookupd ./nsqlookupd
nsqlookupd/nsqlookupd >/dev/null 2>&1 &
LOOKUPD_PID=$!
popd >/dev/null

# build and run nsqd configured to use our lookupd above
pushd nsqd >/dev/null
go build
rm -f *.dat
cmd="./nsqd --data-path=/tmp --lookupd-tcp-address=127.0.0.1:4160 --tls-cert=./test/cert.pem --tls-key=./test/key.pem"
echo "starting $cmd"
cmd="nsqd/nsqd --data-path=/tmp --lookupd-tcp-address=127.0.0.1:4160 --tls-cert=nsqd/test/cert.pem --tls-key=nsqd/test/key.pem"
echo "building and starting $cmd"
godep go build -o nsqd/nsqd ./nsqd
$cmd >/dev/null 2>&1 &
NSQD_PID=$!
popd >/dev/null

sleep 0.3

Expand All @@ -35,15 +23,10 @@ cleanup() {
}
trap cleanup INT TERM EXIT

pushd nsqd/test >/dev/null
echo "testing nsq"
go test -v -timeout 15s
popd >/dev/null
godep go test -v -timeout 60s ./...

# no tests, but a build is something
for dir in nsqadmin nsqlookupd apps/* bench/*; do
pushd $dir >/dev/null
for dir in nsqadmin apps/* bench/*; do
echo "building $dir"
go build
popd >/dev/null
godep go build -o $dir/$(basename $dir) ./$dir
done

0 comments on commit f648107

Please sign in to comment.