This repository was archived by the owner on May 20, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (53 loc) · 1.42 KB
/
Copy pathMakefile
File metadata and controls
62 lines (53 loc) · 1.42 KB
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
# Variables
APP_NAME=asana
BUILD_DIR=build
VERSION := $(shell git describe --tags --abbrev=0 --always)
LDFLAGS := -ldflags "-X github.com/timwehrle/asana/internal/build.Version=${VERSION} \
-X github.com/timwehrle/asana/internal/build.Date=${shell date -u +%Y-%m-%dT%H:%M:%SZ}"
# Commands
GOCMD := go
GOMOD := $(GOCMD) mod
GOVET := $(GOCMD) vet
GOTEST := $(GOCMD) test
GOBUILD := $(GOCMD) build
GORUN := $(GOCMD) run
GOCLEAN := $(GOCMD) clean
LINT := golangci-lint run
GOFMT := gofmt
VULN := golang.org/x/vuln/cmd/govulncheck@latest
.PHONY: build
build: ## Run build
@echo "Running build"
$(GOBUILD) ${LDFLAGS} -o $(BUILD_DIR)/$(APP_NAME) ./cmd/asana
.PHONY: test
test: ## Run tests
@echo "Running tests..."
$(GOTEST) -v ./...
.PHONY: test/cover
test/cover: ## Run tests with coverage
@echo "Running tests with coverage..."
$(GOTEST) -v -coverprofile=c.out ./...
$(GOCMD) tool cover -html=c.out
.PHONY: lint
lint: ## Run linter
@echo "Running lint..."
$(LINT)
.PHONY: fmt
fmt: ## Run formatter
@echo "Formatting code..."
$(GOFMT) -s -l -e .
.PHONY: audit
audit: ## Audit code
@echo "Running audit..."
$(GOMOD) tidy
$(GOMOD) verify
$(GOVET) ./...
$(GORUN) $(VULN) ./...
.PHONY: release
release: ## Run GoReleaser
@echo "Releasing..."
goreleaser release --clean
.PHONY: help
help: ## Show available commands
@grep -E '^[a-zA-Z_/.-]+:.*?##' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = "##"}; {printf "%-20s %s\n", $$1, $$2}'