-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (36 loc) · 1.29 KB
/
Makefile
File metadata and controls
51 lines (36 loc) · 1.29 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
BINARY = tcloud
GOARCH = arm64
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
DATE=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)
VERSION=0.0.0
IMAGE=thalassa-cloud/tcloud
BUILT_BY=make
ifneq (${BRANCH}, release)
BRANCH := -${BRANCH}
else
BRANCH :=
endif
PKG_LIST := $(shell go list ./...)
LDFLAGS = -ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.branch=${BRANCH} -X main.date=${DATE} -X main.builtBy=${BUILT_BY}"
all: link clean linux darwin
linux:
CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o bin/${BINARY}-linux-${GOARCH} . ;
darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -o bin/${BINARY}-darwin-${GOARCH} . ;
windows:
CGO_ENABLED=0 GOOS=windows GOARCH=${GOARCH} go build ${LDFLAGS} -o bin/${BINARY}-windows-${GOARCH}.exe . ;
snapshot:
goreleaser release --snapshot --clean
build:
CGO_ENABLED=0 go build ${LDFLAGS} -o bin/${BINARY} . ;
chmod +x bin/${BINARY};
test: ## Run unittests
@gotestsum --format=testname $(filter-out ./e2e/...,$(PKG_LIST))
test-e2e: build ## Run E2E tests (requires TCLOUD_E2E_* environment variables)
@gotestsum --format=testname ./e2e/...
docs:
go run tools/docs.go
clean:
-rm -f bin/${BINARY}-* bin/${BINARY}
.PHONY: link linux darwin windows test test-e2e fmt clean docs