forked from openshift/assisted-installer-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (35 loc) · 1.77 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
TAG := $(or $(TAG),latest)
ASSISTED_INSTALLER_AGENT := $(or $(ASSISTED_INSTALLER_AGENT),quay.io/ocpmetal/assisted-installer-agent:$(TAG))
export ROOT_DIR = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
REPORTS = $(ROOT_DIR)/reports
GOTEST_PUBLISH_FLAGS = --junitfile-testsuite-name=relative --junitfile-testcase-classname=relative --junitfile $(REPORTS)/$(TEST_SCENARIO)_test.xml
GOTEST_FLAGS = --format=pkgname $(GOTEST_PUBLISH_FLAGS) -- -count=1 -cover -coverprofile=$(REPORTS)/$(TEST_SCENARIO)_coverage.out
DOCKER_COMPOSE=docker-compose -f ./subsystem/docker-compose.yml
export WIREMOCK_PORT = 8362
all: build
.PHONY: build clean build-image push subsystem
build: build-agent build-connectivity_check build-inventory build-free_addresses build-logs_sender build-dhcp_lease_allocate build-apivip_check
build-%: src/$*
mkdir -p build
CGO_ENABLED=0 go build -o build/$* src/$*/main/main.go
build-image: unit-test build
docker build --network=host -f Dockerfile.assisted_installer_agent . -t $(ASSISTED_INSTALLER_AGENT)
push: build-image subsystem
docker push $(ASSISTED_INSTALLER_AGENT)
_test:
gotestsum $(GOTEST_FLAGS) $(TEST) -ginkgo.focus="$(FOCUS)" -ginkgo.v -ginkgo.skip=$(SKIP)
gocov convert $(REPORTS)/$(TEST_SCENARIO)_coverage.out | gocov-xml > $(REPORTS)/$(TEST_SCENARIO)_coverage.xml
unit-test: $(REPORTS)
$(MAKE) _test TEST_SCENARIO=unit TEST="$(or $(TEST),$(TEST),$(shell go list ./... | grep -v subsystem))"
subsystem: build-image
$(DOCKER_COMPOSE) up --build -d
$(MAKE) _test TEST_SCENARIO=subsystem TEST="./subsystem/..." SKIP="system-test" || ($(DOCKER_COMPOSE) down && /bin/false)
$(DOCKER_COMPOSE) down
generate:
go generate $(shell go list ./...)
go-import:
goimports -w -l .
$(REPORTS):
-mkdir -p $(REPORTS)
clean:
rm -rf build subsystem/logs $(REPORTS)