forked from grafana/tanka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (32 loc) · 1.11 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
.PHONY: lint test static install uninstall cross
VERSION := $(shell git describe --tags --dirty --always)
BIN_DIR := $(GOPATH)/bin
GOX := $(BIN_DIR)/gox
lint:
test -z $$(gofmt -s -l cmd/ pkg/)
go vet ./...
test:
go test ./...
# Compilation
dev:
go build -ldflags "-X main.Version=dev-${VERSION}" ./cmd/tk
LDFLAGS := '-s -w -extldflags "-static" -X github.com/grafana/tanka/pkg/tanka.CURRENT_VERSION=${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 .
# CI
drone:
drone jsonnet --source .drone/drone.jsonnet --target .drone/drone.yml --stream --format
drone lint .drone/drone.yml
drone sign --save grafana/tanka .drone/drone.yml