forked from restechnica/semverbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (44 loc) · 1.13 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# make sure targets do not conflict with file and folder names
.PHONY: build clean test
# build the project
build: build-prerelease
build-prerelease:
@nu main.nu build
build-all:
@nu main.nu build --all --version "$$(sbot predict version --debug)"
# run quality assessment checks
check:
@echo "Running go version check ..."
@go version | grep -q 'go1.21' || (echo "Go version 1.21 required. Your version is '$$(go version)'" && exit 1)
@echo "Ok!"
@echo "Running gofmt ..."
@! gofmt -s -d -l . 2>&1 | grep -vE '^\.git/'
@echo "Ok!"
@echo "Running go vet ..."
@go vet ./...
@echo "Ok!"
@echo "Running goimports ..."
@! goimports -l . | grep -vF 'No Exceptions'
@echo "Ok!"
# clean
clean:
rm -rf bin out
# format
format:
go fmt ./...
goimports -w .
# get all dependencies
provision:
@echo "Getting dependencies ..."
@go install golang.org/x/tools/cmd/goimports@latest
@go install github.com/gregoryv/uncover/cmd/uncover@latest
@go mod download
@echo "Done!"
# run the binary
run:
$(env) && ./bin/sbot $(args)
# run tests
test:
mkdir -p ./out
go test ./... -cover -v -coverprofile ./out/coverage.txt
uncover ./out/coverage.txt