github.com/google/yamlfmt@v0.12.2-0.20240514121411-7f77800e2681/Makefile (about) 1 .EXPORT_ALL_VARIABLES: 2 3 VERSION := $(shell git describe --abbrev=0 --tags | tr -d v) 4 COMMIT := $(shell git rev-parse --short HEAD) 5 LDFLAGS := -X 'main.version=$(VERSION)' \ 6 -X 'main.commit=$(COMMIT)' 7 8 .PHONY: build 9 build: 10 go build -ldflags "$(LDFLAGS)" -o dist/yamlfmt ./cmd/yamlfmt 11 12 .PHONY: test 13 test: 14 go test ./... 15 16 .PHONY: test_v 17 test_v: 18 go test -v ./... 19 20 YAMLFMT_BIN ?= $(shell pwd)/dist/yamlfmt 21 .PHONY: integrationtest 22 integrationtest: 23 $(MAKE) build 24 go test -v -tags=integration_test ./integrationtest/command 25 26 .PHONY: integrationtest_v 27 integrationtest_v: 28 $(MAKE) build 29 go test -v -tags=integration_test ./integrationtest/command 30 31 .PHONY: integrationtest_stdout 32 integrationtest_stdout: 33 $(MAKE) build 34 go test -v -tags=integration_test ./integrationtest/command -stdout 35 36 .PHONY: integrationtest_update 37 integrationtest_update: 38 $(MAKE) build 39 go test -tags=integration_test ./integrationtest/command -update 40 41 .PHONY: command_test_case 42 command_test_case: 43 ifndef TESTNAME 44 $(error "TESTNAME undefined") 45 endif 46 mkdir -p integrationtest/command/testdata/$(TESTNAME)/before && \ 47 mkdir -p integrationtest/command/testdata/$(TESTNAME)/stdout 48 49 .PHONY: install 50 install: 51 go install -ldflags "$(LDFLAGS)" ./cmd/yamlfmt 52 53 .PHONY: install_tools 54 install_tools: 55 go install github.com/google/addlicense@latest 56 57 .PHONY: addlicense 58 addlicense: 59 addlicense -ignore "**/testdata/**" -c "Google LLC" -l apache . 60 61 .PHONY: addlicense_check 62 addlicense_check: 63 addlicense -check -ignore "**/testdata/**" -c "Google LLC" -l apache .