github.com/MontFerret/ferret@v0.18.0/Makefile (about)

     1  .PHONY: build install compile test e2e doc fmt lint vet release
     2  export CGO_ENABLED=0
     3  
     4  LAB_BIN ?= lab
     5  DIR_BIN = ./bin
     6  DIR_PKG = ./pkg
     7  DIR_E2E = ./e2e
     8  
     9  default: build
    10  
    11  build: vet generate test compile
    12  
    13  install-tools:
    14  	go install honnef.co/go/tools/cmd/staticcheck@latest && \
    15  	go install golang.org/x/tools/cmd/goimports@latest && \
    16  	go install github.com/mgechev/revive@latest
    17  
    18  install:
    19  	go get
    20  
    21  compile:
    22  	go build -v -o ${DIR_BIN}/ferret \
    23  	${DIR_E2E}/cli.go
    24  
    25  test:
    26  	go test ${DIR_PKG}/...
    27  
    28  cover:
    29  	go test -coverprofile=coverage.txt -covermode=atomic ${DIR_PKG}/... && \
    30  	curl -s https://codecov.io/bash | bash
    31  
    32  e2e:
    33  	${LAB_BIN} --timeout=120 --attempts=5 --concurrency=1 --wait=http://127.0.0.1:9222/json/version --runtime=bin://./bin/ferret --files=./e2e/tests --cdn=./e2e/pages/dynamic --cdn=./e2e/pages/static
    34  
    35  bench:
    36  	go test -run=XXX -bench=. ${DIR_PKG}/...
    37  
    38  generate:
    39  	go generate ${DIR_PKG}/...
    40  
    41  doc:
    42  	godoc -http=:6060 -index
    43  
    44  # http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
    45  fmt:
    46  	go fmt ${DIR_PKG}/... && \
    47  	goimports -w -local github.com/MontFerret ./pkg ./e2e
    48  
    49  # https://github.com/mgechev/revive
    50  # go get github.com/mgechev/revive
    51  lint:
    52  	staticcheck ./pkg/compiler ./pkg/drivers ./pkg/runtime ./pkg/stdlib && \
    53  	revive -config revive.toml -formatter stylish -exclude ./pkg/parser/fql/... -exclude ./vendor/... ./...
    54  
    55  # http://godoc.org/code.google.com/p/go.tools/cmd/vet
    56  # go get code.google.com/p/go.tools/cmd/vet
    57  vet:
    58  	go vet ${DIR_PKG}/...