-
Notifications
You must be signed in to change notification settings - Fork 166
/
Makefile
49 lines (36 loc) · 1.4 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
.PHONY: lint test static install uninstall cross acceptance-tests dagger-develop
GOPATH := $(shell go env GOPATH)
VERSION := $(shell git describe --tags --dirty --always)
BIN_DIR := $(GOPATH)/bin
GOX := $(BIN_DIR)/gox
GOLINTER := $(GOPATH)/bin/golangci-lint
$(GOLINTER):
go install github.com/golangci/golangci-lint/cmd/[email protected]
lint: $(GOLINTER)
$(GOLINTER) run
test:
go test ./... -bench=. -benchmem
acceptance-tests:
dagger call acceptance-tests --root-dir .:source-files --acceptance-tests-dir ./acceptance-tests --kustomize-version "" --helm-version ""
# Compilation
dev:
go build -ldflags "-X main.Version=dev-${VERSION}" ./cmd/tk
LDFLAGS := '-s -w -extldflags "-static" -X github.com/grafana/tanka/pkg/tanka.CurrentVersion=${VERSION}'
static:
CGO_ENABLED=0 go build -ldflags=${LDFLAGS} ./cmd/tk
install:
CGO_ENABLED=0 go install -ldflags=${LDFLAGS} ./cmd/tk
uninstall:
go clean -i ./cmd/tk
$(GOX):
go get -u github.com/mitchellh/gox
go install github.com/mitchellh/gox
cross: $(GOX)
CGO_ENABLED=0 $(BIN_DIR)/gox -output="dist/{{.Dir}}-{{.OS}}-{{.Arch}}" -ldflags=${LDFLAGS} -arch="amd64 arm64 arm" -os="linux" -osarch="darwin/amd64" -osarch="darwin/arm64" -osarch="windows/amd64" ./cmd/tk
# Docker container
container: static
docker build -t grafana/tanka .
dagger-develop:
@cp dagger/.gitignore dagger/.gitignore.bak
@dagger develop --silent
@mv dagger/.gitignore.bak dagger/.gitignore