forked from onosproject/onos-topo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
82 lines (60 loc) · 3.05 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
export CGO_ENABLED=1
export GO111MODULE=on
.PHONY: build
ONOS_TOPO_VERSION := latest
ONOS_PROTOC_VERSION := v0.6.3
build: # @HELP build the Go binaries and run all validations (default)
build:
CGO_ENABLED=1 go build -o build/_output/onos-topo ./cmd/onos-topo
test: # @HELP run the unit tests and source code validation producing a golang style report
test: build deps license_check linters
go test -race github.com/onosproject/onos-topo/...
jenkins-test: build-tools # @HELP run the unit tests and source code validation producing a junit style report for Jenkins
jenkins-test: build deps license_check linters
TEST_PACKAGES=github.com/onosproject/onos-topo/pkg/... ./../build-tools/build/jenkins/make-unit
coverage: # @HELP generate unit test coverage data
coverage: build deps linters license_check
./../build-tools/build/coveralls/coveralls-coverage onos-topo
deps: # @HELP ensure that the required dependencies are in place
go build -v ./...
bash -c "diff -u <(echo -n) <(git diff go.mod)"
bash -c "diff -u <(echo -n) <(git diff go.sum)"
linters: golang-ci # @HELP examines Go source code and reports coding problems
golangci-lint run --timeout 5m
build-tools: # @HELP install the ONOS build tools if needed
@if [ ! -d "../build-tools" ]; then cd .. && git clone https://github.com/onosproject/build-tools.git; fi
jenkins-tools: # @HELP installs tooling needed for Jenkins
cd .. && go get -u github.com/jstemmer/go-junit-report && go get github.com/t-yuki/gocover-cobertura
golang-ci: # @HELP install golang-ci if not present
golangci-lint --version || curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b `go env GOPATH`/bin v1.42.0
license_check: build-tools # @HELP examine and ensure license headers exist
./../build-tools/licensing/boilerplate.py -v --rootdir=${CURDIR}
onos-topo-docker: # @HELP build onos-topo base Docker image
@go mod vendor
docker build . -f build/onos-topo/Dockerfile \
-t onosproject/onos-topo:${ONOS_TOPO_VERSION}
@rm -rf vendor
images: # @HELP build all Docker images
images: build onos-topo-docker
kind: # @HELP build Docker images and add them to the currently configured kind cluster
kind: images
@if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi
kind load docker-image onosproject/onos-topo:${ONOS_TOPO_VERSION}
all: build images
publish: # @HELP publish version on github and dockerhub
./../build-tools/publish-version ${VERSION} onosproject/onos-topo
jenkins-publish: build-tools jenkins-tools # @HELP Jenkins calls this to publish artifacts
./build/bin/push-images
../build-tools/release-merge-commit
../build-tools/build/docs/push-docs
bumponosdeps: # @HELP update "onosproject" go dependencies and push patch to git.
./../build-tools/bump-onos-deps ${VERSION}
clean: # @HELP remove all the build artifacts
rm -rf ./build/_output ./vendor ./cmd/onos-topo/onos-topo ./cmd/dummy/dummy
help:
@grep -E '^.*: *# *@HELP' $(MAKEFILE_LIST) \
| sort \
| awk ' \
BEGIN {FS = ": *# *@HELP"}; \
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}; \
'