forked from oasdiff/oasdiff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (56 loc) · 2.26 KB
/
Makefile
File metadata and controls
69 lines (56 loc) · 2.26 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# A Self-Documenting Makefile: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
VERSION=$(shell git describe --always --tags | cut -d "v" -f 2)
LINKER_FLAGS=-s -w -X github.com/oasdiff/oasdiff/build.Version=${VERSION}
GOLANGCILINT_VERSION=v1.52.2
.PHONY: test
test: doc-breaking-changes localize ## Run tests
@echo "==> Running tests..."
go test ./...
.PHONY: coverage
coverage: ## Run tests with coverage
@echo "==> Running tests with coverage..."
go test -coverprofile=coverage.out ./...
.PHONY: coverage-html
coverage-html: coverage ## Generate HTML coverage report
@echo "==> Generating HTML coverage report..."
go tool cover -html=coverage.out -o coverage.html
.PHONY: build
build: ## Build oasdiff binary
@echo "==> Building oasdiff binary"
go build -ldflags "$(LINKER_FLAGS)" -o ./bin/oasdiff .
.PHONY: install
install: deps ## Install oasdiff binary
@echo "==> Installing oasdiff binary..."
go install -ldflags "$(LINKER_FLAGS)" .
.PHONY: doc-breaking-changes
doc-breaking-changes: ## Generate documentation for breaking changes
@echo "==> Updating breaking changes documentation..."
./scripts/doc_breaking_changes.sh > docs/BREAKING-CHANGES-EXAMPLES.md
.PHONY: deps
deps: ## Download go module dependencies
@echo "==> Installing go.mod dependencies..."
go mod download
go mod tidy
.PHONY: lint
lint: ## Run linter
go fmt ./...
go vet ./...
golangci-lint run --enable=unused
.PHONY: localize
localize: ## Compile localized changelog messages
@echo "==> Compiling localized changelog messages..."
go install github.com/m1/go-localize@latest
go-localize -input checker/localizations_src -output checker/localizations
go fmt ./checker/localizations
.PHONY: devtools
devtools: ## Install dev tools
@echo "==> Installing dev tools..."
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCILINT_VERSION)
.PHONY: help
help: ## Show this help message
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: link-git-hooks
link-git-hooks: ## Install git hooks
@echo "==> Installing all git hooks..."
find .git/hooks -type l -exec rm {} \;
find .githooks -type f -exec ln -sf ../../{} .git/hooks/ \;