-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (43 loc) · 1.84 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
NAME ?= filelistbuilder
VERSION := 0.1.7
#go install golang.org/x/tools/cmd/goimports@latest
#go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
#go install golang.org/x/lint/golint@latest
#go install honnef.co/go/tools/cmd/staticcheck@v0.2.2
# CICD triggers this
.PHONY: set-variable
set-version:
@echo "VERSION=${VERSION}" >> $$GITHUB_ENV
sanitize:
rm -rf vendor/
go vet -tags ci ./...
test -z $(goimports -e -d . | tee /dev/stderr)
gocyclo -over 30 .
golint -set_exit_status $(go list -tags ci ./...)
staticcheck -go 1.14 ./...
go test -tags ci -covermode=atomic -coverprofile=coverage.out ./...
coverage=`go tool cover -func coverage.out | grep total | tr -s '\t' | cut -f 3 | grep -o '[^%]*'`
run: build-darwin
cd bin && mkdir -p rof
cd bin/rof && echo "[LoginServer]" > eqhost.txt && echo "host=test.com:9000" >> eqhost.txt
cd bin && ./filelistbuilder-darwin-x64 rof https://test.com filelistbuilder-darwin-x64
.PHONY: build-all
build-all: sanitize build-prepare build-linux build-darwin build-windows
.PHONY: build-prepare
build-prepare:
@echo "Preparing talkeq ${VERSION}"
@rm -rf bin/*
@-mkdir -p bin/
.PHONY: build-darwin
build-darwin:
@echo "Building darwin ${VERSION}"
@GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -buildmode=pie -ldflags="-X main.Version=${VERSION} -s -w" -o bin/${NAME}-darwin-x64 main.go
.PHONY: build-linux
build-linux:
@echo "Building Linux ${VERSION}"
@GOOS=linux GOARCH=amd64 go build -buildmode=pie -ldflags="-X main.Version=${VERSION} -w" -o bin/${NAME}-linux-x64 main.go
.PHONY: build-windows
build-windows:
@echo "Building Windows ${VERSION}"
@GOOS=windows GOARCH=amd64 go build -buildmode=pie -ldflags="-X main.Version=${VERSION} -s -w" -o bin/${NAME}-win-x64.exe main.go
@GOOS=windows GOARCH=386 go build -buildmode=pie -ldflags="-X main.Version=${VERSION} -s -w" -o bin/${NAME}-win-x86.exe main.go