summaryrefslogtreecommitdiff
path: root/vendor/github.com/google/yamlfmt/Makefile
blob: 9993d6d42674cfd5c0731c9205a5d26ecac6b033 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.EXPORT_ALL_VARIABLES:

VERSION  := $(shell git describe --abbrev=0 --tags | tr -d v)
COMMIT := $(shell git rev-parse --short HEAD)
LDFLAGS := -X 'main.version=$(VERSION)' \
           -X 'main.commit=$(COMMIT)'

.PHONY: build
build:
	go build -ldflags "$(LDFLAGS)" -o dist/yamlfmt ./cmd/yamlfmt

.PHONY: test
test:
	go test ./...

.PHONY: test_v
test_v:
	@go test -v $$(go list ./... | grep -v "pkg/yaml")
	@go test ./pkg/yaml/formattest

.PHONY: vet
vet:
	go vet $$(go list ./... | grep -v "pkg/yaml")

YAMLFMT_BIN ?= $(shell pwd)/dist/yamlfmt
.PHONY: integrationtest
integrationtest:
	$(MAKE) build
	go test -v -tags=integration_test ./integrationtest/command

.PHONY: integrationtest_v
integrationtest_v:
	$(MAKE) build
	go test -v -tags=integration_test ./integrationtest/command

.PHONY: integrationtest_stdout
integrationtest_stdout:
	$(MAKE) build
	go test -v -tags=integration_test ./integrationtest/command -stdout

.PHONY: integrationtest_update
integrationtest_update:
	$(MAKE) build
	go test -tags=integration_test -v ./integrationtest/command -update

.PHONY: command_test_case
command_test_case:
ifndef TESTNAME
	$(error "TESTNAME undefined")
endif
	./integrationtest/command/new_test_case.sh "$(TESTNAME)"

.PHONY: install
install:
	go install -ldflags "$(LDFLAGS)" ./cmd/yamlfmt

.PHONY: install_tools
install_tools:
	go install github.com/google/addlicense@latest

ADDLICENSE = addlicense -ignore "**/testdata/**" -ignore "**/pkg/yaml/**" -c "Google LLC" -l apache

.PHONY: addlicense
addlicense:
	$(ADDLICENSE) .

.PHONY: addlicense_check
addlicense_check:
	$(ADDLICENSE) -check .