-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (30 loc) · 940 Bytes
/
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
OK_COLOR=\033[32;01m
NO_COLOR=\033[0m
.PHONY: all
all: clean format deps build
build:
$(eval SHA := $(shell git rev-parse HEAD))
@echo "$(OK_COLOR)==> Compiling binary$(NO_COLOR)"
go build -ldflags "-X main.gitversion '$(SHA)'" -o bin/godeploy
archive:
@echo "$(OK_COLOR)==> Building Tarball...$(NO_COLOR)"
tar -cvzf dist/godeploy.tar.gz config/production.ini config/staging.ini bin/godeploy
upload:
$(eval SHA := $(shell git rev-parse HEAD))
$(eval BRANCH := $(shell git rev-parse --abbrev-ref HEAD))
aws s3api put-object \
--bucket godeploy \
--key builds/godeploy_${SHA}.tar.gz \
--body dist/godeploy.tar.gz \
--metadata branch=${BRANCH},sha=${SHA}
publish: all archive upload
clean:
@rm -rf bin/
deps:
@echo "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)"
@go get -d -v ./...
@go list -f '{{range .TestImports}}{{.}} {{end}}' ./... | xargs -n1 go get -d
format:
go fmt ./...
test:
@go test -cover ./...