forked from air-verse/air
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (39 loc) · 1.25 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
AIRVER := $(shell git describe --tags)
LDFLAGS += -X "main.BuildTimestamp=$(shell date -u "+%Y-%m-%d %H:%M:%S")"
LDFLAGS += -X "main.airVersion=$(AIRVER)"
LDFLAGS += -X "main.goVersion=$(shell go version | sed -r 's/go version go(.*)\ .*/\1/')"
GO := GO111MODULE=on go
.PHONY: init
init:
go install golang.org/x/lint/golint@latest
go install golang.org/x/tools/cmd/goimports@latest
@echo "Install pre-commit hook"
@ln -s $(shell pwd)/hooks/pre-commit $(shell pwd)/.git/hooks/pre-commit || true
@chmod +x ./hack/check.sh
.PHONY: setup
setup: init
git init
.PHONY: check
check:
@./hack/check.sh ${scope}
.PHONY: ci
ci: init
@$(GO) mod tidy && $(GO) mod vendor
.PHONY: build
build: check
$(GO) build -ldflags '$(LDFLAGS)'
.PHONY: install
install: check
@echo "Installing air..."
@$(GO) install -ldflags '$(LDFLAGS)'
.PHONY: release
release: check
GOOS=darwin GOARCH=amd64 $(GO) build -ldflags '$(LDFLAGS)' -o bin/darwin/air
GOOS=linux GOARCH=amd64 $(GO) build -ldflags '$(LDFLAGS)' -o bin/linux/air
GOOS=windows GOARCH=amd64 $(GO) build -ldflags '$(LDFLAGS)' -o bin/windows/air.exe
.PHONY: docker-image
docker-image:
docker build -t cosmtrek/air:$(AIRVER) -f ./Dockerfile .
.PHONY: push-docker-image
push-docker-image:
docker push cosmtrek/air:$(AIRVER)