codecov 0.4.1 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e4bfdd1a36904d0b501d1e6ad97d5242e4a5ffa17a13b1c2968a8346bc26396
4
- data.tar.gz: f0ee40b20016417dafc3aa0d68685872bd4ad2a6795cee3233b04f4de1ea3fec
3
+ metadata.gz: 70bfb5e87efb9db0f4b9141da317062ff710e17daceb7c587454d7be42144851
4
+ data.tar.gz: 7bcfef401da5bdf95542343fa656db7f7a80ce1e071b1aff4115bd31ad3b43ac
5
5
  SHA512:
6
- metadata.gz: 4e669367d900a5b432fb511986f6e9276df0594378347de38d1a9462f344262fcc28f33333dfec8475afc68888811507cfb3db56398cea78bd28e0f557bbeddd
7
- data.tar.gz: 1ff31b938ed8383c7dc6c067f607283d9d9aafe468302aef8957eb0ba64148c2361feb4b9c5e2129bf529987f09399c020288b542ca5741f8956948d358fcc27
6
+ metadata.gz: 738513034e8e1a07cab86488eaa759a5593e2779cecde51f5b22f1de36e4ea1ce8356dc484d6c24130782a1353b9379ef91d967e528651936b9571be29c29b74
7
+ data.tar.gz: dca359ac80ef1b937b2305e9c69f857cce1eff1632798329c9349ae9e578b2c8d6654802a6091583406e5bd64f1dae22233c4fdeb24e2bb3fe3164edab9f3df4
data/CHANGELOG.md ADDED
@@ -0,0 +1,133 @@
1
+ ### `0.5.2`
2
+ - #141 Add Cirrus CI support
3
+
4
+ ### `0.5.1`
5
+ - #138 Update pass_ci_if_error flag
6
+
7
+ ### `0.5.0`
8
+ - #137 Place uploader in try/rescue block and add pass_ci_if_error flag
9
+
10
+ ### `0.4.3`
11
+ - #135 Shorten coverage message on formatter
12
+
13
+ ### `0.4.2`
14
+ - #134 Wrap file creation in try/catch
15
+
16
+ ### `0.4.1`
17
+ - #133 Write down to file when using the formatter
18
+
19
+ ### `0.4.0`
20
+ - #130 Split uploader from formatter
21
+
22
+ ### `0.3.0`
23
+ - #124 Ruby 3.0 support
24
+ - #125 open simplecov requirement to 0.21.x
25
+
26
+ ### `0.2.15`
27
+ - #118 Include codecov/version in the gem
28
+
29
+ ### `0.2.14`
30
+ - #107 Add EditorConfig file
31
+ - #113 Return version constant, don't duplicate version value
32
+ - #117 Update simplecov dependency versions
33
+
34
+ ### `0.2.13`
35
+ - [#105](https://github.com/codecov/codecov-ruby/pull/105) Remove unnecessary dependency for ruby standard gem
36
+ - [#110](https://github.com/codecov/codecov-ruby/pull/110) Fix GitHub Actions
37
+ - [#111](https://github.com/codecov/codecov-ruby/pull/111) Fix branch name detection for GitHub Actions CI
38
+
39
+ ### `0.2.12`
40
+ - [#102](https://github.com/codecov/codecov-ruby/pull/102) Fix value of params[:pr] when useing CodeBuild
41
+
42
+ ### `0.2.11`
43
+ - Add vendor/ to invalid directories
44
+
45
+ ### `0.2.10`
46
+ - Adds better logging on error cases
47
+ - Add more invalid directories in the network
48
+
49
+ ### `0.2.9`
50
+ - Remove `String` specific colors
51
+ - Add support for Codebuild CI
52
+
53
+ ### `0.2.8`
54
+ - Remove `colorize` dependency
55
+
56
+ ### `0.2.7`
57
+ - Fix for enterprise users unable to upload using the v4 uploader
58
+
59
+ ### `0.2.6`
60
+ - Fix issue with `push` events on GitHub Actions
61
+
62
+ ### `0.2.5`
63
+ - Revert single use of VERSION
64
+
65
+ ### `0.2.4`
66
+ - Adds support for GitHub Actions CI
67
+
68
+ ### `0.2.3`
69
+ - Support uploads for jruby 9.1 and 9.2
70
+
71
+ ### `0.2.2`
72
+ - Handle SocketError and better error handling of v4 failures
73
+
74
+ ### `0.2.1`
75
+ - Properly handle 400 cases when using the v4 endpoint
76
+
77
+ ### `0.2.0`
78
+ - move to the v4 upload endpoint with the v2 as a fallback
79
+
80
+ ### `0.1.20`
81
+ - fix critical upload issues on V2 endpoint
82
+
83
+ ### `0.1.19`
84
+ - fix colorize
85
+
86
+ ### `0.1.18`
87
+ - refactor and move to use v2 endpoint
88
+ - use Timeout::Error
89
+
90
+ ### `0.1.17`
91
+ - refactor upload method and add more logging
92
+
93
+ ### `0.1.10`
94
+ - update numerous ci environments
95
+ - dont fail if cannot upload to codecov
96
+
97
+ ### `0.1.3`
98
+ - add buildkite
99
+
100
+ ### `0.1.2`
101
+ - add slug argument
102
+ - use slug for uploading
103
+ - add Accept to uploads
104
+
105
+ ### `0.1.1`
106
+ - fix #6, thanks @justmatt
107
+ - add semaphore thread number
108
+
109
+ ### `0.1.0`
110
+ - added more CircleCI env
111
+
112
+ ### `0.0.11`
113
+ - send AppVeyor pr# with reports
114
+
115
+ ### `0.0.10`
116
+ - fix AppVeyor for public repos
117
+
118
+ ### `0.0.9`
119
+ - remove tmp.json creation
120
+
121
+ ### `0.0.8`
122
+ - added more jenkins environment references
123
+
124
+ ### `0.0.7`
125
+ - added GitLab CI Runner support
126
+
127
+ ### `0.0.5`
128
+ - added line messages by @coderanger
129
+ - fixed skip lines during reporting by @coderanger
130
+
131
+ ### `0.0.4`
132
+ - added more test
133
+ - added more CI providers
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Codecov
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,111 @@
1
+ # Codecov Ruby Uploader
2
+
3
+ ## DEPRECATION WARNING
4
+
5
+ All versions of the Ruby uploader prior to `0.2.0` will no longer be supported
6
+ and will be removed from public use on or after *2020-08-17*.
7
+ Please upgrade to the latest versions to continue using this uploader.
8
+
9
+ [![Codecov](https://codecov.io/github/codecov/codecov-ruby/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-ruby?branch=master)
10
+ [![Gem Version](https://badge.fury.io/rb/codecov.svg)](https://rubygems.org/gems/codecov)
11
+ [![Build Status](https://secure.travis-ci.org/codecov/codecov-ruby.svg?branch=master)](http://travis-ci.org/codecov/codecov-ruby)
12
+ [![Codecov](https://circleci.com/gh/codecov/codecov-ruby.svg?style=svg)](https://circleci.com/gh/codecov/codecov-ruby)
13
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-ruby.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-ruby?ref=badge_shield)
14
+
15
+
16
+ [Codecov.io](https://codecov.io/) upload support for Ruby.
17
+
18
+ ## Quick Start
19
+
20
+ Add to your `Gemfile`:
21
+
22
+ ```ruby
23
+ gem 'codecov', require: false, group: 'test'
24
+ ```
25
+
26
+ Add to the top of your `tests/helper.rb` file:
27
+
28
+ ```ruby
29
+ require 'simplecov'
30
+ SimpleCov.start
31
+
32
+ require 'codecov'
33
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
34
+ ```
35
+
36
+ Add CI Environment Variable:
37
+
38
+ ```sh
39
+ CODECOV_TOKEN="your repo token"
40
+ ```
41
+
42
+ Find you repo token on your repo page at [codecov.io](https://codecov.io).
43
+ Repo tokens are **not** required for public repos on Travis-Ci, CircleCI, or AppVeyor CI.
44
+
45
+ ## Supported CIs
46
+ | CI/CD |
47
+ | ----- |
48
+ | [AppVeyor CI](https://www.appveyor.com/) |
49
+ | [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) |
50
+ | [Bitbucket Pipelines](https://bitbucket.org/product/features/pipelines) |
51
+ | [Bitrise CI](https://www.bitrise.io/) |
52
+ | [Buildkite CI](https://buildkite.com/) |
53
+ | [CodeBuild CI](https://aws.amazon.com/codebuild/) |
54
+ | [CodePipeline](https://aws.amazon.com/codepipeline/) |
55
+ | [Circle CI](https://circleci.com/) |
56
+ | [Codeship CI](https://codeship.com/) |
57
+ | [Drone CI](https://drone.io/) |
58
+ | [GitLab CI](https://docs.gitlab.com/ee/ci/) |
59
+ | [Heroku CI](https://www.heroku.com/continuous-integration) |
60
+ | [Jenkins CI](https://www.jenkins.io/) |
61
+ | [Semaphore CI](https://semaphoreci.com/) |
62
+ | [Shippable](https://www.shippable.com/) |
63
+ | [Solano CI](https://xebialabs.com/technology/solano-ci/) |
64
+ | [TeamCity CI](https://www.jetbrains.com/teamcity/) |
65
+ | [Travis CI](https://travis-ci.org/) |
66
+ | [Wercker CI](https://devcenter.wercker.com/) |
67
+
68
+ ## Advanced Usage
69
+
70
+ #### Submit only in CI example
71
+
72
+ ```ruby
73
+ if ENV['CI'] == 'true'
74
+ require 'codecov'
75
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
76
+ end
77
+ ```
78
+
79
+ ## Useful Links
80
+
81
+ [FAQ](https://docs.codecov.io/docs/frequently-asked-questions)
82
+ [Recipe List](https://docs.codecov.io/docs/common-recipe-list)
83
+ [Error Reference](https://docs.codecov.io/docs/error-reference)
84
+ [Changelog](./CHANGELOG.md)
85
+ [Support](https://codecov.io/support)
86
+ [Community Boards](https://community.codecov.io)
87
+
88
+ ## Caveats
89
+
90
+ 1. There are known issues when `Simplecov.track_files` is enabled. We recommend that you require all code files in your tests so that SimpleCov can provide Codecov with properly mapped coverage report metrics. [codecov/support#133]( https://github.com/codecov/support/issues/133)
91
+ - https://github.com/colszowka/simplecov/blob/master/README.md#default-root-filter-and-coverage-for-things-outside-of-it
92
+ 2. `git` must be installed.
93
+ - https://github.com/codecov/codecov-ruby/blob/5e3dae3/lib/codecov.rb#L284-L295
94
+
95
+ ## Maintainers
96
+
97
+ - [thomasrockhu](https://github.com/thomasrockhu)
98
+
99
+ ## Enterprise
100
+
101
+ For companies using Codecov Enterprise you will need to specify the following parameters:
102
+
103
+ ```sh
104
+ CODECOV_URL="https://codecov.mycompany.com"
105
+ CODECOV_SLUG="owner/repo"
106
+ CODECOV_TOKEN="repository token or global token"
107
+ ```
108
+
109
+
110
+ ## License
111
+ [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-ruby.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-ruby?ref=badge_large)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Codecov
4
+ module Configuration
5
+ attr_accessor :pass_ci_if_error
6
+ end
7
+ end
@@ -17,12 +17,14 @@ module Codecov
17
17
  }
18
18
  result.update(result_to_codecov(report))
19
19
 
20
- result_path = File.join(::SimpleCov.coverage_path, RESULT_FILE_NAME)
21
- if File.writable?(result_path)
20
+ begin
21
+ result_path = File.join(::SimpleCov.coverage_path, RESULT_FILE_NAME)
22
22
  File.write(result_path, result['codecov'])
23
- puts "Coverage report generated to #{result_path}.\#{result}"
24
- else
25
- puts "Could not write coverage report to file #{result_path}.\n#{result}"
23
+ overflow = result['coverage'].to_s.length > 256 ? '...' : ''
24
+ puts "Coverage report generated to #{result_path}.\n#{result['coverage'].to_s.[](0, 255)}#{overflow}"
25
+ rescue Errno::ENOENT => e
26
+ puts e
27
+ puts "Could not write coverage report to file.\n#{result}"
26
28
  end
27
29
 
28
30
  result
@@ -57,7 +59,6 @@ module Codecov
57
59
 
58
60
  invalid_directories = [
59
61
  'node_modules/',
60
- 'public/',
61
62
  'storage/',
62
63
  'tmp/',
63
64
  'vendor/'
@@ -17,6 +17,7 @@ class Codecov::Uploader
17
17
  BITRISE = 'Bitrise CI',
18
18
  BUILDKITE = 'Buildkite CI',
19
19
  CIRCLE = 'Circle CI',
20
+ CIRRUS = 'Cirrus CI',
20
21
  CODEBUILD = 'Codebuild CI',
21
22
  CODESHIP = 'Codeship CI',
22
23
  DRONEIO = 'Drone CI',
@@ -37,7 +38,17 @@ class Codecov::Uploader
37
38
 
38
39
  display_header
39
40
  ci = detect_ci
40
- response = upload_to_codecov(ci, report)
41
+
42
+ begin
43
+ response = upload_to_codecov(ci, report)
44
+ rescue StandardError => e
45
+ puts e.message
46
+ puts e.backtrace.join("\n")
47
+ raise e unless ::Codecov.pass_ci_if_error
48
+
49
+ response = false
50
+ end
51
+
41
52
  if response == false
42
53
  report['result'] = { 'uploaded' => false }
43
54
  return report
@@ -77,6 +88,8 @@ class Codecov::Uploader
77
88
  BUILDKITE
78
89
  elsif (ENV['CI'] == 'true') && (ENV['CIRCLECI'] == 'true')
79
90
  CIRCLE
91
+ elsif !ENV['CIRRUS_CI'].nil?
92
+ CIRRUS
80
93
  elsif ENV['CODEBUILD_CI'] == 'true'
81
94
  CODEBUILD
82
95
  elsif (ENV['CI'] == 'true') && (ENV['CI_NAME'] == 'codeship')
@@ -178,18 +191,41 @@ class Codecov::Uploader
178
191
  params[:pr] = ENV['CIRCLE_PR_NUMBER']
179
192
  params[:branch] = ENV['CIRCLE_BRANCH']
180
193
  params[:commit] = ENV['CIRCLE_SHA1']
194
+ when CIRRUS
195
+ # https://cirrus-ci.org/guide/writing-tasks/#environment-variables
196
+ params[:branch] = ENV['CIRRUS_BRANCH']
197
+ params[:build] = ENV['CIRRUS_BUILD_ID']
198
+ params[:build_url] = "https://cirrus-ci.com/tasks/#{ENV['CIRRUS_TASK_ID']}"
199
+ params[:commit] = ENV['CIRRUS_CHANGE_IN_REPO']
200
+ params[:job] = ENV['CIRRUS_TASK_NAME']
201
+ params[:pr] = ENV['CIRRUS_PR']
202
+ params[:service] = 'cirrus-ci'
203
+ params[:slug] = ENV['CIRRUS_REPO_FULL_NAME']
181
204
  when CODEBUILD
182
205
  # https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
206
+ # To use CodePipeline as CodeBuild source which sets no branch and slug variable:
207
+ #
208
+ # 1. Set up CodeStarSourceConnection as source action provider
209
+ # https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html
210
+ # 2. Add a Namespace to your source action. Example: "CodeStar".
211
+ # https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html#reference-variables-concepts-namespaces
212
+ # 3. Add these environment variables to your CodeBuild action:
213
+ # - CODESTAR_BRANCH_NAME: #{CodeStar.BranchName}
214
+ # - CODESTAR_FULL_REPOSITORY_NAME: #{CodeStar.FullRepositoryName} (optional)
215
+ # https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodeBuild.html#action-reference-CodeBuild-config
216
+ #
217
+ # PRs are not supported with CodePipeline.
183
218
  params[:service] = 'codebuild'
184
- params[:branch] = ENV['CODEBUILD_WEBHOOK_HEAD_REF'].split('/')[2]
219
+ params[:branch] = ENV['CODEBUILD_WEBHOOK_HEAD_REF']&.split('/')&.[](2) || ENV['CODESTAR_BRANCH_NAME']
185
220
  params[:build] = ENV['CODEBUILD_BUILD_ID']
186
221
  params[:commit] = ENV['CODEBUILD_RESOLVED_SOURCE_VERSION']
187
222
  params[:job] = ENV['CODEBUILD_BUILD_ID']
188
- params[:slug] = ENV['CODEBUILD_SOURCE_REPO_URL'].match(/.*github.com\/(?<slug>.*).git/)['slug']
189
- params[:pr] = if ENV['CODEBUILD_SOURCE_VERSION']
223
+ params[:slug] = ENV['CODEBUILD_SOURCE_REPO_URL']&.match(/.*github.com\/(?<slug>.*).git/)&.[]('slug') || ENV['CODESTAR_FULL_REPOSITORY_NAME']
224
+ params[:pr] = if ENV['CODEBUILD_SOURCE_VERSION'] && !(ENV['CODEBUILD_INITIATOR'] =~ /codepipeline/)
190
225
  matched = ENV['CODEBUILD_SOURCE_VERSION'].match(%r{pr/(?<pr>.*)})
191
226
  matched.nil? ? ENV['CODEBUILD_SOURCE_VERSION'] : matched['pr']
192
227
  end
228
+ params[:build_url] = ENV['CODEBUILD_BUILD_URL']
193
229
  when CODESHIP
194
230
  # https://www.codeship.io/documentation/continuous-integration/set-environment-variables/
195
231
  params[:service] = 'codeship'
@@ -521,3 +557,6 @@ class Codecov::Uploader
521
557
  str.nil? ? '' : "\e[32m#{str}\e[0m"
522
558
  end
523
559
  end
560
+
561
+ require_relative 'configuration'
562
+ Codecov.extend Codecov::Configuration
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Codecov
4
- VERSION = '0.4.1'
4
+ VERSION = '0.5.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codecov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Peak
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-01-26 00:00:00.000000000 Z
12
+ date: 2021-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: simplecov
@@ -45,20 +45,6 @@ dependencies:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.0'
48
- - !ruby/object:Gem::Dependency
49
- name: minitest-ci
50
- requirement: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
48
  - !ruby/object:Gem::Dependency
63
49
  name: mocha
64
50
  requirement: !ruby/object:Gem::Requirement
@@ -122,14 +108,23 @@ executables: []
122
108
  extensions: []
123
109
  extra_rdoc_files: []
124
110
  files:
111
+ - CHANGELOG.md
112
+ - LICENSE
113
+ - README.md
125
114
  - lib/codecov.rb
115
+ - lib/codecov/configuration.rb
126
116
  - lib/codecov/formatter.rb
127
117
  - lib/codecov/uploader.rb
128
118
  - lib/codecov/version.rb
129
119
  homepage: https://github.com/codecov/codecov-ruby
130
120
  licenses:
131
121
  - MIT
132
- metadata: {}
122
+ metadata:
123
+ bug_tracker_uri: https://github.com/codecov/codecov-ruby/issues
124
+ changelog_uri: https://github.com/codecov/codecov-ruby/blob/v0.5.2/CHANGELOG.md
125
+ documentation_uri: http://www.rubydoc.info/gems/codecov/0.5.2
126
+ homepage_uri: https://github.com/codecov/codecov-ruby
127
+ source_code_uri: https://github.com/codecov/codecov-ruby
133
128
  post_install_message:
134
129
  rdoc_options: []
135
130
  require_paths: