pullreview-coverage 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.pullreview.yml +5 -0
- data/CHANGELOG.md +10 -0
- data/README.md +59 -26
- data/lib/pullreview/coverage/client_api.rb +1 -0
- data/lib/pullreview/coverage/continuous_build.rb +12 -1
- data/lib/pullreview/coverage/version.rb +1 -1
- data/pullreview-coverage.gemspec +2 -2
- data/spec/coverage/continous_build_spec.rb +16 -0
- data/spec/spec_helper.rb +2 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d438d852e093bfb8bb27ca1e06a4c4f870b814a9
|
4
|
+
data.tar.gz: 43ebb1a326a15c79111fcae39f19bff8d07c559f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ed289d452e6fd2eef6fd362ec266ae32543dca9f26f53465398146b8db7b21be99c11a3f77e36f667dce546becce50260688c65d625cba55c448d0819ae650
|
7
|
+
data.tar.gz: b1da38b690252fc1bf0d64e142e5ffdb5e5c94f44209871020ef878b880a97c271e037a84eee17674657a30ded55b41bbaa5ed206b83e8495834224458714413
|
data/.pullreview.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
## [0.0.3] - 2015-03-11
|
6
|
+
### Added
|
7
|
+
- include into payload the URI of the build for Semaphore
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
- fix spec helper ENV allowing to update ENV for a test
|
data/README.md
CHANGED
@@ -2,59 +2,92 @@
|
|
2
2
|
|
3
3
|
[![PullReview stats](https://www.pullreview.com/github/8thcolor/pullreview-coverage/badges/master.svg?type=full)](https://www.pullreview.com/github/8thcolor/pullreview-coverage/reviews/master)
|
4
4
|
|
5
|
-
|
5
|
+
With the Gem PullReview-Coverage, you can retrieve your **Ruby test coverage** into PullReview.
|
6
6
|
|
7
|
-
##
|
7
|
+
## How it works?
|
8
8
|
|
9
|
-
|
9
|
+
Maintaining an environment to run your tests is hard and out of the scope of PullReview, and you probably already launch your tests via a self hosted continuous integration (CI) server ([Jenkins](http://jenkins-ci.org/), [GitLab CI](https://about.gitlab.com/gitlab-ci/)) or hosted CI service. The idea is to add a Gem and configure it to collect the coverage reports, and then to submit them to PullReview just after the tests are completed. PullReview will process them and map them to the current review, and add actions for the uncovered methods/classes.
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
Depending on race condition between PullReview and your CI-Server, you will have reviews with or without coverage related actions. If you have multiple test-suites, running on multiple nodes, PullReview will merge the coverage reports. If [PullReview](https://pullreview.com) isn't available at the report submission time, note that the build won't fail.
|
12
|
+
|
13
|
+
## Setup your project
|
14
|
+
|
15
|
+
Update Gemfile for `:test`
|
16
|
+
|
17
|
+
Add the following in `:test` group.
|
18
|
+
|
19
|
+
```Ruby
|
20
|
+
group :test do
|
14
21
|
gem 'pullreview-coverage', require: false
|
15
22
|
end
|
16
23
|
```
|
17
24
|
|
18
|
-
|
25
|
+
Once done, run a `bundle install` and commit your modified `Gemfile` and `Gemfile.lock`.
|
19
26
|
|
20
|
-
|
27
|
+
Note: this Gem is [open-source](https://github.com/8thcolor/pullreview-coverage) and available via [RubyGems](https://rubygems.org/gems/pullreview-coverage).
|
21
28
|
|
22
29
|
## Usage
|
23
30
|
|
24
|
-
|
25
|
-
|
31
|
+
### If you don't already use simplecov
|
32
|
+
|
33
|
+
You can simply enable the coverage report by adding the following lines in your `{spec,test}_helper.rb`:
|
34
|
+
|
35
|
+
```Ruby
|
36
|
+
require 'pullreview/coverage_reporter'
|
37
|
+
PullReview::CoverageReporter.start
|
38
|
+
```
|
26
39
|
|
27
|
-
|
40
|
+
### If you use already simplecov
|
41
|
+
|
42
|
+
Add our formatter in your `{spec,test}_helper.rb`:
|
43
|
+
|
44
|
+
```Ruby
|
28
45
|
require 'simplecov'
|
29
|
-
require 'simplecov-rcov'
|
30
46
|
require 'pullreview/coverage'
|
31
|
-
|
32
|
-
formatters
|
33
|
-
formatters << SimpleCov::Formatter::RcovFormatter if ENV['BUILD_ID'] # sample jenkins-ci formatter
|
47
|
+
formatters = []
|
48
|
+
... # your other formatters (html ?)
|
34
49
|
formatters << PullReview::Coverage::Formatter
|
35
|
-
|
36
50
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[*formatters]
|
37
|
-
|
38
51
|
```
|
52
|
+
## Setup in your CI build
|
39
53
|
|
40
|
-
|
54
|
+
Add an environment variable with your repository token
|
41
55
|
|
42
|
-
```
|
43
|
-
|
44
|
-
PullReview::CoverageReporter.start
|
56
|
+
```Bash
|
57
|
+
PULLREVIEW_REPO_TOKEN=<your repo token> rake test
|
45
58
|
```
|
46
59
|
|
47
|
-
|
60
|
+
Depending on the CI you use, you can pass that token via the environment variable `PULLREVIEW_REPO_TOKEN`, prefer the encrypted option if available:
|
61
|
+
|
62
|
+
* [Circle-CI](https://circleci.com/docs/environment-variables#setting-environment-variables-for-all-commands-without-adding-them-to-git)
|
63
|
+
* [Codeship](https://www.codeship.io/documentation/continuous-integration/set-environment-variables/)
|
64
|
+
* [Semaphore](https://semaphoreapp.com/docs/exporting-environment-variables.html)
|
65
|
+
* [Travis-CI ](http://docs.travis-ci.com/user/build-configuration/#Secure-environment-variables)
|
66
|
+
|
67
|
+
## Finally trigger a build
|
48
68
|
|
49
|
-
|
69
|
+
If the Gemfile modification is merged in your integration branch, new actions about test coverage could be now reported in the corresponding review.
|
70
|
+
|
71
|
+
## FAQ
|
72
|
+
|
73
|
+
### 1. I don't see any test coverage information in the reviews?
|
74
|
+
|
75
|
+
Checkout the logs of your CI-build, and looks for stacktraces/messages related to PullReview coverage.
|
50
76
|
|
51
77
|
```
|
52
|
-
|
53
|
-
|
78
|
+
PullReview::Coverage : info : Coverage report ok ClientApi : https://www.pullreview.com/api/coverage : 200 : {"message":"Invalid repository token"}
|
79
|
+
```
|
80
|
+
|
81
|
+
### 2. How can I check the content submitted to PullReview?
|
82
|
+
|
83
|
+
You could check the content submitted to PullReview by running in your project directory the following:
|
84
|
+
```Bash
|
85
|
+
PULLREVIEW_REPO_TOKEN=<token> PULLREVIEW_COVERAGE_TO_FILE=true rake test
|
86
|
+
# ...
|
54
87
|
PullReview::Coverage : info : Generated /tmp/coverage-8c2c37dd-8412-4137-9b38-7147c1662140.json
|
55
88
|
```
|
56
89
|
|
57
|
-
A
|
90
|
+
A JSON file will be generated in `/tmp/`. The content might change a little bit depending on your environment (dev, CI).
|
58
91
|
|
59
92
|
## Contributing
|
60
93
|
|
@@ -46,9 +46,20 @@ module PullReview
|
|
46
46
|
{
|
47
47
|
name: 'semaphore',
|
48
48
|
branch: ENV['BRANCH_NAME'],
|
49
|
-
build_id: ENV['SEMAPHORE_BUILD_NUMBER']
|
49
|
+
build_id: ENV['SEMAPHORE_BUILD_NUMBER'],
|
50
|
+
build_url: build_url(
|
51
|
+
ENV['SEMAPHORE_REPO_SLUG'],
|
52
|
+
ENV['BRANCH_NAME'],
|
53
|
+
ENV['SEMAPHORE_BUILD_NUMBER']
|
54
|
+
)
|
50
55
|
}
|
51
56
|
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def build_url(repo_slug, branch_name, build_number)
|
61
|
+
"https://semaphoreci.com/#{repo_slug}/branches/#{branch_name}/builds/#{build_number}"
|
62
|
+
end
|
52
63
|
end
|
53
64
|
|
54
65
|
# http://jenkins-ci.org/
|
data/pullreview-coverage.gemspec
CHANGED
@@ -6,8 +6,8 @@ require 'pullreview/coverage/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'pullreview-coverage'
|
8
8
|
spec.version = PullReview::Coverage::VERSION
|
9
|
-
spec.authors = ['Stephan Mestach']
|
10
|
-
spec.email = ['
|
9
|
+
spec.authors = ['Stephan Mestach', 'Christophe Philemotte']
|
10
|
+
spec.email = ['support@pullreview.com']
|
11
11
|
spec.summary = %q{Collect coverage information and send them to PullReview.com}
|
12
12
|
spec.description = %q{Collect coverage information generated by simplecov and send them to PullReview.com}
|
13
13
|
spec.homepage = 'https://www.pullreview.com'
|
@@ -21,4 +21,20 @@ describe PullReview::Coverage::ContinousBuild do
|
|
21
21
|
)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
it 'should support semaphore' do
|
26
|
+
with_env(
|
27
|
+
'SEMAPHORE' => 'true',
|
28
|
+
'BRANCH_NAME' => 'feature/super',
|
29
|
+
'SEMAPHORE_BUILD_NUMBER' => '123',
|
30
|
+
'SEMAPHORE_REPO_SLUG' => 'account/project'
|
31
|
+
) do
|
32
|
+
PullReview::Coverage::ContinousBuild.infos.must_equal(
|
33
|
+
name: 'semaphore',
|
34
|
+
branch: 'feature/super',
|
35
|
+
build_id: '123',
|
36
|
+
build_url: 'https://semaphoreci.com/account/project/branches/feature/super/builds/123'
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
24
40
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pullreview-coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Mestach
|
8
|
+
- Christophe Philemotte
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: simplecov
|
@@ -89,12 +90,14 @@ dependencies:
|
|
89
90
|
description: Collect coverage information generated by simplecov and send them to
|
90
91
|
PullReview.com
|
91
92
|
email:
|
92
|
-
-
|
93
|
+
- support@pullreview.com
|
93
94
|
executables: []
|
94
95
|
extensions: []
|
95
96
|
extra_rdoc_files: []
|
96
97
|
files:
|
97
98
|
- ".gitignore"
|
99
|
+
- ".pullreview.yml"
|
100
|
+
- CHANGELOG.md
|
98
101
|
- Gemfile
|
99
102
|
- LICENSE.txt
|
100
103
|
- README.md
|
@@ -132,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
135
|
version: '0'
|
133
136
|
requirements: []
|
134
137
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.4.3
|
136
139
|
signing_key:
|
137
140
|
specification_version: 4
|
138
141
|
summary: Collect coverage information and send them to PullReview.com
|