-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (43 loc) · 1.92 KB
/
Makefile
File metadata and controls
54 lines (43 loc) · 1.92 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
include Makefile.common
CHLOGGEN=chloggen
.PHONY := build
build:
mkdir -p bin && cd cmd/tarunner && GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOCMD) build -o ../../bin/tarunner_$(GOOS)_$(GOARCH) .
.PHONY := install-tools
install-tools:
cd ./internal/tools && $(GOCMD) install go.opentelemetry.io/build-tools/chloggen
cd ./internal/tools && $(GOCMD) install github.com/client9/misspell/cmd/misspell
cd ./internal/tools && $(GOCMD) install github.com/golangci/golangci-lint/v2/cmd/golangci-lint
cd ./internal/tools && $(GOCMD) install github.com/google/addlicense
cd ./internal/tools && $(GOCMD) install golang.org/x/tools/cmd/goimports
cd ./internal/tools && $(GOCMD) install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment
cd ./internal/tools && $(GOCMD) install mvdan.cc/gofumpt
FILENAME?=$(shell git branch --show-current)
.PHONY: chlog-new
chlog-new:
$(CHLOGGEN) new --filename $(FILENAME)
.PHONY: chlog-validate
chlog-validate:
$(CHLOGGEN) validate
.PHONY: chlog-preview
chlog-preview:
$(CHLOGGEN) update --dry
.PHONY: chlog-update
chlog-update:
$(CHLOGGEN) update -v $(VERSION)
.PHONY: windows_amd64-windows_arm64-linux_amd64-linux_arm64-darwin_amd64-darwin_arm64-linux_ppc64le-aix_ppc64_build
%_build:
$(eval OS:=$(word 1,$(subst _, ,$@)))
$(eval ARCH:=$(word 2,$(subst _, ,$@)))
mkdir -p bin && cd cmd/tarunner && GOOS=$(OS) GOARCH=$(ARCH) $(GOCMD) build -o ../../bin/tarunner_$(OS)_$(ARCH)$(if $(filter-out windows,$(OS)),,.exe) .
.PHONY: package
package: windows_amd64_build windows_arm64_build linux_amd64_build linux_arm64_build darwin_amd64_build darwin_arm64_build linux_ppc64le_build aix_ppc64_build
TAG := $(shell git describe --tags --exact-match 2> /dev/null \
|| git symbolic-ref -q --short HEAD \
|| git rev-parse --short HEAD)
.PHONY: docker
docker:
docker build --platform linux/amd64 -t splunk/tarunner:$(TAG) .
.PHONY: docker-push
docker-push: docker
docker push splunk/tarunner:$(TAG)