mirror of
https://github.com/go-ping/ping.git
synced 2025-04-27 10:31:15 +00:00
Add Makefile (#99)
Add a Makefile to simplify build and test. Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
parent
e11dda7fa5
commit
54d38cd396
@ -11,9 +11,7 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- run: go mod download
|
||||
- run: go vet ./...
|
||||
- run: go test ./... -cover -race
|
||||
- run: go build -race ./cmd/ping
|
||||
- run: make
|
||||
- run: curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | BINDIR=/home/circleci/.local/bin sh
|
||||
- run: goreleaser release --skip-publish --snapshot
|
||||
- store_artifacts:
|
||||
|
32
Makefile
Normal file
32
Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
GO ?= go
|
||||
GOFMT ?= $(GO)fmt
|
||||
GOOPTS ?=
|
||||
GO111MODULE :=
|
||||
pkgs = ./...
|
||||
|
||||
all: style vet build test
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
@echo ">> building ping"
|
||||
GO111MODULE=$(GO111MODULE) $(GO) build $(GOOPTS) ./cmd/ping
|
||||
|
||||
.PHONY: style
|
||||
style:
|
||||
@echo ">> checking code style"
|
||||
@fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \
|
||||
if [ -n "$${fmtRes}" ]; then \
|
||||
echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \
|
||||
echo "Please ensure you are using $$($(GO) version) for formatting code."; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo ">> running all tests"
|
||||
GO111MODULE=$(GO111MODULE) $(GO) test -race -cover $(GOOPTS) $(pkgs)
|
||||
|
||||
.PHONY: vet
|
||||
vet:
|
||||
@echo ">> vetting code"
|
||||
GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs)
|
Loading…
Reference in New Issue
Block a user