forked from Venafi/vcert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (78 loc) · 3.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
GOFLAGS ?= $(GOFLAGS:)
VERSION=`git describe --abbrev=0 --tags`
ifdef BUILD_NUMBER
VERSION:=$(VERSION)+$(BUILD_NUMBER)
endif
ifdef RELEASE_VERSION
ifneq ($(RELEASE_VERSION),none)
VERSION=$(RELEASE_VERSION)
endif
endif
GO_LDFLAGS=-ldflags "-X github.com/Venafi/vcert/v4.versionString=$(VERSION) -X github.com/Venafi/vcert/v4.versionBuildTimeStamp=`date -u +%Y%m%d.%H%M%S` -s -w"
version:
echo "$(VERSION)"
get: gofmt
go get $(GOFLAGS) ./...
build_quick: get
env GOOS=linux GOARCH=amd64 go build $(GO_LDFLAGS) -o bin/linux/vcert ./cmd/vcert
build: get
env GOOS=linux GOARCH=amd64 go build $(GO_LDFLAGS) -o bin/linux/vcert ./cmd/vcert
env GOOS=linux GOARCH=386 go build $(GO_LDFLAGS) -o bin/linux/vcert86 ./cmd/vcert
env GOOS=darwin GOARCH=amd64 go build $(GO_LDFLAGS) -o bin/darwin/vcert ./cmd/vcert
env GOOS=darwin GOARCH=arm64 go build $(GO_LDFLAGS) -o bin/darwin/vcert_arm ./cmd/vcert
env GOOS=windows GOARCH=amd64 go build $(GO_LDFLAGS) -o bin/windows/vcert.exe ./cmd/vcert
env GOOS=windows GOARCH=386 go build $(GO_LDFLAGS) -o bin/windows/vcert86.exe ./cmd/vcert
cucumber:
rm -rf ./aruba/bin/
mkdir -p ./aruba/bin/ && cp ./bin/linux/vcert ./aruba/bin/vcert
docker build --tag vcert.auto aruba/
if [ -z "$(FEATURE)" ]; then \
cd aruba && ./cucumber.sh; \
else \
cd aruba && ./cucumber.sh $(FEATURE); \
fi
gofmt:
! gofmt -l . | grep -v ^vendor/ | grep .
test: get linter
go test -v -coverprofile=cov1.out .
go tool cover -func=cov1.out
go test -v -coverprofile=cov2.out ./pkg/certificate
go tool cover -func=cov2.out
go test -v -coverprofile=cov3.out ./pkg/endpoint
go tool cover -func=cov3.out
go test -v -coverprofile=cov4.out ./pkg/venafi/fake
go tool cover -func=cov4.out
go test -v -coverprofile=cov5.out ./pkg/policy
go tool cover -func=cov5.out
go test -v -coverprofile=cov6.out ./pkg/util
go tool cover -func=cov6.out
go test -v -coverprofile=cov_cmd.out ./cmd/vcert
go tool cover -func=cov_cmd.out
tpp_test: get
go test -v $(GOFLAGS) -coverprofile=cov_tpp.out ./pkg/venafi/tpp
go tool cover -func=cov_tpp.out
cloud_test: get
go test -v $(GOFLAGS) -coverprofile=cov_vaas.out ./pkg/venafi/cloud
go tool cover -func=cov_vaas.out
cmd_test: get
go test -v $(GOFLAGS) -coverprofile=cov_cmd.out ./cmd/vcert
go tool cover -func=cov_cmd.out
collect_artifacts:
rm -rf artifacts
mkdir -p artifacts
# we are assuming that signature are in the path were the make file was executed (not necessarily should be in the root of project)
zip -j "artifacts/vcert_$(VERSION)_linux.zip" "bin/linux/vcert" "vcert_linux.sig" || exit 1
zip -j "artifacts/vcert_$(VERSION)_linux86.zip" "bin/linux/vcert86" "vcert_linux86.sig" || exit 1
zip -j "artifacts/vcert_$(VERSION)_darwin.zip" "bin/darwin/vcert" "vcert_darwin.sig" || exit 1
zip -j "artifacts/vcert_$(VERSION)_darwin_arm.zip" "bin/darwin/vcert_arm" "vcert_darwin_arm.sig" || exit 1
zip -j "artifacts/vcert_$(VERSION)_windows.zip" "bin/windows/vcert.exe" || exit 1
zip -j "artifacts/vcert_$(VERSION)_windows86.zip" "bin/windows/vcert86.exe" || exit 1
release:
echo '```' > release.txt
cd artifacts; sha1sum * >> ../release.txt
echo '```' >> release.txt
go get -u github.com/tcnksm/ghr
ghr -prerelease -n $$RELEASE_VERSION -body="$$(cat ./release.txt)" $$RELEASE_VERSION artifacts/
linter:
@golangci-lint --version || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /go/bin
golangci-lint run