mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-05-11 19:29:20 +08:00

- Inline ci/travis.sh into .travis.yml - Use two go test steps instead of once for speed up - Drop the whitelist and use all the packages as listed from $(go list ./...). This removes the need to do bookeeping in both .travis.yml and Makefile during refactoring. - Trimmed the Makefile significantly. Removed "go test -i" as while this is extremely helpful when cross compiling, it doesn't help when compiling for the host. - Added deps as a phony target, made this step faster. I'm not sure of the usefulness of this step though and would recommend to remove it. - 'make examples' is currently broken so I didn't add it to .travis.yml. I experimented a bit on travis with go test on another similar project, timings for the go test step only: - Using both -race and -coverprofile with the loop over $(go list ./...) took 190s - Using -coverprofile alone with the loop over $(go list ./...) took 10~11s - Using -race ./... took 5s It means that using one after the other takes 16~17s while running with both flags takes 190s. A 91% speedup. Add my previous commit that cut off the test runtime by half, the total speed will be appreciable.
58 lines
1.5 KiB
Makefile
58 lines
1.5 KiB
Makefile
.PHONY: test cover robeaux examples deps
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
cover:
|
|
echo "" > profile.cov
|
|
for package in $$(go list ./...) ; do \
|
|
go test -covermode=count -coverprofile=tmp.cov $$package ; \
|
|
if [ -f tmp.cov ]; then \
|
|
cat tmp.cov >> profile.cov ; \
|
|
rm tmp.cov ; \
|
|
fi ; \
|
|
done
|
|
|
|
robeaux:
|
|
ifeq (,$(shell which go-bindata))
|
|
$(error robeaux not built! https://github.com/jteeuwen/go-bindata is required to build robeaux assets )
|
|
endif
|
|
cd api ; \
|
|
npm install robeaux ; \
|
|
cp -r node_modules/robeaux robeaux-tmp ; \
|
|
cd robeaux-tmp ; \
|
|
rm Makefile package.json README.markdown ; \
|
|
touch css/fonts.css ; \
|
|
echo "Updating robeaux..." ; \
|
|
go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \
|
|
mv robeaux.go ../robeaux ; \
|
|
cd .. ; \
|
|
rm -rf robeaux-tmp/ ; \
|
|
rm -rf node_modules/ ; \
|
|
go fmt ./robeaux/robeaux.go ; \
|
|
|
|
EXAMPLES := $(shell ls examples/*.go | sed -e 's/examples\///')
|
|
|
|
examples:
|
|
for example in $(EXAMPLES) ; do \
|
|
go build -o /tmp/$$example examples/$$example ; \
|
|
done ; \
|
|
|
|
deps:
|
|
go get -d -v \
|
|
github.com/bmizerany/pat \
|
|
github.com/codegangsta/cli \
|
|
github.com/currantlabs/ble \
|
|
github.com/donovanhide/eventsource \
|
|
github.com/eclipse/paho.mqtt.golang \
|
|
github.com/hashicorp/go-multierror \
|
|
github.com/hybridgroup/go-ardrone/client \
|
|
github.com/lazywei/go-opencv \
|
|
github.com/mgutz/logxi/v1 \
|
|
github.com/nats-io/nats \
|
|
github.com/sigurn/crc8 \
|
|
github.com/tarm/serial \
|
|
github.com/veandco/go-sdl2/sdl \
|
|
golang.org/x/net/websocket \
|
|
golang.org/x/sys/unix
|