-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
72 lines (54 loc) · 1.75 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
# There are four main groups of operations provided by this Makefile: build,
# clean, run and tasks.
# Build operations will create artefacts from code. This includes things such as
# binaries, mock files, or catalogs of CNF tests.
# Clean operations remove the results of the build tasks, or other files not
# considered permanent.
# Run operations provide shortcuts to execute built binaries in common
# configurations or with default options. They are part convenience and part
# documentation.
# Tasks provide shortcuts to common operations that occur frequently during
# development. This includes running configured linters and executing unit tests
GO_PATH=$(shell go env GOPATH)
GO_PACKAGES=$(shell go list ./... | grep -v vendor)
.PHONY: build \
clean \
lint \
test \
build-oct \
vet
OCT_TOOL_NAME=oct
GOLANGCI_VERSION=v1.63.3
# Run the unit tests and build all binaries
build:
make lint
make test
make build-oct
build-oct:
go build -o oct -v cmd/tnf/main.go
build-oct-debug:
go build -gcflags "all=-N -l" -extldflags '-z relro -z now' ./${OCT_TOOL_NAME}
# Cleans up auto-generated and report files
clean:
go clean
rm -f ./${OCT_TOOL_NAME}
rm -f cover.out
test:
UNIT_TEST="true" go test -coverprofile=cover.out ./...
# Run configured linters
lint:
golangci-lint run --timeout 5m0s
coverage-html: test
cat cover.out.tmp | grep -v "_moq.go" > cover.out
go tool cover -html cover.out
update-certified-catalog:
./oct fetch --operator --container --helm
# Update source dependencies and fix versions
update-deps:
go mod tidy && \
go mod vendor
# Install golangci-lint
install-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${GO_PATH}/bin ${GOLANGCI_VERSION}
vet:
go vet ${GO_PACKAGES}