-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (32 loc) · 914 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
BUILD_DATE := `date +%Y-%m-%d\ %H:%M`
VERSIONFILE := version.go
APP_VERSION := `bash ./generate_version.sh`
APP_NAME := "twitch-box"
all: build
genversion:
rm -f $(VERSIONFILE)
@echo "package main" > $(VERSIONFILE)
@echo "const (" >> $(VERSIONFILE)
@echo " Version = \"$(APP_VERSION)\"" >> $(VERSIONFILE)
@echo " BuildDate = \"$(BUILD_DATE)\"" >> $(VERSIONFILE)
@echo ")" >> $(VERSIONFILE)
build: genversion
go build
install: genversion
go install
test:
go test -v ./...
benchmark:
go test -bench=. ./...
coverage:
## Right now the coverprofile option is not allowed when testing multiple packages.
## this is the best we can do for now until writing a bash script to loop over packages.
go test -cover ./...
# go test --coverprofile=coverage.out
# go tool cover -html=coverage.out
deploy: genversion
GOOS=linux GOARCH=amd64 go build
scp ./$(APP_NAME) do:
rm $(APP_NAME)
clean:
rm $(APP_NAME)