forked from moov-io/customers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
63 lines (51 loc) · 1.87 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
PLATFORM=$(shell uname -s | tr '[:upper:]' '[:lower:]')
VERSION := $(shell grep -Eo '(v[0-9]+[\.][0-9]+[\.][0-9]+(-[a-zA-Z0-9]*)?)' internal/version/version.go)
.PHONY: build build-server build-examples docker release check
build: check build-server
build-server:
CGO_ENABLED=1 go build -o ./bin/server github.com/moov-io/customers/cmd/server
check:
go fmt ./...
@mkdir -p ./bin/
.PHONY: client
client:
# Versions from https://github.com/OpenAPITools/openapi-generator/releases
@chmod +x ./openapi-generator
@rm -rf ./client
OPENAPI_GENERATOR_VERSION=4.1.3 ./openapi-generator generate -i openapi.yaml -g go -o ./client
rm -f client/go.mod client/go.sum
go fmt ./...
go build github.com/moov-io/customers/client
go test ./client
.PHONY: clean
clean:
@rm -rf client/
@rm -f openapi-generator-cli-*.jar
dist: clean client build
ifeq ($(OS),Windows_NT)
CGO_ENABLED=1 GOOS=windows go build -o bin/customers-windows-amd64.exe github.com/moov-io/customers/cmd/server
else
CGO_ENABLED=1 GOOS=$(PLATFORM) go build -o bin/customers-$(PLATFORM)-amd64 github.com/moov-io/customers/cmd/server
endif
docker:
# Main Customers server Docker image
docker build --pull -t moov/customers:$(VERSION) -f Dockerfile .
docker tag moov/customers:$(VERSION) moov/customers:latest
release: docker AUTHORS
go vet ./...
go test -coverprofile=cover-$(VERSION).out ./...
git tag -f $(VERSION)
release-push:
docker push moov/customers:$(VERSION)
docker push moov/customers:latest
.PHONY: cover-test cover-web
cover-test:
go test -coverprofile=cover.out ./...
cover-web:
go tool cover -html=cover.out
# From https://github.com/genuinetools/img
.PHONY: AUTHORS
AUTHORS:
@$(file >$@,# This file lists all individuals having contributed content to the repository.)
@$(file >>$@,# For how it is generated, see `make AUTHORS`.)
@echo "$(shell git log --format='\n%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf)" >> $@