-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (45 loc) · 1.34 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
APP=pack-svc
APP_VERSION:=0.1
APP_COMMIT:=$(shell git rev-parse HEAD)
APP_EXECUTABLE="./out/$(APP)"
ALL_PACKAGES=$(shell go list ./... | grep -v "vendor")
CONFIG_FILE="./.env"
HTTP_SERVE_COMMAND="http-serve"
setup: copy-config
compile:
mkdir -p out/
go build -ldflags "-X main.version=$(APP_VERSION) -X main.commit=$(APP_COMMIT)" -o $(APP_EXECUTABLE) cmd/*.go
build: deps compile
http-serve: build
$(APP_EXECUTABLE) -configFile=$(configFile) $(HTTP_SERVE_COMMAND)
app:
docker-compose -f build/docker-compose.pack-svc.yml -f build/docker-compose.network.yml up -d --build
docker logs -f pack-svc-go
http-local-serve: build
$(APP_EXECUTABLE) -configFile=$(CONFIG_FILE) $(HTTP_SERVE_COMMAND)
copy-config:
cp .env.sample .env
tidy:
go mod tidy
deps:
go mod download
fmt:
go fmt $(ALL_PACKAGES)
vet:
go vet $(ALL_PACKAGES)
clean:
rm -rf out/
build-test-container:
docker build -t go-build go-build
test: build-test-container
docker run --rm -v $$(pwd):/project -w /project go-build -c "go clean -testcache ; go test ./pkg/..."
functional-test:
docker exec -w /project -ti functional-test-go sh -c "go clean -testcache ; go test ./functionaltest/..."
test-cover-html:
go clean -testcache
mkdir -p out/
go test ./... -coverprofile=out/coverage.out
go tool cover -html=out/coverage.out
ci-test: test
lint:
golangci-lint run cmd/... pkg/...