forked from moov-io/irs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
97 lines (79 loc) · 2.58 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
PLATFORM=$(shell uname -s | tr '[:upper:]' '[:lower:]')
VERSION := $(shell grep -Eo '(v[0-9]+[\.][0-9]+[\.][0-9]+(-[a-zA-Z0-9]*)?)' version.go)
USERID := $(shell id -u $$USER)
GROUPID:= $(shell id -g $$USER)
build: irs
irs:
go build -o ${PWD}/bin/irs ./cmd/irs/*
run: irs
./bin/irs
test: services build
ifneq ($(OS),Windows_NT)
./scripts/install_pdftk.sh
endif
go test -cover ./...
rm -rf cmd/irs/output
services:
-docker-compose up -d --force-recreate
install:
go install github.com/markbates/pkger/cmd/pkger
git checkout LICENSE
.PHONY: setup
setup:
docker-compose up -d --force-recreate --remove-orphans
.PHONY: check
check: build services
ifeq ($(OS),Windows_NT)
@echo "Skipping checks on Windows, currently unsupported."
else
@echo "Installing pdftk"
./scripts/install_pdftk.sh
@wget -O lint-project.sh https://raw.githubusercontent.com/moov-io/infra/master/go/lint-project.sh
@chmod +x ./lint-project.sh
COVER_THRESHOLD=80.0 ./lint-project.sh
@rm -rf cmd/irs/output
endif
dist: clean build
ifeq ($(OS),Windows_NT)
CGO_ENABLED=1 GOOS=windows go build -o bin/irs.exe github.com/moov-io/irs/cmd/irs
else
CGO_ENABLED=1 GOOS=$(PLATFORM) go build -o bin/irs-$(PLATFORM)-amd64 github.com/moov-io/irs/cmd/irs
endif
docker: clean install
docker build --pull -t moov/irs:$(VERSION) -f Dockerfile .
docker tag moov/irs:$(VERSION) moov/irs:latest
docker-run:
docker run -v ${PWD}/configs:/configs --env APP_CONFIG="/configs/config.yml" -it --rm moov/irs:$(VERSION)
docker-push:
docker push moov/irs:$(VERSION)
docker push moov/irs:latest
.PHONY: clean
clean:
ifeq ($(OS),Windows_NT)
@echo "Skipping cleanup on Windows, currently unsupported."
else
@rm -rf cover.out coverage.txt misspell* staticcheck*
@rm -rf ./bin/ openapi-generator-cli-*.jar irs.db ./storage/ lint-project.sh
@rm -rf cmd/irs/output
endif
.PHONY: teardown
teardown:
-docker-compose down --remove-orphans
-docker-compose rm -f -v
.PHONY: cover-test cover-web
cover-test:
go test -coverprofile=cover.out ./...
cover-web:
go tool cover -html=cover.out
# Generate the go code from the public and internal api's
openapitools:
docker run --rm \
-u $(USERID):$(GROUPID) \
-e OPENAPI_GENERATOR_VERSION='4.2.0' \
-v ${PWD}:/local openapitools/openapi-generator-cli batch -- /local/.openapi-generator/client-generator-config.yml
# 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)" >> $@