build(make): reorganization
This commit is contained in:
parent
a5f803b333
commit
8cb286ed5c
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,5 @@
|
||||
coverage.*
|
||||
dist/*
|
||||
report.xml
|
||||
.gobin/*
|
||||
.cache/*
|
||||
|
78
Makefile
78
Makefile
@ -1,43 +1,21 @@
|
||||
.PHONY: build
|
||||
build:
|
||||
goreleaser build --rm-dist --snapshot
|
||||
GO := go
|
||||
|
||||
.PHONY: release
|
||||
release:
|
||||
goreleaser release --rm-dist --snapshot --skip-publish
|
||||
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
CACHE_DIR := $(ROOT_DIR)/.cache
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
go generate
|
||||
export GOBIN := $(ROOT_DIR)/.gobin
|
||||
export PATH := $(GOBIN):$(PATH)
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
golangci-lint run --enable-all --disable=exhaustivestruct,godox
|
||||
GORELEASER := $(GO) run github.com/goreleaser/goreleaser@v1.7.0
|
||||
GOLANGCI_LINT := $(GO) run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -v \
|
||||
-race \
|
||||
-coverprofile coverage.out \
|
||||
./...
|
||||
go tool cover -func coverage.out
|
||||
GOTESTSUM := $(GO) run gotest.tools/gotestsum@v1.7.0
|
||||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
go mod tidy
|
||||
go mod vendor
|
||||
|
||||
.PHONY: coverage
|
||||
coverage:
|
||||
gocover-cobertura < coverage.out > coverage.xml
|
||||
|
||||
.PHONY: install-tools
|
||||
install-tools:
|
||||
go list -f '{{range .Imports}}{{.}} {{end}}' tools/tools.go | xargs go install -v
|
||||
GOREADME := $(GO) run github.com/posener/goreadme/cmd/goreadme@v1.4.2
|
||||
|
||||
.PHONY: readme
|
||||
readme:
|
||||
goreadme \
|
||||
$(GOREADME) \
|
||||
-constants \
|
||||
-credit=false \
|
||||
-types \
|
||||
@ -48,3 +26,39 @@ readme:
|
||||
.PHONY: setup-githooks
|
||||
setup-githooks:
|
||||
git config core.hooksPath githooks
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
$(GOTESTSUM) \
|
||||
--junitfile report.xml \
|
||||
-- \
|
||||
-race \
|
||||
-cover \
|
||||
-coverprofile=coverage.out \
|
||||
-tags=integration \
|
||||
./... \
|
||||
-timeout=120m
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
$(GOLANGCI_LINT) run \
|
||||
--enable-all \
|
||||
--disable=godox,varnamelen,exhaustivestruct \
|
||||
--timeout 10m
|
||||
|
||||
.PHONY: tidy
|
||||
tidy:
|
||||
$(GO) mod tidy
|
||||
$(GO) mod vendor
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
$(GORELEASER) build --rm-dist --snapshot
|
||||
|
||||
.PHONY: release
|
||||
release:
|
||||
$(GORELEASER) release --rm-dist
|
||||
|
||||
.PHONY: release-snapshot
|
||||
release-snapshot:
|
||||
$(GORELEASER) release --rm-dist --snapshot --skip-publish
|
||||
|
Loading…
Reference in New Issue
Block a user