-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (36 loc) · 1.59 KB
/
Copy pathMakefile
File metadata and controls
49 lines (36 loc) · 1.59 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
.PHONY: init tag_and_push run-test linter fixfieldalignment unit-test-pretty run-benchmark coverage show-uncovered coverage-html show-cog
EXISTING_VERSION := $(shell git describe --abbrev=0 --tags)
NEW_VERSION := $(shell echo $(EXISTING_VERSION) | awk -F. '{print ""$$1"."$$2"."$$3 + 1}')
init:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@v0.29.0
go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.5.0
go install github.com/GokselKUCUKSAHIN/go-run-bench@v1.0.1
go install github.com/msoap/go-carpet@v1.9.0
go install github.com/uudashr/gocognit/cmd/gocognit@v1.2.0
tag_and_push:
git tag $(NEW_VERSION)
git push origin $(NEW_VERSION)
run-all-tests:
@go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic
@cd ./internal/integration-test && go test ./... -v -json
run-test:
@go test ./es/... -v -race -coverprofile=coverage.txt -covermode=atomic
linter:
@golangci-lint run -c .golangci.yml --timeout=5m -v --fix
fixfieldalignment:
@fieldalignment --fix ./...
unit-test-pretty:
@go test ./... -count=1 -v -json | gotestfmt
run-benchmark:
@go-run-bench -cooldown=15 -benchmem=true -save=csv
coverage:
@go-carpet ./es -nocolor | awk '/Coverage:/ {print "\033[32mCoverage: " $$2 "\033[0m"}'
show-uncovered:
@go-carpet ./es -nocolor | grep -E '\.go - [0-9]+\.[0-9]+%' | grep -v '100\.0%' || true
coverage-html:
@go test -v -coverprofile=cover.out -covermode=atomic ./...
@go tool cover -html=cover.out -o cover.html
@open cover.html
show-cog:
@gocognit -over 10 es/