diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2018-08-01 01:16:06 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2018-08-01 01:51:36 +0100 |
commit | 8ab6dc3212b43c114353a578e32e3bc07bb8516b (patch) | |
tree | 2646293b4dcf7873d94d6eeecb6800665e618513 | |
parent | e2b4c3882762406fd3da16f5865cfc3e36e048b5 (diff) |
Switch to a Makefile
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | Makefile | 33 | ||||
-rwxr-xr-x | regen.sh | 11 | ||||
-rwxr-xr-x | run_tests.sh | 16 |
4 files changed, 35 insertions, 29 deletions
diff --git a/.travis.yml b/.travis.yml index b91eaa3..441d850 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ matrix: - go: tip before_install: - - go get -v github.com/golang/lint/golint + - make dep install: - go version @@ -25,4 +25,4 @@ before_script: sudo: false script: - - ./run_tests.sh + - make test
\ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1c1f8bc --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +CASHIER_CMD := ./cmd/cashier +CASHIER_BIN := ./cashier +CASHIERD_BIN := ./cashierd +CASHIERD_CMD := ./cmd/cashierd +SRC_FILES = $(shell find * -type f -name '*.go' -not -path 'vendor/*' -not -name 'a_*-packr.go') + +all: test build + +test: dep + go test ./... + go install -race $(CASHIER_CMD) $(CASHIERD_CMD) + go vet ./... + go list ./... |egrep -v 'vendor/|proto$$' |xargs -L1 golint -set_exit_status + gofmt -d $(SRC_FILES) + +build: cashier cashierd + +generate: + go generate -x ./... + +cashier: + go build -o cashier $(CASHIER_CMD) + +cashierd: generate + go build -o cashierd $(CASHIERD_CMD) + +clean: + rm -f cashier cashierd + +dep: + go get -u github.com/golang/lint/golint + +.PHONY: dep generate test cashier cashierd
\ No newline at end of file diff --git a/regen.sh b/regen.sh deleted file mode 100755 index f525b15..0000000 --- a/regen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# Run this script from the root of the repo to regenerate static content. - -set -xue - -go get -u github.com/mjibson/esc -${GOPATH}/bin/esc -ignore '\.go' -prefix 'server' \ - -o 'server/static/static.go' -pkg 'static' 'server/static' - -go get -u github.com/golang/protobuf/protoc-gen-go -protoc --go_out=plugins=grpc:. proto/signer.proto diff --git a/run_tests.sh b/run_tests.sh deleted file mode 100755 index 3b27193..0000000 --- a/run_tests.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh - -# This can be used as a pre-commit script. Just run -# cp run_tests.sh .git/hooks/pre-commit -# and it will run before each commit. - -set -xue - -go install -race -v ./cmd/cashier ./cmd/cashierd -go list ./... |grep -v vendor/ |xargs go test -race -gofmt -d $(find * -type f -name '*.go' -not -path 'vendor/*') -go list ./... |grep -v vendor/ |xargs go vet -if ! type -f golint > /dev/null; then - go get -u github.com/golang/lint/golint -fi -go list ./... |egrep -v 'vendor/|proto$' |xargs -L1 golint -set_exit_status |