From 72981365c9a60397757038623bf543f6d4f910e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Abdelkader=20Mart=C3=ADnez=20P=C3=A9rez?= Date: Wed, 4 Sep 2019 16:14:44 +0200 Subject: [PATCH] Minor changes parametrizing the Makefile and CircleCI config. --- .circleci/config.yml | 31 +++++++++++++++++++++++++++++++ .gitignore | 4 +++- Makefile | 35 +++++++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..a47b49c --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,31 @@ +# Golang CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-go/ for more details +version: 2 +jobs: + build: + docker: + - image: circleci/golang:1.9 + steps: + - checkout + - run: make + - persist_to_workspace: + paths: + - build + - output + spec_check: + docker: + - image: bbvalabsci/kapow-spec-test-suite:latest + steps: + - attach_workspace: + at: /tmp/workspace + - run: install /tmp/workspace/build/kapow /usr/bin + - run: behave +workflows: + version: 2 + build_and_test: + jobs: + - build + - spec_check + requires: + - build diff --git a/.gitignore b/.gitignore index 8fa3fbe..79d29df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ __pycache__ -coverage.html + +output +build diff --git a/Makefile b/Makefile index e6c08a3..0a0800c 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,35 @@ -.PHONY: test install acceptance deps +.PHONY: build test coverage install acceptance deps -all: acceptance +GOCMD=go +GOBUILD=$(GOCMD) build +GOGET=$(GOCMD) get +GOTEST=$(GOCMD) test +GOTOOL=$(GOCMD) tool -test: deps - go test -race -coverprofile=/tmp/c.out github.com/BBVA/kapow/pkg/... - go tool cover -html=/tmp/c.out -o coverage.html +BUILD_DIR=./build +OUTPUT_DIR=./output +TMP_DIR=/tmp -install: test - go install github.com/BBVA/kapow/... +BINARY_NAME=kapow + +all: test build + +build: deps + mkdir -p $(BUILD_DIR) + $(GOBUILD) -o $(BUILD_DIR)/$(BINARY_NAME) -v + +test: build + $(GOTEST) -race -coverprofile=$(TMP_DIR)/c.out ./... + +coverage: test + mkdir -p $(OUTPUT_DIR) + $(GOTOOL) cover -html=$(TMP_DIR)/c.out -o $(OUTPUT_DIR)/coverage.html + +install: build + go install ./... acceptance: install - make -C spec/test + make -C ./spec/test deps: @echo "deps here"