forked from xackery/launcheq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (50 loc) · 1.95 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
NAME ?= launcheq
VERSION ?= 0.0.9
FILELIST_URL ?= https://raw.githubusercontent.com/xackery/launcheq/rof
PATCHER_URL ?= https://github.com/xackery/launcheq/releases/latest/download/
# CICD triggers this
.PHONY: set-variable
set-version:
@echo "VERSION=${VERSION}" >> $$GITHUB_ENV
#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/[email protected]
sanitize:
@echo "sanitize: checking for errors"
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: sanitize
@echo "run: building"
mkdir -p bin
cd bin && go run ../main.go
#go install github.com/tc-hib/go-winres@latest
bundle:
go-winres simply --icon launcheq.png
.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}"
go install github.com/akavel/rsrc@latest
rsrc -ico launcheq.ico -manifest launcheq.exe.manifest
GOOS=windows GOARCH=amd64 go build -buildmode=pie -ldflags="-X main.Version=${VERSION} -X main.PatcherUrl=${PATCHER_URL} -s -w" -o bin/${NAME}.exe