github.com/furusax0621/goa-v1@v1.4.3/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/mdc \
    21  	github.com/fzipp/gocyclo \
    22  	github.com/onsi/ginkgo \
    23  	github.com/onsi/ginkgo/ginkgo \
    24  	github.com/onsi/gomega \
    25  	github.com/pkg/errors \
    26  	golang.org/x/lint/golint \
    27  	golang.org/x/tools/cmd/cover \
    28  	golang.org/x/tools/cmd/goimports
    29  
    30  .PHONY: goagen
    31  
    32  all: depend lint cyclo goagen test
    33  
    34  docs:
    35  	@go get -v github.com/spf13/hugo
    36  	@git clone https://github.com/goadesign/goa.design
    37  	@rm -rf goa.design/content/reference goa.design/public
    38  	@mdc --exclude goa.design github.com/goadesign/goa goa.design/content/reference
    39  	@cd goa.design && hugo
    40  	@rm -rf public
    41  	@mv goa.design/public public
    42  	@rm -rf goa.design
    43  
    44  depend:
    45  	@mkdir -p $(GOPATH)/src/golang.org/x
    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