2017-11-05 06:26:01 +08:00
|
|
|
.PHONY: test race cover robeaux examples deps test_with_coverage fmt_check
|
2014-07-11 02:13:32 +08:00
|
|
|
|
2017-11-05 06:26:01 +08:00
|
|
|
excluding_vendor := $(shell go list ./... | grep -v /vendor/)
|
|
|
|
|
|
|
|
# Run tests on all non-vendor directories
|
2014-06-12 11:10:46 +08:00
|
|
|
test:
|
2017-11-05 06:26:01 +08:00
|
|
|
go test -v $(excluding_vendor)
|
2014-07-19 04:18:01 +08:00
|
|
|
|
2017-11-05 06:26:01 +08:00
|
|
|
# Run tests with race detection on all non-vendor directories
|
2017-05-04 04:35:52 +08:00
|
|
|
race:
|
2017-11-05 06:26:01 +08:00
|
|
|
go test -race $(excluding_vendor)
|
|
|
|
|
|
|
|
# Check for code well-formedness
|
|
|
|
fmt_check:
|
2017-11-05 07:48:11 +08:00
|
|
|
! gofmt -s -d . | read
|
2017-05-04 04:35:52 +08:00
|
|
|
|
2017-11-05 06:26:01 +08:00
|
|
|
# Test and generate coverage
|
|
|
|
test_with_coverage:
|
2017-11-05 07:48:11 +08:00
|
|
|
./ci/test.sh
|
2014-07-02 14:10:12 +08:00
|
|
|
|
2017-11-05 06:26:01 +08:00
|
|
|
deps:
|
|
|
|
ifeq (,$(shell which dep))
|
|
|
|
$(error dep tool not found! https://github.com/golang/dep is required to install Gobot deps)
|
|
|
|
endif
|
|
|
|
dep ensure
|
|
|
|
|
|
|
|
|
2014-07-02 14:10:12 +08:00
|
|
|
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 ; \
|
2015-10-27 00:09:28 +08:00
|
|
|
npm install robeaux ; \
|
|
|
|
cp -r node_modules/robeaux robeaux-tmp ; \
|
2014-07-11 02:35:00 +08:00
|
|
|
cd robeaux-tmp ; \
|
2015-10-27 00:09:28 +08:00
|
|
|
rm Makefile package.json README.markdown ; \
|
2014-07-11 02:13:32 +08:00
|
|
|
touch css/fonts.css ; \
|
2015-10-27 00:09:28 +08:00
|
|
|
echo "Updating robeaux..." ; \
|
2014-07-11 02:35:00 +08:00
|
|
|
go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \
|
|
|
|
mv robeaux.go ../robeaux ; \
|
2014-07-02 14:10:12 +08:00
|
|
|
cd .. ; \
|
2014-07-11 02:35:00 +08:00
|
|
|
rm -rf robeaux-tmp/ ; \
|
2015-10-27 00:09:28 +08:00
|
|
|
rm -rf node_modules/ ; \
|
2014-07-11 02:35:00 +08:00
|
|
|
go fmt ./robeaux/robeaux.go ; \
|
2016-02-20 10:40:30 +08:00
|
|
|
|
|
|
|
EXAMPLES := $(shell ls examples/*.go | sed -e 's/examples\///')
|
|
|
|
|
|
|
|
examples:
|
|
|
|
for example in $(EXAMPLES) ; do \
|
|
|
|
go build -o /tmp/$$example examples/$$example ; \
|
|
|
|
done ; \
|