-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (39 loc) · 1.44 KB
/
Makefile
File metadata and controls
54 lines (39 loc) · 1.44 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
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
# OAuth credentials - set via environment or .env file
GAC_CLIENT_ID ?= $(shell echo $$GAC_CLIENT_ID)
GAC_CLIENT_SECRET ?= $(shell echo $$GAC_CLIENT_SECRET)
LDFLAGS := -X github.com/Softorize/gac/internal/version.Version=$(VERSION) \
-X github.com/Softorize/gac/internal/version.Commit=$(COMMIT) \
-X github.com/Softorize/gac/internal/version.BuildDate=$(DATE)
ifneq ($(GAC_CLIENT_ID),)
LDFLAGS += -X github.com/Softorize/gac/internal/auth.oauthClientID=$(GAC_CLIENT_ID)
endif
ifneq ($(GAC_CLIENT_SECRET),)
LDFLAGS += -X github.com/Softorize/gac/internal/auth.oauthClientSecret=$(GAC_CLIENT_SECRET)
endif
.PHONY: build test lint clean install fmt vet
build:
go build -ldflags "$(LDFLAGS)" -o bin/gac .
install:
go install -ldflags "$(LDFLAGS)" .
test:
go test ./... -v -count=1
test-short:
go test ./... -short -count=1
lint: vet
@which staticcheck > /dev/null 2>&1 || echo "Install staticcheck: go install honnef.co/go/tools/cmd/staticcheck@latest"
@which staticcheck > /dev/null 2>&1 && staticcheck ./... || true
vet:
go vet ./...
fmt:
gofmt -w .
clean:
rm -rf bin/ dist/
tidy:
go mod tidy
coverage:
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out -o coverage.html
all: fmt vet test build