Adds unit tests and K8s artifacts
[icn.git] / cmd / bpa-restapi-agent / Makefile
index ba40a6f..6b41947 100644 (file)
@@ -1,24 +1,22 @@
+.PHONY: build
 
-# The name of the executable (default is current directory name)
-TARGET := $(shell echo $${PWD\#\#*/})
-.DEFAULT_GOAL: $(TARGET)
+build: untar
+       go build -mod=vendor -o build/_output/bin/bpa-restapi-agent main.go
 
-# These will be provided to the target
-VERSION := 1.0.0
-BUILD := `git rev-parse HEAD`
+docker:        
+       docker build -t akraino.org/icn/bpa-restapi-agent:latest . -f build/Dockerfile
 
-# Use linker flags to provide version/build settings to the target
-LDFLAGS=-ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD)"
+untar:
+       tar -xzvf vendor.tar.gz
 
-# go source files, ignore vendor directory
-SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
+deploy: docker
+       ./bpa_api_install.sh
 
-.PHONY: all build
+test:  go_install
+       go test ./... -v
 
-all: build
+go_install:
+       install_go.sh
 
-$(TARGET): $(SRC)
-       @go build $(LDFLAGS) -o $(TARGET)
-
-build: $(TARGET)
-       @true
+e2e_test: deploy
+       ./e2e_test.sh