-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (52 loc) · 2.15 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
57
58
59
60
61
62
63
64
65
# This file is generated with create-go-app: do not edit.
.PHONY: build clean test snapshot all install help setup download-goreleaser download-golangci-lint download
# special target to export all variables
.EXPORT_ALL_VARIABLES:
PROJECT_RELEASE := 1
DOCKER_IMAGE_PREFIX := local
CI_PROJECT_URL := http://localhost
INSTALL_DIR := $(HOME)/bin
GO_VERSION := $(shell (go version | awk '{print $$3;}'))
BINARIES := $(shell find ./dist ! -name '*goreleaserdocker*' -path '*_linux_*' -type f -executable)
GORELEASER := 0.159.0
GOLANGCI := 1.38.0
## build: build the binaries only
build:
goreleaser build --rm-dist --snapshot
## snapshot: create a snapshot release
snapshot:
goreleaser release --snapshot --rm-dist --skip-sign
## clean: cleanup
clean:
rm -rf ./dist
rm -rf ./downloads
## download: installs goreleaser and golangci-lint in the correct version to ~/bin
download: download-goreleaser download-golangci-lint
all: build
## install: installs resulting binaries to $HOME/bin
install: build
mkdir -p $(INSTALL_DIR) && install $(BINARIES) $(INSTALL_DIR)
## test: run linter and tests
test:
go generate ./...
golangci-lint run
go test -v -count=1 ./...
## test-short: run test without linting and not in verbose mode
test-short:
go generate ./...
go test -count=1 ./...
help: Makefile
@echo " Choose a command run in "$(PROJECTNAME)":"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
download-goreleaser:
mkdir -p downloads
cd downloads && curl -s -L -o goreleaser_Linux_x86_64.tar.gz "https://github.com/goreleaser/goreleaser/releases/download/v$(GORELEASER)/goreleaser_Linux_x86_64.tar.gz"
cd downloads && tar -xvf goreleaser_Linux_x86_64.tar.gz
mkdir -p $(INSTALL_DIR) && install downloads/goreleaser $(INSTALL_DIR)
rm -rf downloads
download-golangci-lint:
mkdir -p downloads
cd downloads && curl -s -L -o golangci-lint-linux-amd64.tar.gz "https://github.com/golangci/golangci-lint/releases/download/v$(GOLANGCI)/golangci-lint-$(GOLANGCI)-linux-amd64.tar.gz"
cd downloads && tar -xvf golangci-lint-linux-amd64.tar.gz
mkdir -p $(INSTALL_DIR) && install downloads/golangci-lint-$(GOLANGCI)-linux-amd64/golangci-lint $(INSTALL_DIR)
rm -rf downloads