@@ -10,21 +10,33 @@ MAKEFLAGS += --no-builtin-rules
1010OPENRUN_HOME := ` pwd `
1111INPUT := $(word 2,$(MAKECMDGOALS ) )
1212
13+ ARCH := $(shell uname -m)
14+ TARGET_DIR := dist/linux/$(ARCH )
15+ BINARY := openrun
16+ IMAGE_TAG := openrun:latest
17+
1318.DEFAULT_GOAL := help
1419ifeq ($(origin .RECIPEPREFIX ) , undefined)
1520 $(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
1621endif
1722.RECIPEPREFIX = >
1823TAG :=
1924
20- .PHONY : help test unit int covtest covunit covint release int_single lint verify
25+ .PHONY : help test unit int covtest covunit covint release int_single lint verify build-linux image
2126
2227help : # # Display this help section
2328> @awk 'BEGIN {FS = " :.* ?# # "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m%-38s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
2429
2530test : unit int # # Run all tests
2631verify : lint test # # Run lint and all tests
2732
33+ build-linux : # # Build linux binary into dist/
34+ > mkdir -p $(TARGET_DIR)
35+ > CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -o $(TARGET_DIR)/$(BINARY) ./cmd/openrun
36+
37+ image : build-linux # # Build docker image
38+ > docker build -f deploy/Dockerfile -t $(IMAGE_TAG) dist
39+
2840covtest : covunit covint # # Run all tests with coverage
2941> go tool covdata percent -i=$(OPENRUN_HOME)/coverage/client,$(OPENRUN_HOME)/coverage/unit,$(OPENRUN_HOME)/coverage/int
3042> go tool covdata textfmt -i=$(OPENRUN_HOME)/coverage/client,$(OPENRUN_HOME)/coverage/unit,$(OPENRUN_HOME)/coverage/int -o $(OPENRUN_HOME)/coverage.txt
0 commit comments