-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (82 loc) · 3.03 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
98
99
100
include .envrc
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
.PHONY: confirm
confirm:
@echo -n 'Are you sure? [y/N] ' && read ans && [ $${ans:-N} = y ]
# ==================================================================================== #
# DEVELOPMENT
# ==================================================================================== #
## run/awsrouters/excel: run the cmd/api application
.PHONY: run/awsrouters/excel
run/awsrouters/excel:
go run *.go excel
## run/awsrouters/cleanup: run the cmd/api application
.PHONY: run/awsrouters/cleanup
run/awsrouters/cleanup:
@echo 'Cleaning up excel and csv files...'
rm -f csv/*.csv
rm -f excel/*.xlsx
# ==================================================================================== #
# QUALITY CONTROL
# ==================================================================================== #
## audit: tidy dependencies and format, vet and test all code
.PHONY: audit
audit:
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
@echo 'Formatting code...'
go fmt ./...
@echo 'Running tests...'
go test -race -vet=off ./...
@echo 'Testing code coverage...'
go test -cover ./...
@echo 'Vetting code...'
go vet ./...
staticcheck ./...
## vendor: tidy and vendor dependencies
.PHONY: vendor
vendor:
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
@echo 'Vendoring dependencies...'
go mod vendor
# ==================================================================================== #
# BUILD
# ==================================================================================== #
## build/cmd: build the cmd/api application
.PHONY: build/cmd
build/cmd:
@echo 'Building cmd/api...'
GOOS=linux GOARCH=amd64 go build -ldflags='-s' -o=./bin/linux_amd64/api ./cmd/api
go build -ldflags='-s' -o=./bin/mac_arm64/api ./cmd/api
# ==================================================================================== #
# RELEASE
# ==================================================================================== #
## release: build and release the application
.PHONY: release
release:
@echo 'Creating release...'
goreleaser release --snapshot --clean
## release/init: initialize goreleaser
.PHONY: release/init
release/init:
@echo 'Initializing the goreleases...'
goreleaser init
# ==================================================================================== #
# CONTAINER
# ==================================================================================== #
## build/container: build the container image
.PHONY: build/container
build/container:
@echo 'Building container image...'
docker build -t registry.presidio.com/arista/arista-avd-cvaas/crispy-enigma:${CE_TAG} .
docker push registry.presidio.com/arista/arista-avd-cvaas/crispy-enigma:${CE_TAG}