-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
79 lines (61 loc) · 2.42 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
67
68
69
70
71
72
73
74
75
76
77
78
79
PKG = github.com/k1LoW/runn
COMMIT = $$(git describe --tags --always)
OSNAME=${shell uname -s}
ifeq ($(OSNAME),Darwin)
DATE = $$(gdate --utc '+%Y-%m-%d_%H:%M:%S')
else
DATE = $$(date --utc '+%Y-%m-%d_%H:%M:%S')
endif
export GO111MODULE=on
BUILD_LDFLAGS = -X $(PKG).commit=$(COMMIT) -X $(PKG).date=$(DATE)
default: test
ci: depsdev test-all
test: cert
go test ./... -coverprofile=coverage.out -covermode=count
race:
go test ./... -race
test-integration: cert
chmod 600 testdata/sshd/id_rsa
go test ./... -tags=integration -count=1
test-all: cert
chmod 600 testdata/sshd/id_rsa
go test ./... -tags=integration -coverprofile=coverage.out -covermode=count
benchmark: cert
go test -bench . -benchmem -run Benchmark | octocov-go-test-bench --tee > custom_metrics_benchmark.json
lint:
golangci-lint run ./...
govulncheck ./...
go vet -vettool=`which gostyle` -gostyle.config=$(PWD)/.gostyle.yml ./...
doc:
go run ./scripts/fndoc.go
build:
go build -ldflags="$(BUILD_LDFLAGS)" -o runn cmd/runn/main.go
depsdev:
go install github.com/Songmu/ghch/cmd/ghch@latest
go install github.com/Songmu/gocredits/cmd/gocredits@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/k1LoW/octocov-go-test-bench/cmd/octocov-go-test-bench@latest
go install github.com/k1LoW/gostyle@latest
cert:
rm -f testdata/*.pem testdata/*.srl
openssl req -x509 -newkey rsa:4096 -days 365 -nodes -sha256 -keyout testdata/cakey.pem -out testdata/cacert.pem -subj "/C=UK/ST=Test State/L=Test Location/O=Test Org/OU=Test Unit/CN=*.example.com/[email protected]"
openssl req -newkey rsa:4096 -nodes -keyout testdata/key.pem -out testdata/csr.pem -subj "/C=JP/ST=Test State/L=Test Location/O=Test Org/OU=Test Unit/CN=*.example.com/[email protected]"
openssl x509 -req -sha256 -in testdata/csr.pem -days 60 -CA testdata/cacert.pem -CAkey testdata/cakey.pem -CAcreateserial -out testdata/cert.pem -extfile testdata/openssl.cnf
openssl verify -CAfile testdata/cacert.pem testdata/cert.pem
prerelease:
git pull origin main --tag
go mod tidy
ghch -w -N ${VER}
gocredits -skip-missing -w .
cat _EXTRA_CREDITS >> CREDITS
git add CHANGELOG.md CREDITS go.mod go.sum
git commit -m'Bump up version number'
git tag ${VER}
prerelease_for_tagpr:
gocredits -skip-missing -w .
cat _EXTRA_CREDITS >> CREDITS
git add CHANGELOG.md CREDITS go.mod go.sum
release:
git push origin main --tag
goreleaser --clean
.PHONY: default test