codeclimate_circle_ci_coverage 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/report_coverage +2 -0
- data/lib/codeclimate_circle_ci_coverage.rb +2 -0
- data/lib/codeclimate_circle_ci_coverage/circle_ci_1.rb +3 -1
- data/lib/codeclimate_circle_ci_coverage/circle_ci_2.rb +22 -5
- data/lib/codeclimate_circle_ci_coverage/coverage_reporter.rb +2 -0
- data/lib/codeclimate_circle_ci_coverage/patch_simplecov.rb +2 -0
- data/lib/codeclimate_circle_ci_coverage/version.rb +3 -1
- data/spec/coverage_reporter_spec.rb +4 -2
- data/spec/spec_helper.rb +2 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2f71f70c8e89c3094db834517ac6230d75713190a3e839bcde3e21a54d0067fa
|
4
|
+
data.tar.gz: c8af9c061ec72fa28cf89669caf6ad5fe9ad326c2d4d2807479b18fb526fc32e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14fc78b9b8a9c689d29b6de34f0ffa426f2034fb3648e65b3665252eb30f6110d1bcebf73cbc3c36de796629c11e8cc58e9e6d0feab88dcb6b7453bfdcc2b794
|
7
|
+
data.tar.gz: '08c87f8e5690392983e05b79b084decad0953aaf128d6858a1f155f3793ebc32b17e8776d721cd1404580ec6fa957a8127ba0348ad15f8a8b64905cd3b2c8a71'
|
data/bin/report_coverage
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'fileutils'
|
2
4
|
require 'json'
|
3
5
|
|
@@ -32,7 +34,7 @@ class CircleCi1
|
|
32
34
|
|
33
35
|
# Load coverage results from all nodes
|
34
36
|
files = Dir.glob(File.join(target_directory, "*.resultset.json"))
|
35
|
-
files.map do |file,
|
37
|
+
files.map do |file, _i|
|
36
38
|
JSON.load(File.read(file))
|
37
39
|
end
|
38
40
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'open-uri'
|
2
4
|
require 'json'
|
3
5
|
|
@@ -6,18 +8,33 @@ class CircleCi2
|
|
6
8
|
|
7
9
|
def download_files
|
8
10
|
if ENV["CIRCLE_TOKEN"].nil?
|
9
|
-
puts "You must create a Circle CI API token to use this on Circle CI 2.0"
|
11
|
+
puts "You must create a Circle CI Artifacts-API token to use this on Circle CI 2.0"
|
10
12
|
puts "Please create that, and store the key as CIRCLE_TOKEN"
|
11
13
|
return []
|
12
14
|
end
|
13
|
-
|
15
|
+
# rubocop:disable Metrics/LineLength
|
14
16
|
api_url = "https://circleci.com/api/v1.1/project/github/#{ENV['CIRCLE_PROJECT_USERNAME']}/#{ENV['CIRCLE_PROJECT_REPONAME']}/#{ENV['CIRCLE_BUILD_NUM']}/artifacts?circle-token=#{ENV['CIRCLE_TOKEN']}"
|
17
|
+
# rubocop:enable Metrics/LineLength
|
15
18
|
artifacts = open(api_url)
|
16
19
|
|
17
|
-
JSON.load(artifacts)
|
18
|
-
|
20
|
+
paths = matching_urls(JSON.load(artifacts))
|
21
|
+
|
22
|
+
if paths.none?
|
23
|
+
puts "No Results Found. Did you store the artifacts with 'store_artifacts'?"
|
24
|
+
puts "did you use 'prefix: coverage'?"
|
25
|
+
return []
|
26
|
+
end
|
27
|
+
|
28
|
+
paths.map do |path|
|
29
|
+
JSON.load(open("#{path}?circle-token=#{ENV['CIRCLE_TOKEN']}"))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def matching_urls(json)
|
34
|
+
json.select do |artifact|
|
35
|
+
artifact['path'].match("#{ARTIFACT_PREFIX}/.resultset.json")
|
19
36
|
end.map do |artifact|
|
20
|
-
|
37
|
+
artifact['url']
|
21
38
|
end
|
22
39
|
end
|
23
40
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe CoverageReporter do
|
@@ -9,9 +11,9 @@ describe CoverageReporter do
|
|
9
11
|
{
|
10
12
|
"RSpec" => {
|
11
13
|
"coverage" => {
|
12
|
-
"#{SimpleCov.root}/spec/fixtures/fake_project/fake_project.rb" => [5,3,nil,0]
|
14
|
+
"#{SimpleCov.root}/spec/fixtures/fake_project/fake_project.rb" => [5, 3, nil, 0]
|
13
15
|
},
|
14
|
-
"timestamp" => Time.now.to_i
|
16
|
+
"timestamp" => Time.now.to_i
|
15
17
|
}
|
16
18
|
}
|
17
19
|
]
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate_circle_ci_coverage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Dunlop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codeclimate-test-reporter
|
@@ -90,16 +90,16 @@ dependencies:
|
|
90
90
|
name: rubocop
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0
|
95
|
+
version: '0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0
|
102
|
+
version: '0'
|
103
103
|
description: A set of tools to support reporting SimpleCov Coverage to CodeClimate
|
104
104
|
with Parallel tests on CircleCI
|
105
105
|
email: robin@dunlopweb.com
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.6
|
140
|
+
rubygems_version: 2.7.6
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: CodeClimate Code Coverage reporting script for CircleCI
|