From d219df79029ffa62098bb7855d52b2dbd63607ff Mon Sep 17 00:00:00 2001
From: Erick Hitter <git-contrib@ethitter.com>
Date: Mon, 20 Aug 2018 21:23:43 -0700
Subject: [PATCH] Go back to 7d6083d and drop any dependency installation in
 code quality test

The dependencies will never succeed.
---
 .gitlab-ci.yml | 22 +++++++++-------------
 Makefile       | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 13 deletions(-)
 create mode 100644 Makefile

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 49f794e..c033ceb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -23,49 +23,44 @@ before_script:
 
   - export CC=clang-5.0
 
-  - go get -v -d ./...
-
-  - export PROJECT_NAME="gitlab-runner-do-monitor"
-  - export PKG="git.ethitter.com/debian/${PROJECT_NAME}"
-  - export PKG_LIST=$(go list ${PKG}/... | grep -v /vendor/)
+  - make dep
 
 unit_tests:
   stage: test
   script:
-    - go test -v ${PKG_LIST}
+    - make test
 
 race_detector:
   stage: test
   script:
-    - go test -v -race ${PKG_LIST}
+    - make race
 
 memory_sanitizer:
   stage: test
   script:
-    - go test -v -msan ${PKG_LIST}
+    - make msan
 
 code_coverage:
   stage: test
   script:
-    - ./tools/coverage.sh
+    - make coverage
 
 code_coverage_report:
   stage: test
   script:
-    - ./tools/coverage.sh html
+    - make coverhtml
   only:
   - master
 
 lint_code:
   stage: test
   script:
-    - golint -set_exit_status ${PKG_LIST}
+    - make lint
 
 build:
   stage: build
   script:
-    - go get github.com/mitchellh/gox
-    - gox -output="${CI_PROJECT_DIR}/${PROJECT_NAME}/{{.Dir}}_{{.OS}}_{{.Arch}}" -parallel=6
+    - make
   artifacts:
     paths:
       - gitlab-runner-do-monitor/
@@ -78,6 +73,7 @@ code_quality:
   allow_failure: true
   services:
     - docker:stable-dind
+  before_script:
   script:
     - export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
     - docker run
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f3d51f5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+PROJECT_NAME := "gitlab-runner-do-monitor"
+PKG := "git.ethitter.com/debian/$(PROJECT_NAME)"
+PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
+GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
+
+.PHONY: all dep build clean test coverage coverhtml lint
+
+all: build
+
+lint:
+	@golint -set_exit_status ${PKG_LIST}
+
+test:
+	@go test -v ${PKG_LIST}
+
+race: dep
+	@go test -v -race ${PKG_LIST}
+
+msan: dep
+	@go test -v -msan ${PKG_LIST}
+
+coverage:
+	./tools/coverage.sh;
+
+coverhtml:
+	./tools/coverage.sh html;
+
+dep:
+	@go get -v -d ./...
+	@go get github.com/mitchellh/gox
+
+build: dep
+	@gox -output="${CI_PROJECT_DIR}/${PROJECT_NAME}/{{.Dir}}_{{.OS}}_{{.Arch}}" -parallel=6
+
+clean:
+	@rm -f $(PROJECT_NAME)
+
+help:
+	@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
-- 
GitLab