-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
37 lines (27 loc) · 1.08 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
LDFLAGS := -ldflags="-s -w"
generator_version = v4.2.2
api_doc = https://raw.githubusercontent.com/thepracticaldev/dev.to/7d0aeeefe5cf6250c5b58ae6b631bfe41fe5bf4a/docs/api_v0.yml
.PHONY: test gen lint mod-check install
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
test: ## Run tests
go test -race -covermode atomic -coverprofile=profile.cov -v ./... -count=1
gen:
docker run --rm \
--user "$$(id -u):$$(id -g)" \
-v $(PWD):/local openapitools/openapi-generator-cli:$(generator_version) generate \
-i $(api_doc) \
-g go \
-o /local/pkg/devto \
-c /local/openapi-generator-config.yml && \
gofmt -w pkg/devto/..
lint: ## Run GolangCI-Lint
docker run --rm -v $$(pwd):/app -w /app golangci/golangci-lint:latest golangci-lint run -v
mod-check: ## Run check on go mod tidy
go mod tidy && git --no-pager diff --exit-code -- go.mod go.sum
devto: ## Build devto binary
go build $(LDFLAGS) -o devto
install: ## Install devto into $GOBIN
go install $(LDFLAGS)
clean: ## Cleanup
rm devto