Merge pull request #197 from letsencrypt/speedup_build_and_tests
First pass at build speedups.
This commit is contained in:
commit
672f0b1fbe
|
|
@ -6,6 +6,7 @@
|
|||
# Folders
|
||||
_obj
|
||||
_test
|
||||
bin
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
|
|
|
|||
|
|
@ -14,11 +14,5 @@ before_install:
|
|||
- go get github.com/modocache/gover
|
||||
|
||||
script:
|
||||
- go build cmd/activity-monitor/main.go
|
||||
- go build cmd/boulder/main.go
|
||||
- go build cmd/boulder-ca/main.go
|
||||
- go build cmd/boulder-ra/main.go
|
||||
- go build cmd/boulder-sa/main.go
|
||||
- go build cmd/boulder-va/main.go
|
||||
- go build cmd/boulder-wfe/main.go
|
||||
- make -j4 # Travis has 2 cores per build instance
|
||||
- bash test.sh
|
||||
|
|
|
|||
29
Makefile
29
Makefile
|
|
@ -1,2 +1,29 @@
|
|||
# This is an empty Makefile to trick Travis into not running 'go get' for our
|
||||
# This Makefile also tricks Travis into not running 'go get' for our
|
||||
# build. See http://docs.travis-ci.com/user/languages/go/
|
||||
|
||||
OBJDIR = ./bin
|
||||
|
||||
OBJECTS = activity-monitor \
|
||||
boulder \
|
||||
boulder-ca \
|
||||
boulder-ra \
|
||||
boulder-sa \
|
||||
boulder-va \
|
||||
boulder-wfe
|
||||
|
||||
.PHONY: all build
|
||||
all: build
|
||||
|
||||
build: $(OBJECTS)
|
||||
|
||||
pre:
|
||||
mkdir -p $(OBJDIR)
|
||||
go install ./Godeps/_workspace/src/github.com/mattn/go-sqlite3
|
||||
|
||||
# Compile each of the binaries
|
||||
$(OBJECTS): pre
|
||||
go build -o ./bin/$@ cmd/$@/main.go
|
||||
|
||||
clean:
|
||||
rm -f $(OBJDIR)/*
|
||||
rmdir $(OBJDIR)
|
||||
57
test.sh
57
test.sh
|
|
@ -1,20 +1,31 @@
|
|||
#!/bin/bash
|
||||
# Run all tests and coverage checks. Called from Travis automatically, also
|
||||
# suitable to run manually. See list of prerequisite packages in .travis.yml
|
||||
if type realpath 2>&1 >/dev/null; then
|
||||
if type realpath >/dev/null 2>&1 ; then
|
||||
cd $(realpath $(dirname $0))
|
||||
fi
|
||||
|
||||
FAILURE=0
|
||||
|
||||
TESTDIRS="analysis \
|
||||
ca \
|
||||
core \
|
||||
log \
|
||||
policy \
|
||||
ra \
|
||||
rpc \
|
||||
sa \
|
||||
test \
|
||||
va \
|
||||
wfe"
|
||||
# cmd
|
||||
# Godeps
|
||||
|
||||
run() {
|
||||
echo "$*"
|
||||
$* || FAILURE=1
|
||||
}
|
||||
|
||||
doTest() {
|
||||
local dir=$1
|
||||
run go test -covermode=count -coverprofile=${dir}.coverprofile ./${dir}/
|
||||
}
|
||||
|
||||
# Path for installed go package binaries. If yours is different, override with
|
||||
# GOBIN=/my/path/to/bin ./test.sh
|
||||
|
|
@ -28,28 +39,28 @@ run go vet -x ./...
|
|||
# Ensure SQLite is installed so we don't recompile it each time
|
||||
go install ./Godeps/_workspace/src/github.com/mattn/go-sqlite3
|
||||
|
||||
# All the subdirectories
|
||||
doTest analysis
|
||||
doTest ca
|
||||
#doTest cmd
|
||||
doTest core
|
||||
doTest log
|
||||
doTest policy
|
||||
doTest ra
|
||||
doTest rpc
|
||||
doTest sa
|
||||
doTest test
|
||||
doTest va
|
||||
#doTest vendor
|
||||
doTest wfe
|
||||
|
||||
[ -e $GOBIN/gover ] && run $GOBIN/gover
|
||||
|
||||
if [ "${TRAVIS}" == "true" ] ; then
|
||||
# Run each test by itself for Travis, so we can get coverage
|
||||
for dir in ${TESTDIRS}; do
|
||||
run go test -covermode=count -coverprofile=${dir}.coverprofile ./${dir}/
|
||||
done
|
||||
|
||||
# Gather all the coverprofiles
|
||||
[ -e $GOBIN/gover ] && run $GOBIN/gover
|
||||
|
||||
# We don't use the run function here because sometimes goveralls fails to
|
||||
# contact the server and exits with non-zero status, but we don't want to
|
||||
# treat that as a failure.
|
||||
$GOBIN/goveralls -coverprofile=gover.coverprofile -service=travis-ci
|
||||
[ -e $GOBIN/goveralls ] && $GOBIN/goveralls -coverprofile=gover.coverprofile -service=travis-ci
|
||||
else
|
||||
# Run all the tests together if local, for speed
|
||||
dirlist=""
|
||||
|
||||
for dir in ${TESTDIRS}; do
|
||||
dirlist="${dirlist} ./${dir}/"
|
||||
done
|
||||
|
||||
run go test ${dirlist}
|
||||
fi
|
||||
|
||||
exit ${FAILURE}
|
||||
|
|
|
|||
Loading…
Reference in New Issue