From f5c03bcb4f7fce3d24cee8cda77306419b1b8e9f Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 25 Jan 2018 10:52:15 +0100 Subject: [PATCH 1/5] Upload test coverage to codeclimate --- .gitignore | 15 +++++++++++---- .travis.yml | 14 +++++++++++++- Taskfile.yml | 5 +++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index e0170a5..ea58090 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ -/dep -/testdep -/profile.out -/coverage.txt +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out diff --git a/.travis.yml b/.travis.yml index 1456363..a63efa5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,22 @@ go: - 1.9 - tip +env: + global: + - CC_TEST_REPORTER_ID=68feaa3410049ce73e145287acbcdacc525087a30627f96f04e579e75bd71c00 + +before_script: + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - ./cc-test-reporter before-build + install: - go get github.com/go-task/task/cmd/task script: - task dl-deps - task lint -- task test +- task test-coverage + +after_script: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/Taskfile.yml b/Taskfile.yml index 0e4f1cf..8f32104 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -25,3 +25,8 @@ test: desc: Runs go tests cmds: - go test -race . + +test-coverage: + desc: Runs go tests and calucates test coverage + cmds: + - go test -race -coverprofile=coverage.out -covermode=atomic ./... From a569a888dc53c43f935ba9f91122f21baad71405 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 25 Jan 2018 10:59:33 +0100 Subject: [PATCH 2/5] Fix Taskfile for go 1.8 --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 8f32104..cbf18b9 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -29,4 +29,4 @@ test: test-coverage: desc: Runs go tests and calucates test coverage cmds: - - go test -race -coverprofile=coverage.out -covermode=atomic ./... + - go test -race -coverprofile=coverage.out -covermode=atomic . From 2355fc53b3b986bebc441df9e2b49a12ff723033 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 25 Jan 2018 11:07:21 +0100 Subject: [PATCH 3/5] Install go gocov --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index a63efa5..6b2834d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ before_script: - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build + - go get github.com/axw/gocov/gocov install: - go get github.com/go-task/task/cmd/task @@ -22,4 +23,5 @@ script: - task test-coverage after_script: + - ./cc-test-reporter format-coverage --input-type gocov coverage.out - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT From 9838ce328908afc40f34e43872d6fc8a71abc2db Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 25 Jan 2018 11:56:17 +0100 Subject: [PATCH 4/5] Add codeclimate config --- .codeclimate.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..94c3524 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,10 @@ +engines: + gofmt: + enabled: true + golint: + enabled: true + checks: + GoLint/Comments/PackageComments: + enabled: false + govet: + enabled: true From ea8dbebbee215b98d9196c46dc872dcfc58c47b5 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 25 Jan 2018 12:32:10 +0100 Subject: [PATCH 5/5] Fix coverage --- .travis.yml | 2 -- Taskfile.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b2834d..a63efa5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ before_script: - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build - - go get github.com/axw/gocov/gocov install: - go get github.com/go-task/task/cmd/task @@ -23,5 +22,4 @@ script: - task test-coverage after_script: - - ./cc-test-reporter format-coverage --input-type gocov coverage.out - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/Taskfile.yml b/Taskfile.yml index cbf18b9..f803564 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -29,4 +29,4 @@ test: test-coverage: desc: Runs go tests and calucates test coverage cmds: - - go test -race -coverprofile=coverage.out -covermode=atomic . + - go test -coverprofile=c.out .