-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
86 lines (64 loc) · 2.15 KB
/
makefile
File metadata and controls
86 lines (64 loc) · 2.15 KB
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
# generated-from:0f1cfb3f9faa0c83355794c5720cb80c30b77f4fcb2887d31d2887bd169db413 DO NOT REMOVE, DO UPDATE
PLATFORM=$(shell uname -s | tr '[:upper:]' '[:lower:]')
PWD := $(shell pwd)
ifndef VERSION
VERSION := $(shell git describe --tags --abbrev=0)
endif
COMMIT_HASH :=$(shell git rev-parse --short HEAD)
DEV_VERSION := dev-${COMMIT_HASH}
USERID := $(shell id -u $$USER)
GROUPID:= $(shell id -g $$USER)
export GOPRIVATE=github.com/moov-io
all: install build
.PHONY: install
install:
go mod tidy
build:
go build -ldflags "-X github.com/moov-io/rail-msg-sql.Version=${VERSION}" -o bin/rail-msg-sql github.com/moov-io/rail-msg-sql/cmd/rail-msg-sql
.PHONY: setup
setup:
docker compose up -d --force-recreate --remove-orphans
.PHONY: check
check:
ifeq ($(OS),Windows_NT)
@echo "Skipping checks on Windows, currently unsupported."
else
@wget -O lint-project.sh https://raw.githubusercontent.com/moov-io/infra/master/go/lint-project.sh
@chmod +x ./lint-project.sh
COVER_THRESHOLD=45.0 ./lint-project.sh
endif
.PHONY: teardown
teardown:
-docker compose down --remove-orphans
docker:
docker build --pull --build-arg VERSION=${VERSION} -t moov/rail-msg-sql:${VERSION} -f Dockerfile .
docker-push:
docker push moov/rail-msg-sql:${VERSION}
.PHONY: dev-docker
dev-docker:
docker build --pull --build-arg VERSION=${DEV_VERSION} -t moov/rail-msg-sql:${DEV_VERSION} -f Dockerfile .
.PHONY: dev-push
dev-push:
docker push moov/rail-msg-sql:${DEV_VERSION}
# Extra utilities not needed for building
run: build
./bin/rail-msg-sql
docker-run:
docker run -v ${PWD}/data:/data -v ${PWD}/configs:/configs --env APP_CONFIG="/configs/config.yml" -it --rm moov/rail-msg-sql:${VERSION}
test:
go test -cover github.com/moov-io/rail-msg-sql/...
.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/
endif
# For open source projects
dist: clean build
ifeq ($(OS),Windows_NT)
CGO_ENABLED=1 GOOS=windows go build -o bin/rail-msg-sql.exe cmd/rail-msg-sql/*
else
CGO_ENABLED=1 GOOS=$(PLATFORM) go build -o bin/rail-msg-sql-$(PLATFORM)-amd64 cmd/rail-msg-sql/*
endif