github.com/wtsi-ssg/wrstat/v4@v4.5.1/Makefile (about)

     1  PKG := github.com/wtsi-ssg/wrstat/v4
     2  VERSION := $(shell git describe --tags --always --long --dirty)
     3  TAG := $(shell git describe --abbrev=0 --tags)
     4  LDFLAGS = -ldflags "-X ${PKG}/cmd.Version=${VERSION}"
     5  export GOPATH := $(shell go env GOPATH)
     6  PATH := $(PATH):${GOPATH}/bin
     7  
     8  default: install
     9  
    10  # We require CGO_ENABLED=1 for getting group information to work properly; the
    11  # pure go version doesn't work on all systems such as those using LDAP for
    12  # groups
    13  
    14  build: export CGO_ENABLED = 1
    15  build:
    16  	@cd server/static/wrstat; npm install && npm run build:prod
    17  	go build -tags netgo ${LDFLAGS}
    18  
    19  install: export CGO_ENABLED = 1
    20  install:
    21  	@rm -f ${GOPATH}/bin/wrstat
    22  	@cd server/static/wrstat; npm install && npm run build:prod
    23  	@go install -tags netgo ${LDFLAGS}
    24  	@echo installed to ${GOPATH}/bin/wrstat
    25  
    26  installnonpm: export CGO_ENABLED = 1
    27  installnonpm:
    28  	@rm -f ${GOPATH}/bin/wrstat
    29  	@go install -tags netgo ${LDFLAGS}
    30  	@echo installed to ${GOPATH}/bin/wrstat
    31  
    32  test: export CGO_ENABLED = 1
    33  test:
    34  	@cd server/static/wrstat; npm install && CI= npm run build:prod
    35  	@go test -tags netgo --count 1 ./...
    36  	@cd server/static/wrstat; CI=1 npm test
    37  
    38  race: export CGO_ENABLED = 1
    39  race:
    40  	@cd server/static/wrstat; npm install && CI= npm run build:prod
    41  	go test -tags netgo -race --count 1 ./...
    42  	@cd server/static/wrstat; CI=1 npm test
    43  
    44  bench: export CGO_ENABLED = 1
    45  bench:
    46  	go test -tags netgo --count 1 -run Bench -bench=. ./...
    47  
    48  # curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
    49  lint: export CGO_ENABLED = 1
    50  lint:
    51  	@golangci-lint run
    52  
    53  clean:
    54  	@rm -f ./wrstat
    55  	@rm -f ./dist.zip
    56  
    57  dist: export CGO_ENABLED = 1
    58  # go get -u github.com/gobuild/gopack
    59  # go get -u github.com/aktau/github-release
    60  dist:
    61  	gopack pack --os linux --arch amd64 -o linux-dist.zip
    62  	github-release release --tag ${TAG} --pre-release
    63  	github-release upload --tag ${TAG} --name wrstat-linux-x86-64.zip --file linux-dist.zip
    64  	@rm -f wrstat linux-dist.zip
    65  
    66  .PHONY: test race bench lint build install clean dist