github.com/brycereitano/goa@v0.0.0-20170315073847-8ffa6c85e265/Makefile (about) 1 #! /usr/bin/make 2 # 3 # Makefile for goa 4 # 5 # Targets: 6 # - "depend" retrieves the Go packages needed to run the linter and tests 7 # - "lint" runs the linter and checks the code format using goimports 8 # - "test" runs the tests 9 # 10 # Meta targets: 11 # - "all" is the default target, it runs all the targets in the order above. 12 # 13 DIRS=$(shell go list -f {{.Dir}} ./...) 14 15 # Only list test and build dependencies 16 # Standard dependencies are installed via go get 17 DEPEND=\ 18 github.com/go-openapi/loads \ 19 github.com/goadesign/goa-cellar \ 20 github.com/goadesign/goa.design/tools/godoc2md \ 21 github.com/goadesign/goa.design/tools/mdc \ 22 github.com/golang/lint/golint \ 23 github.com/on99/gocyclo \ 24 github.com/onsi/ginkgo \ 25 github.com/onsi/ginkgo/ginkgo \ 26 github.com/onsi/gomega \ 27 github.com/pkg/errors \ 28 github.com/spf13/hugo \ 29 golang.org/x/tools/cmd/cover \ 30 golang.org/x/tools/cmd/goimports 31 32 .PHONY: goagen 33 34 all: depend lint cyclo goagen test 35 36 docs: 37 @git clone https://github.com/goadesign/goa.design 38 @rm -rf goa.design/content/reference goa.design/public 39 @mdc --exclude goa.design github.com/goadesign/goa goa.design/content/reference 40 @cd goa.design && hugo 41 @rm -rf public 42 @mv goa.design/public public 43 @rm -rf goa.design 44 45 depend: 46 @go get -v ./... 47 @go get -v $(DEPEND) 48 49 lint: 50 @for d in $(DIRS) ; do \ 51 if [ "`goimports -l $$d/*.go | tee /dev/stderr`" ]; then \ 52 echo "^ - Repo contains improperly formatted go files" && echo && exit 1; \ 53 fi \ 54 done 55 @if [ "`golint ./... | grep -vf .golint_exclude | tee /dev/stderr`" ]; then \ 56 echo "^ - Lint errors!" && echo && exit 1; \ 57 fi 58 59 cyclo: 60 @if [ "`gocyclo -over 20 . | grep -v _integration_tests | grep -v _test.go | tee /dev/stderr`" ]; then \ 61 echo "^ - Cyclomatic complexity exceeds 20, refactor the code!" && echo && exit 1; \ 62 fi 63 64 test: 65 @ginkgo -r --randomizeAllSpecs --failOnPending --randomizeSuites --race -skipPackage vendor 66 go test ./_integration_tests 67 68 goagen: 69 @cd goagen && \ 70 go install