forked from onosproject/onos-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (51 loc) · 2.44 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
# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
#
# SPDX-License-Identifier: Apache-2.0
.PHONY: build
ONOS_PROTOC_VERSION := v1.3.0
BUF_VERSION := 1.8.0
all: protos golang
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)"
golang: # @HELP compile Golang sources
cd go && go build ./...
test: # @HELP run the unit tests and source code validation
test: protos golang linters-go deps-go license
cd go && go test -race github.com/onosproject/onos-api/go/...
jenkins-test: # @HELP run the unit tests and source code validation producing a junit style report for Jenkins
jenkins-test: jenkins-tools test
export TEST_PACKAGES=github.com/onosproject/onos-api/go/... && cd go && ../build/build-tools/build/jenkins/make-unit
mv go/*.xml .
deps-go: # @HELP ensure that the required dependencies are in place
cd go && go build -v ./...
bash -c "diff -u <(echo -n) <(git diff go/go.mod)"
bash -c "diff -u <(echo -n) <(git diff go/go.sum)"
linters-go: golang-ci # @HELP examines Go source code and reports coding problems
cd go && golangci-lint run --timeout 15m
buflint: #@HELP run the "buf check lint" command on the proto files in 'api'
docker run -v `pwd`:/go/src/github.com/onosproject/onos-api \
-w /go/src/github.com/onosproject/onos-api \
bufbuild/buf:${BUF_VERSION} check lint
protos: # @HELP compile the protobuf files (using protoc-go Docker)
protos:
docker run \
-v `pwd`:/onos-api \
-w /onos-api \
--entrypoint build/bin/compile-protos.sh \
onosproject/protoc-go:${ONOS_PROTOC_VERSION}
mocks:
./build/bin/generate-mocks.sh
publish: twine # @HELP publish version on github, dockerhub, abd PyPI
BASEDIR=. PYPI_INDEX=pypi ./build/build-tools/publish-python-version
./build/build-tools/publish-version ${VERSION}
./build/build-tools/publish-version go/${VERSION}
jenkins-publish: jenkins-tools # @HELP Jenkins calls this to publish artifacts
./build/build-tools/release-merge-commit
clean:: # @HELP remove all the build artifacts
rm -rf ./build/_output ./vendor