-
Notifications
You must be signed in to change notification settings - Fork 217
/
Makefile
35 lines (26 loc) · 1.25 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
COMMIT_HASH = $(shell git rev-parse HEAD)
build:
go build -ldflags "-s -w -X github.com/evilmartians/lefthook/internal/version.commit=$(COMMIT_HASH)" -o lefthook
build-with-coverage:
go build -cover -ldflags "-s -w -X github.com/evilmartians/lefthook/internal/version.commit=$(COMMIT_HASH)" -o lefthook
install: build
cp lefthook $$(go env GOPATH)/bin
test:
go test -cpu 24 -race -count=1 -timeout=30s ./...
test-integrity: install
go test -cpu 24 -race -count=1 -timeout=30s -tags=integrity integrity_test.go
bench:
go test -cpu 24 -race -run=Bench -bench=. ./...
bin/golangci-lint:
@test -x $$(go env GOPATH)/bin/golangci-lint || \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.59.0
lint: bin/golangci-lint
$$(go env GOPATH)/bin/golangci-lint run --fix
.ONESHELL:
version:
@read -p "New version: " version
sed -i "s/const version = .*/const version = \"$$version\"/" internal/version/version.go
sed -i "s/VERSION = .*/VERSION = \"$$version\"/" packaging/pack.rb
sed -i "s/lefthook-plugin.git\", exact: \".*\"/lefthook-plugin.git\", exact: \"$$version\"/" docs/install.md
ruby packaging/pack.rb clean set_version
git add internal/version/version.go packaging/* docs/install.md