*: use go install instead of go build in build script

go-sqlite3 takes a long time to compile, so it's very important
to cache a build rather than re-compile every time.

Use go install instead of go build in the build script to cache
all packages. Print a warning in the test script if cached packages
are not found.
This commit is contained in:
Eric Chiang 2016-02-12 13:18:26 -08:00
parent 07af73f367
commit 07236da1e7
4 changed files with 23 additions and 15 deletions

18
build
View file

@ -1,18 +1,10 @@
#!/bin/bash -e
export GOPATH=${PWD}/Godeps/_workspace
export GOBIN=${PWD}/bin
source ./env
rm -rf $GOPATH/src/github.com/coreos/dex
mkdir -p $GOPATH/src/github.com/coreos/
# Only attempt to link dex into godeps if it isn't already there
[ -d $GOPATH/src/github.com/coreos/dex ] || ln -s ${PWD} $GOPATH/src/github.com/coreos/dex
LD_FLAGS="-X main.version=$(./git-version)"
go build -o bin/dex-worker -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dex-worker
go build -o bin/dexctl -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dexctl
go build -o bin/dex-overlord -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dex-overlord
go install -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dex-worker
go install -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dexctl
go install -ldflags="$LD_FLAGS" github.com/coreos/dex/cmd/dex-overlord
go build -o bin/example-app github.com/coreos/dex/examples/app
go build -o bin/example-cli github.com/coreos/dex/examples/cli
go build -o bin/gendoc github.com/coreos/dex/cmd/gendoc
go install github.com/coreos/dex/cmd/gendoc

10
env Normal file
View file

@ -0,0 +1,10 @@
export GOPATH=${PWD}/Godeps/_workspace
export GOBIN=${PWD}/bin
rm -rf $GOPATH/src/github.com/coreos/dex
mkdir -p $GOPATH/src/github.com/coreos/
# Only attempt to link dex into godeps if it isn't already there
[ -d $GOPATH/src/github.com/coreos/dex ] || ln -s ${PWD} $GOPATH/src/github.com/coreos/dex
LD_FLAGS="-X main.version=$(./git-version)"

6
test
View file

@ -12,7 +12,11 @@
# Invoke ./cover for HTML output
COVER=${COVER:-"-cover"}
source ./build
source ./env
if [ ! -d $GOPATH/pkg ]; then
echo "WARNING: No cached builds detected. Please run the ./build script to speed up future tests."
fi
TESTABLE="connector db integration pkg/crypto pkg/flag pkg/http pkg/net pkg/time pkg/html functional/repo server session session/manager user user/api user/manager user/email email admin"
FORMATTABLE="$TESTABLE cmd/dexctl cmd/dex-worker cmd/dex-overlord examples/app functional pkg/log"

View file

@ -1,4 +1,6 @@
#!/bin/bash -e
source ./build
source ./env
go test $@ github.com/coreos/dex/functional
go test $@ github.com/coreos/dex/functional/repo