-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (54 loc) · 1.5 KB
/
Makefile
File metadata and controls
66 lines (54 loc) · 1.5 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
# BINARY_NAME defaults to the name of the repository
BINARY_NAME := $(notdir $(shell pwd))
LIST_NO_VENDOR := $(go list ./... | grep -v /vendor/)
GOBIN := $(GOPATH)/bin
default: check fmt deps test build
.PHONY: build
build: deps
# Build project
go build -a -o $(BINARY_NAME) .
.PHONY: build-dev
build-dev: deps
# Build Docker container
env GOOS=linux GOARCH=amd64 go build -a -o $(BINARY_NAME) .
docker build --build-arg APP_ENV=dev -t rt-test-engine .
.PHONY: build-stage
build-stage: deps
# Build Docker container
env GOOS=linux GOARCH=amd64 go build -a -o $(BINARY_NAME) .
docker build --build-arg APP_ENV=stage -t rt-test-engine .
.PHONY: build-prod
build-prod: deps
# Build Docker container
env GOOS=linux GOARCH=amd64 go build -a -o $(BINARY_NAME) .
docker build --build-arg APP_ENV=prod -t rt-test-engine .
.PHONY: run-docker
run-docker: build-docker
# Run Docker container
docker run rt-test-engine
.PHONY: check
check:
# Only continue if go is installed
go version || ( echo "Go not installed, exiting"; exit 1 )
.PHONY: clean
clean:
go clean -i
rm -rf ./vendor/*/
rm -f $(BINARY_NAME)
deps:
# Install or update govend
go get -u github.com/govend/govend
# Fetch vendored dependencies
$(GOBIN)/govend -v
.PHONY: fmt
fmt:
# Format all Go source files (excluding vendored packages)
go fmt $(LIST_NO_VENDOR)
generate-deps:
# Generate vendor.yml
govend -v -l
git checkout vendor/.gitignore
.PHONY: test
test:
# Run all tests (excluding vendored packages)
go test -a -v -cover $(LIST_NO_VENDOR)