-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (55 loc) · 1.85 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
57
58
59
60
61
62
63
64
65
66
# ============================================================================ #
# HELPERS
# ============================================================================ #
## help: print this help message
.PHONY: help
help:
@echo 'Usage:'
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
# ============================================================================ #
# EXAMPLES
# ============================================================================ #
## example/motion: example to change the camera motion status
.PHONY: example/motion
example/motion:
go run ./example/motion/change.go
## example/snap: example to snap a picture from the camera
.PHONY: example/snap
example/snap:
go run ./example/picture/snap.go
# ============================================================================ #
# QUALITY CONTROL
# ============================================================================ #
## lint: run Go linters (golangci-lint)
.PHONY: lint
lint:
@echo 'Linting code...'
golangci-lint run
## audit: tidy dependencies and format, vet and test all code
.PHONY: audit
audit: vendor lint
@echo 'Formatting code...'
go fmt
@echo 'Running tests...'
go test -v -race -vet=off
## vulncheck: check for known vulnerabilities
.PHONY: vulncheck
vulncheck:
@echo 'Checking for vulnerabilities...'
govulncheck -show verbose ./...
## vendor: tidy and vendor dependencies
.PHONY: vendor
vendor:
@echo 'Tidying and verifying module dependencies...'
go mod tidy
go mod verify
@echo 'Vendoring dependencies...'
go mod vendor
## test-coverage: test code and check coverage (generates coverage.out)
.PHONY: test-coverage
test-coverage:
go test -v -race -coverprofile=coverage.out -covermode=atomic
## coverage-html: check code coverage and generate HTML report
.PHONY: coverage-html
coverage-html: test-coverage
go tool cover -html=coverage.out