summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2020-06-08 11:38:10 +0000
committerNick Thomas <nick@gitlab.com>2020-06-08 11:38:10 +0000
commit86e99068e0679755f5ecfa26d463addc2b4c1648 (patch)
tree3d311b3d41d3b22e7a493957619e379280ca0ecf
parentc71bba487033db1f259e0ad8c40a32ee4ad0124e (diff)
parent7703f3507623172726df1a41254d70b182e3fcd3 (diff)
downloadgitlab-shell-86e99068e0679755f5ecfa26d463addc2b4c1648.tar.gz
Merge branch 'go-coverage' into 'master'
Extract coverage for Go code on CI pipeline See merge request gitlab-org/gitlab-shell!392
-rw-r--r--.gitignore1
-rw-r--r--.gitlab-ci.yml3
-rw-r--r--Makefile9
-rw-r--r--README.md4
4 files changed, 13 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 1497964..c454751 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
config.yml
+cover.out
tmp/*
.idea
*.log
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0e291cd..f0186f0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -57,6 +57,9 @@ go:1.13:
go:1.14:
extends: .test
image: golang:1.14
+ after_script:
+ - make coverage
+ coverage: '/\d+.\d+%/'
race:
extends: .test
diff --git a/Makefile b/Makefile
index 5c2a8f1..5cffe76 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang setup _install build compile check clean
+.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang coverage coverage_golang setup _install build compile check clean
GO_SOURCES := $(shell find . -name '*.go')
@@ -19,11 +19,16 @@ test_ruby:
bundle exec rspec --color --format d spec
test_golang:
- go test ./...
+ go test -cover -coverprofile=cover.out ./...
test_golang_race:
go test -race ./...
+coverage: coverage_golang
+
+coverage_golang:
+ [ -f cover.out ] && go tool cover -func cover.out
+
setup: _install bin/gitlab-shell
_install:
diff --git a/README.md b/README.md
index 05c3560..531a074 100644
--- a/README.md
+++ b/README.md
@@ -39,8 +39,8 @@ plan](https://gitlab.com/gitlab-org/gitaly/issues/1226#note_126519133).
## Code status
-[![pipeline status](https://gitlab.com/gitlab-org/gitlab-shell/badges/master/pipeline.svg)](https://gitlab.com/gitlab-org/gitlab-shell/commits/master)
-[![coverage report](https://gitlab.com/gitlab-org/gitlab-shell/badges/master/coverage.svg)](https://gitlab.com/gitlab-org/gitlab-shell/commits/master)
+[![pipeline status](https://gitlab.com/gitlab-org/gitlab-shell/badges/master/pipeline.svg)](https://gitlab.com/gitlab-org/gitlab-shell/-/pipelines?ref=master)
+[![coverage report](https://gitlab.com/gitlab-org/gitlab-shell/badges/master/coverage.svg)](https://gitlab.com/gitlab-org/gitlab-shell/-/pipelines?ref=master)
[![Code Climate](https://codeclimate.com/github/gitlabhq/gitlab-shell.svg)](https://codeclimate.com/github/gitlabhq/gitlab-shell)
## Requirements