From 7c97f6a4904d5f6f21f66a6be930fade18a3c8c3 Mon Sep 17 00:00:00 2001
From: yoavrotems <yoavrotems97@gmail.com>
Date: Tue, 16 Jul 2019 18:11:51 +0000
Subject: [PATCH] Add codecov (#336)

* Update .gitignore

* Update .travis.yml

* Update makefile

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update README.md

* Update README.md

* Update README.md

* Update makefile

* Update .travis.yml
---
 .gitignore  |  3 ++-
 .travis.yml | 15 +++++++++++++--
 README.md   |  3 +++
 makefile    |  2 +-
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1ce4a32..2814cfc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,5 +4,6 @@ vendor
 dist
 .vscode/
 hack/kind.test.yaml
+coverage.txt
 
-.idea/
\ No newline at end of file
+.idea/
diff --git a/.travis.yml b/.travis.yml
index 05d1522..4a52af8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,7 @@ before_install:
   - sudo apt-get -qq update
   - sudo apt-get install -y rpm
   - gem install --no-ri --no-rdoc fpm
+  - go get -t -v ./...
 
 script:
   - GO111MODULE=on go test ./...
@@ -20,10 +21,20 @@ script:
   - docker run -v `pwd`:/host kube-bench install 
   - test -d cfg
   - test -f kube-bench
-
+  - make tests
+  
 after_success:
-  - test -n "$TRAVIS_TAG" && curl -sL https://git.io/goreleaser | bash
+  - bash <(curl -s https://codecov.io/bash)
+deploy:
+  - provider: script
+    skip_cleanup: true
+    script: curl -sL https://git.io/goreleaser | bash
+    on:
+      tags: true
+      condition: "$TRAVIS_OS_NAME = linux"
 
 env:
   global:
     secure: mb8AYZKDo6hkKN+2F9ldXcw27Yn2AfxpXvKlD8GD7NdGOI+TaiSFbE0I+qqTa/1DqcRekCQwqN7OG/17s9JDkgzUXYuYUGlVUOM4WbeJoSlzJFIOh9r9R/JddluYJohypgkE20IBHIrEHq5sY0Nn1Pl9WgSQFaVcQjxkX009AOuVjN0o5HcoXsb5hAzvHrpoSPkcSSqq7VWab60TgUttVaRlZSGwGdSYQEqk5TdO0hWHuXyxaaEPybgFIyZLLbxPS4JmMz8n3Sngetpw9Jgc+V9Fc7wKXpjvZZ33SpArG5p5ZFFu2YQOXFLZth9qtQOjduQ2gU1kHN6WjWnJ8QX2s8vmU38Tk19kd5i+mz9dvc87IdBvmTIqVYSpM6AAYa2osBGP3f97Rj2S68lTad4ecSVyHdsjz56vdE3ZH4wskswmogbKkVdvO4biPHxT6odszBxYLEJuRJyZ7ckXd52MCzqAUPrw7YUuH8N1mLIlf7V5bW5R+q4DlKw774zxnHiWrymXGvlINSrB0qxBn8Fii6ib+Pacl3PuqSumCcgIHlVjqrzIXaqcTMn2/ABZYC99mralGvwA/EgNa8CBKB5evMCEwWa5Ntvcs2I2DFcO5Q2WzN4H0YScyAzzCzK7/3hWJE/rUIJntwiSXkV3MSa1yxWSGGH8F1lcz+lzgTBm/MU=
+  matrix:
+    - GO111MODULE=on
diff --git a/README.md b/README.md
index 448a57f..6a4366d 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,10 @@
 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
 [![Docker image](https://images.microbadger.com/badges/image/aquasec/kube-bench.svg)](https://microbadger.com/images/aquasec/kube-bench "Get your own image badge on microbadger.com")
 [![Source commit](https://images.microbadger.com/badges/commit/aquasec/kube-bench.svg)](https://microbadger.com/images/aquasec/kube-bench)
+[![Coverage Status][cov-img]][cov]
 
+[cov-img]: https://codecov.io/github/aquasecurity/kube-bench/branch/master/graph/badge.svg
+[cov]: https://codecov.io/github/aquasecurity/kube-bench
 <img src="images/kube-bench.png" width="200" alt="kube-bench logo">
 
 kube-bench is a Go application that checks whether Kubernetes is deployed securely by running the checks documented in the [CIS Kubernetes Benchmark](https://www.cisecurity.org/benchmark/kubernetes/). 
diff --git a/makefile b/makefile
index 0b0bfaa..511a0ff 100644
--- a/makefile
+++ b/makefile
@@ -32,7 +32,7 @@ build-docker:
              -t $(IMAGE_NAME) .
 
 tests:
-	go test -race -timeout 30s -cover ./cmd ./check
+	GO111MODULE=on go test -v -short -race -timeout 30s -coverprofile=coverage.txt -covermode=atomic ./...
 
 # creates a kind cluster to be used for development.
 HAS_KIND := $(shell command -v kind;)
-- 
GitLab