build: optionally build integration tests binary

This commit is contained in:
Bassam Tabbara
2017-07-17 17:35:25 -07:00
parent 9d83b56490
commit 2cdfdab3db
2 changed files with 10 additions and 3 deletions
+4 -1
View File
@@ -90,7 +90,10 @@ build.common:
@$(MAKE) go.validate
do.build.platform.%:
@$(MAKE) GOOS=$(word 1, $(subst _, ,$*)) GOARCH=$(word 2, $(subst _, ,$*)) go.build
@$(MAKE) PLATFORM=$* go.build
ifeq ($(BUILD_INTEGRATION_TESTS),1)
@$(MAKE) PLATFORM=$* go.build.integration.test
endif
do.build.parallel: $(foreach p,$(PLATFORMS), do.build.platform.$(p))
+6 -2
View File
@@ -122,7 +122,6 @@ go.install.packages.$(1):
@$(3) $(GO) install -v $(4) $(2)
go.install.packages: go.install.packages.$(1)
endef
$(foreach p,$(GO_STATIC_PACKAGES),$(eval $(call go.project,$(lastword $(subst /, ,$(p))),$(p),CGO_ENABLED=0,$(GO_STATIC_FLAGS))))
.PHONY: go.build
@@ -133,7 +132,7 @@ go.build:
go.install:
@$(MAKE) go.install.packages
.PHONY:
.PHONY: go.test.unit
go.test.unit: $(GOJUNIT)
@echo === go test unit-tests
@mkdir -p $(GO_TEST_OUTPUT)
@@ -141,6 +140,11 @@ go.test.unit: $(GOJUNIT)
@CGO_ENABLED=0 $(GOHOST) test -v -cover $(GO_TEST_FLAGS) $(GO_STATIC_FLAGS) $(GO_PACKAGES) 2>&1 | tee $(GO_TEST_OUTPUT)/unit-tests.log
@cat $(GO_TEST_OUTPUT)/unit-tests.log | $(GOJUNIT) -set-exit-code > $(GO_TEST_OUTPUT)/unit-tests.xml
.PHONY: go.build.integration.test
go.build.integration.test:
@echo === go build integration test packages $(PLATFORM)
@CGO_ENABLED=0 $(GOHOST) test -v -i $(GO_STATIC_FLAGS) -c -o $(GO_OUT_DIR)/test.integration $(GO_INTEGRATION_TEST_PACKAGES)
.PHONY:
go.test.integration: $(GOJUNIT)
@echo === go test integration-tests