forked from onosproject/onos-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (50 loc) · 2.3 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
# SPDX-FileCopyrightText: 2019-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: Apache-2.0
export CGO_ENABLED=1
export GO111MODULE=on
.PHONY: build docs
ONOS_CLI_VERSION := latest
build: # @HELP build the Go binaries and run all validations (default)
build:
go build -o build/_output/onos ./cmd/onos
go build -o build/_output/onos-cli-docs-gen ./cmd/onos-cli-docs-gen
go build -o build/_output/gnmi_cli ./cmd/gnmi_cli
build-tools:=$(shell if [ ! -d "./build/build-tools" ]; then cd build && git clone https://github.com/onosproject/build-tools.git; fi)
include ./build/build-tools/make/onf-common.mk
mod-update: # @HELP Download the dependencies to the vendor folder
go mod tidy
go mod vendor
mod-lint: mod-update # @HELP ensure that the required dependencies are in place
# dependencies are vendored, but not committed, go.sum is the only thing we need to check
bash -c "diff -u <(echo -n) <(git diff go.sum)"
test: # @HELP run the unit tests and source code validation
test: mod-lint build linters license
go test github.com/onosproject/onos-cli/pkg/...
go test github.com/onosproject/onos-cli/cmd/...
docs: # @HELP generate CLI docs
docs:
go run cmd/onos-cli-docs-gen/main.go
jenkins-test: # @HELP run the unit tests and source code validation producing a junit style report for Jenkins
jenkins-test: mod-lint build linters license
TEST_PACKAGES=github.com/onosproject/onos-cli/... ./build/build-tools/build/jenkins/make-unit
onos-cli-docker: # @HELP build onos CLI Docker image
onos-cli-docker:
@go mod vendor
docker build . -f build/onos/Dockerfile \
-t onosproject/onos-cli:${ONOS_CLI_VERSION}
@rm -rf vendor
images: # @HELP build all Docker images
images: build onos-cli-docker
kind: images
@if [ "`kind get clusters`" = '' ]; then echo "no kind cluster found" && exit 1; fi
kind load docker-image onosproject/onos-cli:${ONOS_CLI_VERSION}
all: build images
publish: # @HELP publish version on github and dockerhub
./build/build-tools/publish-version ${VERSION} onosproject/onos-cli
jenkins-publish: # @HELP Jenkins calls this to publish artifacts
./build/bin/push-images
./build/build-tools/release-merge-commit
./build/build-tools/build/docs/push-docs
clean:: # @HELP remove all the build artifacts
rm -rf ./build/_output ./vendor ./cmd/onos/onos ./cmd/dummy/dummy