forked from google/yamlfmt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (50 loc) · 1.5 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
.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 ./...
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 ./integrationtest/command -update
.PHONY: command_test_case
command_test_case:
ifndef TESTNAME
$(error "TESTNAME undefined")
endif
mkdir -p integrationtest/command/testdata/$(TESTNAME)/before && \
mkdir -p integrationtest/command/testdata/$(TESTNAME)/stdout
.PHONY: install
install:
go install -ldflags "$(LDFLAGS)" ./cmd/yamlfmt
.PHONY: install_tools
install_tools:
go install github.com/google/addlicense@latest
.PHONY: addlicense
addlicense:
addlicense -ignore "**/testdata/**" -c "Google LLC" -l apache .
.PHONY: addlicense_check
addlicense_check:
addlicense -check -ignore "**/testdata/**" -c "Google LLC" -l apache .