-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (27 loc) · 949 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
35
36
37
38
GOLANG_VERSION := 1.14.2
ALPINE_VERSION := 3.11
GIT_REPO := github.com/szaudowsky/go-actions-test
APP_NAME := go-actions-test
VERSION ?= $(shell git describe --always)
BUILD_TIME ?= $(shell date -u '%Y-%m-%d %H:%M:%S')
GOFILES := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
PACKAGES ?= $(shell go list ./ ... | grep -v /vendor/)
vet: ## Runs `go vet`
go vet $(PACKAGES)
fmt: ## Formats all Go files
gofmt -l -s -w $(GOFILES)
deps: ## Sync dependencies
go mod tidy
build: ## Builds app locally
CGO_ENABLED=0 \
go build \
-v \
-o $(APP_NAME)-$(VERSION) .
run: ## Run app on local env
go run .
test: ## Run all unit tests and generate coverage report
go test -coverprofile coverage.out -v ./...
go tool cover -html=coverage.out -o coverage_report.html
race: ## Run all unit tests with -race flag
go test -race -coverprofile=coverage.out -covermode=atomic
go tool cover -html=coverage.out -o coverage_report.html