circleci_reporter 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2ada134b1de48734b63db0b3d490b58574636d8f75f7bd1feae84b350a39554e
4
+ data.tar.gz: e95c83a50b10a110fcb44dd6496eb53c838b2769f9471a3f6c01fca094ead057
5
+ SHA512:
6
+ metadata.gz: 813e662bfa72e64cca3e5d51645de34a30a25ac31b7a103f9ad5f1722e98c560d43ceea3dc9c0dd3d3aa211a1ccc45db4e0f8309b68d048d6b6a9727e5508426
7
+ data.tar.gz: 00e71ea752be325437005ed29a93cf8d4f33155aa25c0e2af266aed9063b7f3c9e3fc8fa8edc9a1e566e43c26d7feae451d4e51c543ad03128b8d4485febf368
data/.config.reek ADDED
@@ -0,0 +1,23 @@
1
+ ---
2
+ Attribute:
3
+ enabled: false
4
+ DuplicateMethodCall:
5
+ max_calls: 2
6
+ FeatureEnvy:
7
+ enabled: false
8
+ IrresponsibleModule:
9
+ enabled: false
10
+ RepeatedConditional:
11
+ exclude:
12
+ - "CircleCI::CoverageReporter::Client"
13
+ TooManyStatements:
14
+ exclude:
15
+ - "CircleCI::CoverageReporter::Sandbox#self.sandboxed"
16
+ UnusedParameters:
17
+ exclude:
18
+ - !ruby/regexp /Abstract/
19
+ - "CircleCI::CoverageReporter::ReportsRenderer#render"
20
+ UtilityFunction:
21
+ enabled: false
22
+
23
+ # vim:set ft=yaml:
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/examples.txt
9
+ /spec/reports/
10
+ /tmp/
11
+ /rubycritic/
12
+
13
+ .rubocop-*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-performance
4
+
5
+ inherit_from:
6
+ - https://relaxed.ruby.style/rubocop.yml
7
+
8
+ AllCops:
9
+ NewCops: enable
10
+ TargetRubyVersion: 2.7
data/.yardopts ADDED
@@ -0,0 +1,4 @@
1
+ --markup markdown
2
+ -
3
+ CHANGELOG.md
4
+ LICENSE.txt
data/CHANGELOG.md ADDED
@@ -0,0 +1,94 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.0.0] - 2020-04-16
10
+ ### Changed
11
+ - Upgrade Faraday version dependency
12
+ - Minor fixes
13
+
14
+ ## [0.8.0] - 2017-05-31
15
+ ### Changed
16
+ - Use artifacts in container No. 0
17
+
18
+ ## [0.7.0] - 2017-05-31
19
+ ### Changed
20
+ - Add base and previous links to Link reporter
21
+
22
+ ## [0.6.0] - 2017-05-30
23
+ ### Changed
24
+ - Refactor how to implement reporter. Now a reporter consists of a single ruby class
25
+
26
+ ### Removed
27
+ - Remove template configuration
28
+
29
+ ## [0.5.0] - 2017-05-18
30
+ ### Added
31
+ - Add Link reporter
32
+
33
+ ## [0.4.0] - 2017-03-18
34
+ ### Added
35
+ - Support [RubyCritic](https://github.com/whitesmith/rubycritic) score
36
+ - Enable to change score unit
37
+
38
+ ### Changed
39
+ - Round coverage by default
40
+
41
+ ### Fixed
42
+ - Make sure that `#coverage` methods return a `Float` object
43
+
44
+ ## [0.3.1] - 2017-03-17
45
+ ### Fixed
46
+ - Suppress emoji if base diff is NaN or zero
47
+
48
+ ## [0.3.0] - 2017-03-16
49
+ ### Added
50
+ - Add template configuration
51
+
52
+ ### Changed
53
+ - Remove `CircleCI::CoverageReporter::Client#configuration`
54
+
55
+ ### Fixed
56
+ - Run each example in sandbox
57
+
58
+ ## [0.2.0] - 2017-03-14
59
+ ### Added
60
+ - Support [Flow](https://flowtype.org) coverage reported by [flow-coverage-report](https://github.com/rpl/flow-coverage-report)
61
+
62
+ ### Fixed
63
+ - Disable inactive reporters
64
+ - Fix uninitialized constant `Float::NaN`
65
+
66
+ ## [0.1.3] - 2017-03-12
67
+ ### Fixed
68
+ - Raise `RequestError` if some API reqeust fails
69
+ - Show `NaN` if .last_run.json does not exist
70
+
71
+ ## [0.1.2] - 2017-03-12
72
+ ### Fixed
73
+ - Set `nil` to previous_build_number if CIRCLE_PREVIOUS_BUILD_NUM environment variable is empty
74
+
75
+ ## [0.1.1] - 2017-03-12
76
+ ### Fixed
77
+ - Ignore base_build if it is on master branch
78
+
79
+ ## 0.1.0 - 2017-03-12
80
+ ### Added
81
+ - Initial release
82
+
83
+ [Unreleased]: https://github.com/increments/circleci-coverage_reporter/compare/v0.8.0...HEAD
84
+ [0.8.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.7.0...v0.8.0
85
+ [0.7.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.6.0...v0.7.0
86
+ [0.6.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.5.0...v0.6.0
87
+ [0.5.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.4.0...v0.5.0
88
+ [0.4.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.3.1...v0.4.0
89
+ [0.3.1]: https://github.com/increments/circleci-coverage_reporter/compare/v0.3.0...v0.3.1
90
+ [0.3.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.2.0...v0.3.0
91
+ [0.2.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.1.3...v0.2.0
92
+ [0.1.3]: https://github.com/increments/circleci-coverage_reporter/compare/v0.1.2...v0.1.3
93
+ [0.1.2]: https://github.com/increments/circleci-coverage_reporter/compare/v0.1.1...v0.1.2
94
+ [0.1.1]: https://github.com/increments/circleci-coverage_reporter/compare/v0.1.0...v0.1.1
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Increments inc,
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # CircleCIReporter
2
+
3
+ This is a maitained fork of [CircleCI::CoverageReporter](https://github.com/increments/circleci-coverage_reporter)
4
+
5
+ **CircleCIReporter** reports test coverage to your GitHub repository.
6
+
7
+ ## Getting started
8
+
9
+ 1. Add CircleCIReporter to your `Gemfile` and `bundle install`:
10
+
11
+ ```ruby
12
+ gem 'circleci_reporter', group: :test
13
+ ```
14
+
15
+ 2. Load `circleci_reporter/rake_task` in your `Rakefile`:
16
+
17
+ ```ruby
18
+ require 'circleci_reporter/rake_task' if ENV['CIRCLECI']
19
+ ```
20
+
21
+ 3. Issue CircleCI and GitHub tokens and add them to build environment variables as follows:
22
+
23
+ Name | Value
24
+ -----------------------------------|----------------------------------------------------------------
25
+ `CIRCLECI_REPORTER_CIRCLECI_TOKEN` | CircleCI API token with "view-builds" scope
26
+ `CIRCLECI_REPORTER_VCS_TOKEN` | GitHub personal access token with "repo" or "public_repo" scope
27
+
28
+ 4. Add the following step to your `circle.yml`:
29
+
30
+ ```yaml
31
+ test:
32
+ post:
33
+ - bundle exec rake circleci_reporter:coverage
34
+ ```
35
+
36
+ ## Run manually
37
+
38
+ You must configure `circleci_token` and `vcr_token` before `CircleCIReporter.run`:
39
+
40
+ ```ruby
41
+ CircleCIReporter.configure do |config|
42
+ config.circleci_token = YOUR_CIRCLECI_API_TOKEN
43
+ config.vcr_token = YOUR_GITHUB_PERSONAL_ACCESS_TOKEN
44
+ end
45
+
46
+ CircleCIReporter.run
47
+ ```
48
+
49
+ ## Reporters
50
+ ### SimpleCov
51
+
52
+ `CircleCIReporter::Reporters::SimpleCovReporter` handles coverage files generated by
53
+ [SimpleCov](https://github.com/colszowka/simplecov).
54
+
55
+ It expects that coverage files are located in `$CIRCLE_ARTIFACTS/coverage` directory:
56
+
57
+ ```ruby
58
+ # spec/spec_helper.rb
59
+ require 'simplecov'
60
+ # Save to CircleCI's artifacts directory if we're on CircleCI
61
+ SimpleCov.coverage_dir(File.join(ENV['CIRCLE_ARTIFACTS'], 'coverage')) if ENV['CIRCLECI']
62
+ SimpleCov.start
63
+ ```
64
+
65
+ If you put files in another directory, say `$CIRCLE_ARTIFACTS/foo/bar`, you have to set reporter as follows:
66
+
67
+ ```ruby
68
+ CircleCIReporter.configure do |config|
69
+ config.reporters << CircleCIReporter::Reporters::SimpleCov.new(dir: 'foo/bar')
70
+ end
71
+ ```
72
+
73
+ ### Flow
74
+
75
+ `CircleCIReporter::Reporters::FlowReporter` handles coverage files generated by
76
+ [flow-coverage-report](https://github.com/rpl/flow-coverage-report)
77
+
78
+ It expects that there is `$CIRCLE_ARTIFACTS/flow-coverage/flow-coverage.json`:
79
+
80
+ ```bash
81
+ $(npm bin)/flow-coverage-report -t json -o $CIRCLE_ARTIFACTS/flow-coverage
82
+ ```
83
+
84
+ If you put the file in another path, say `$CIRCLE_ARTIFACTS/foo/bar/flow-coverage.json`,
85
+ you have to set reporter as follows:
86
+
87
+ ```ruby
88
+ CircleCIReporter.configure do |config|
89
+ config.reporters << CircleCIReporter::Reporters::Flow.new(dir: 'foo/bar')
90
+ end
91
+ ```
92
+
93
+ ### RubyCritic
94
+
95
+ `CircleCIReporter::Reporters::RubyCritic` handles code quality files generated by
96
+ [rubycritic](https://github.com/whitesmith/rubycritic)
97
+
98
+ ```bash
99
+ bundle exec rubycritic -p $CIRCLE_ARTIFACTS/rubycritic -f json --no-browser --mode-ci app
100
+ bundle exec rubycritic -p $CIRCLE_ARTIFACTS/rubycritic -f html --no-browser --mode-ci app
101
+ ```
102
+
103
+ ### Link
104
+
105
+ `CircleCIReporter::Reporters::Link` reports a link to an artifact file.
106
+
107
+ ```ruby
108
+ CircleCIReporter.configure do |config|
109
+ config.reporters << CircleCI::CoverateReporter::Reporters::Link.new(path: 'path/to/file', name: 'NAME')
110
+ end
111
+ ```
112
+
113
+ ## License
114
+
115
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+ require 'yard'
7
+ require 'circleci_reporter/rake_task'
8
+ require 'rubycritic/rake_task'
9
+
10
+ RSpec::Core::RakeTask.new do |task|
11
+ task.verbose = false
12
+ end
13
+
14
+ RuboCop::RakeTask.new
15
+
16
+ YARD::Rake::YardocTask.new
17
+
18
+ CircleCIReporter.configure do |config|
19
+ config.reporters << CircleCIReporter::Reporters::Link.new(path: 'doc/index.html', name: 'YARD')
20
+ end
21
+
22
+ desc 'Run RubyCritic'
23
+ task :rubycritic do
24
+ base_options = "-p #{ENV['CIRCLE_ARTIFACTS'] || '.'}/rubycritic --mode-ci --no-browser"
25
+ sh "bundle exec rubycritic #{base_options} -f html lib"
26
+ sh "bundle exec rubycritic #{base_options} -f json lib" if ENV['CIRCLECI']
27
+ end
28
+
29
+ task default: %i[spec rubocop]
data/bin/rspec ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/rubocop ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rubocop', 'rubocop')
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/yard ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'yard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('yard', 'yard')
data/circle.yml ADDED
@@ -0,0 +1,11 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.4.0
4
+ test:
5
+ override:
6
+ - bundle exec rspec --format progress --require rspec_junit_formatter --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/junit.xml
7
+ - bundle exec rubocop
8
+ post:
9
+ - bundle exec rake rubycritic
10
+ - bundle exec yard doc -o $CIRCLE_ARTIFACTS/doc
11
+ - bundle exec rake circleci_reporter:coverage
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'circleci_reporter/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'circleci_reporter'
9
+ spec.version = CircleCIReporter::Version.to_s
10
+ spec.authors = ['Yuku Takahashi', 'Filippo Liverani']
11
+
12
+ spec.summary = 'Report CircleCI test coverage and static analysis'
13
+ spec.description = 'Report CircleCI test coverage and static analysis results to your GitHub repository'
14
+ spec.homepage = 'https://github.com/filippoliverani/circleci-reporter'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+ spec.required_ruby_version = '>= 2.7'
23
+
24
+ spec.add_dependency 'faraday', '~> 1.0'
25
+
26
+ spec.add_development_dependency 'ffaker', '~> 2.18'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.10'
29
+ spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
30
+ spec.add_development_dependency 'rubocop', '~> 1.12'
31
+ spec.add_development_dependency 'rubocop-performance', '~> 1.10'
32
+ spec.add_development_dependency 'rubocop-rake', '~> 0.5'
33
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
34
+ spec.add_development_dependency 'rubycritic', '~> 4.6'
35
+ spec.add_development_dependency 'simplecov', '~> 0.21'
36
+ spec.add_development_dependency 'yard', '~> 0.9'
37
+ end