forked from dnnrly/wait-for
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (57 loc) · 1.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# vi:syntax=make
.ONESHELL:
.DEFAULT_GOAL := help
SHELL := /bin/bash
.SHELLFLAGS = -ec
TMP_DIR?=./tmp
BASE_DIR=$(shell pwd)
MAKEFILE_ABSPATH := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
MAKEFILE_RELPATH := $(call MAKEFILE_ABSPATH)
export GO111MODULE=on
export GOPROXY=https://proxy.golang.org
export PATH := $(BASE_DIR)/bin:$(PATH)
.PHONY: help
help: ## print help message
@echo "Usage: make <command>"
@echo
@echo "Available commands are:"
@grep -E '^\S[^:]*:.*?## .*$$' $(MAKEFILE_RELPATH) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-4s\033[36m%-30s\033[0m %s\n", "", $$1, $$2}'
@echo
.PHONY: clean
clean:
rm -f wait-for
.PHONY: clean-deps
clean-deps:
rm -rf ./bin
rm -rf ./tmp
./bin/golangci-lint:
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.42.0
./bin/tparse: ./bin ./tmp
curl -sfL -o ./tmp/tparse.tar.gz https://github.com/mfridman/tparse/releases/download/v0.8.3/tparse_0.8.3_Linux_x86_64.tar.gz
tar -xf ./tmp/tparse.tar.gz -C ./bin
./bin:
mkdir -p ./bin
./tmp:
mkdir -p ./tmp
.PHONY: deps
deps: ./bin/tparse ./bin/golangci-lint
go get -v ./...
go mod tidy
.PHONY: build
build: ## build the application
go build -o wait-for ./cmd/wait-for
.PHONY: lint
lint: ## run linting
golangci-lint run
.PHONY: test
test: ## run unit tests
go test -race -cover -json ./... | tparse -all
.PHONY: ci-test
ci-test: ## ci target - run tests to generate coverage data
go test -race -coverprofile=coverage.txt -covermode=atomic ./...
.PHONY: acceptance-test
acceptance-test: build ## run acceptance tests
cd test && godog
.PHONY: acceptance-test-docker
acceptance-test-docker: ## run acceptance tests in Docker (if you can't open local ports reliably)
docker-compose -f test/docker-compose.yml up --build --abort-on-container-exit godog