forked from wenyingd/ofnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·60 lines (50 loc) · 1.82 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
SHELL := /bin/bash
# go options
GO ?= go
GOPATH ?= $$($(GO) env GOPATH)
DOCKER_CACHE := $(CURDIR)/.cache
OVS_VERSION := $(shell head -n 1 build/images/deps/ovs-version)
GO_VERSION := $(shell head -n 1 build/images/deps/go-version)
USERID := $(shell id -u)
GRPID := $(shell id -g)
DOCKER_BUILD_ARGS = --build-arg OVS_VERSION=$(OVS_VERSION)
DOCKER_BUILD_ARGS += --build-arg GO_VERSION=$(GO_VERSION)
all: test
.PHONY: test
test: docker-test-integration
# code linting
.golangci-bin:
@echo "===> Installing Golangci-lint <==="
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $@ v1.41.1
.PHONY: golangci
golangci: .golangci-bin
@echo "===> Running golangci <==="
@GOOS=linux .golangci-bin/golangci-lint run -c .golangci.yml
.PHONY: golangci-fix
golangci-fix: .golangci-bin
@echo "===> Running golangci-fix <==="
@GOOS=linux .golangci-bin/golangci-lint run -c .golangci.yml --fix
.PHONY: test-integration
test-integration:
@echo
@echo "==> Running integration tests <=="
@echo "SOME TESTS WILL FAIL IF NOT RUN AS ROOT!"
$(GO) test antrea.io/ofnet/ofctrl/...
.PHONY: docker-test-integration
docker-test-integration:
@echo "===> Building Ofnet Test Docker image <==="
ifneq ($(NO_PULL),)
docker build -t ofnet/test -f build/images/test/Dockerfile $(DOCKER_BUILD_ARGS) .
else
docker build --pull -t ofnet/test -f build/images/test/Dockerfile $(DOCKER_BUILD_ARGS) .
endif
@docker run --privileged --rm \
-e "GOCACHE=/tmp/gocache" \
-e "GOPATH=/tmp/gopath" \
-e "INCONTAINER=true" \
-w /usr/src/antrea.io/ofnet \
-v $(DOCKER_CACHE)/gopath:/tmp/gopath \
-v $(DOCKER_CACHE)/gocache:/tmp/gocache \
-v $(CURDIR):/usr/src/antrea.io/ofnet:ro \
-v /lib/modules:/lib/modules \
ofnet/test test-integration $(USERID) $(GRPID)