-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (31 loc) · 1.06 KB
/
Copy pathMakefile
File metadata and controls
42 lines (31 loc) · 1.06 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
.PHONY: all test lint cover bench fuzz smoke check build demo
GO ?= go
LINTERS := gocritic,gocognit,gocyclo,maintidx,dupl,mnd,unparam,ireturn,goconst,errcheck
# ssh.Serve, receive.ReceivePack and the hooks rejection path are covered by
# the testscript suite against the built binary, not by per-package tests.
COVER_MIN := 75
all: check
build:
$(GO) build -o silo ./cmd/silo
test:
$(GO) test -race -shuffle=on ./...
cover:
$(GO) test -coverprofile=cover.out ./internal/...
$(GO) tool cover -func=cover.out | tail -1
@pct=$$($(GO) tool cover -func=cover.out | tail -1 | grep -o '[0-9.]*' | tail -1); \
awk -v p=$$pct -v m=$(COVER_MIN) 'BEGIN{exit (p<m)}' || \
(echo "coverage $$pct% < $(COVER_MIN)%" && exit 1)
lint:
golangci-lint run ./...
govulncheck ./...
deadcode -test ./...
gosec -quiet ./...
bench:
$(GO) test -bench . -benchmem -run '^$$' ./internal/... | tee bench.txt
fuzz:
$(GO) test -fuzz=FuzzCommandList -fuzztime=60s ./internal/receive
smoke:
$(GO) test -run TestScript -count=3 ./...
check: test cover lint
demo:
./scripts/demo.sh