codecov 0.4.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a56df245cb4eb2c44db6415aa240cb5275be7200974612f875c4c0d63c4c0538
4
- data.tar.gz: 8d506d9afb7752ba7d2de41e0d81cbfefb33c4c9b6cb12b822778c170be1b85c
3
+ metadata.gz: 6ed0ca48c3dd780cf5a2251488549059b08aab513a84d8f8b51b71bcee4a240f
4
+ data.tar.gz: 7e2326b00a7aeaf5cbe1367274c7a8bde56bfe4da3745512db77f8036f6a4132
5
5
  SHA512:
6
- metadata.gz: 21ab3799a0d563047fb5f38cefd0105ea4439defac9856d3509257af0c65ce3910864c3f5b28e49bc1e56a2eb90ef4aec9e11efe330c33e0832e81e2b27202f8
7
- data.tar.gz: 2c0a3e8a9705d1d040ee9b4f6fc6b6a0fcba7c5b69e4d23b2c07c8911e1cb36290b24c836d77f456cbacb15e8881874596bfc67d10fa657368eb627d886bfd85
6
+ metadata.gz: 26f458c90911e47e9ad85134c2bf1eb9be040397ce2c0e8ad4618da9ae0516220614d41621e22fb7940cd4688341cf15ded16bec46cc5912ee134e55704ba6c3
7
+ data.tar.gz: 164af1f8824b609f30a14471fd22699a4d3e7ea890ba7318e25b5302be3295baca7d69d152118748d1b638643b3753c3880cb55bdf4aea4e15c684697710be64
data/CHANGELOG.md ADDED
@@ -0,0 +1,136 @@
1
+ ### `0.6.0`
2
+ - #145 Fixes issue with nil URI and provides more token information
3
+
4
+ ### `0.5.2`
5
+ - #141 Add Cirrus CI support
6
+
7
+ ### `0.5.1`
8
+ - #138 Update pass_ci_if_error flag
9
+
10
+ ### `0.5.0`
11
+ - #137 Place uploader in try/rescue block and add pass_ci_if_error flag
12
+
13
+ ### `0.4.3`
14
+ - #135 Shorten coverage message on formatter
15
+
16
+ ### `0.4.2`
17
+ - #134 Wrap file creation in try/catch
18
+
19
+ ### `0.4.1`
20
+ - #133 Write down to file when using the formatter
21
+
22
+ ### `0.4.0`
23
+ - #130 Split uploader from formatter
24
+
25
+ ### `0.3.0`
26
+ - #124 Ruby 3.0 support
27
+ - #125 open simplecov requirement to 0.21.x
28
+
29
+ ### `0.2.15`
30
+ - #118 Include codecov/version in the gem
31
+
32
+ ### `0.2.14`
33
+ - #107 Add EditorConfig file
34
+ - #113 Return version constant, don't duplicate version value
35
+ - #117 Update simplecov dependency versions
36
+
37
+ ### `0.2.13`
38
+ - [#105](https://github.com/codecov/codecov-ruby/pull/105) Remove unnecessary dependency for ruby standard gem
39
+ - [#110](https://github.com/codecov/codecov-ruby/pull/110) Fix GitHub Actions
40
+ - [#111](https://github.com/codecov/codecov-ruby/pull/111) Fix branch name detection for GitHub Actions CI
41
+
42
+ ### `0.2.12`
43
+ - [#102](https://github.com/codecov/codecov-ruby/pull/102) Fix value of params[:pr] when useing CodeBuild
44
+
45
+ ### `0.2.11`
46
+ - Add vendor/ to invalid directories
47
+
48
+ ### `0.2.10`
49
+ - Adds better logging on error cases
50
+ - Add more invalid directories in the network
51
+
52
+ ### `0.2.9`
53
+ - Remove `String` specific colors
54
+ - Add support for Codebuild CI
55
+
56
+ ### `0.2.8`
57
+ - Remove `colorize` dependency
58
+
59
+ ### `0.2.7`
60
+ - Fix for enterprise users unable to upload using the v4 uploader
61
+
62
+ ### `0.2.6`
63
+ - Fix issue with `push` events on GitHub Actions
64
+
65
+ ### `0.2.5`
66
+ - Revert single use of VERSION
67
+
68
+ ### `0.2.4`
69
+ - Adds support for GitHub Actions CI
70
+
71
+ ### `0.2.3`
72
+ - Support uploads for jruby 9.1 and 9.2
73
+
74
+ ### `0.2.2`
75
+ - Handle SocketError and better error handling of v4 failures
76
+
77
+ ### `0.2.1`
78
+ - Properly handle 400 cases when using the v4 endpoint
79
+
80
+ ### `0.2.0`
81
+ - move to the v4 upload endpoint with the v2 as a fallback
82
+
83
+ ### `0.1.20`
84
+ - fix critical upload issues on V2 endpoint
85
+
86
+ ### `0.1.19`
87
+ - fix colorize
88
+
89
+ ### `0.1.18`
90
+ - refactor and move to use v2 endpoint
91
+ - use Timeout::Error
92
+
93
+ ### `0.1.17`
94
+ - refactor upload method and add more logging
95
+
96
+ ### `0.1.10`
97
+ - update numerous ci environments
98
+ - dont fail if cannot upload to codecov
99
+
100
+ ### `0.1.3`
101
+ - add buildkite
102
+
103
+ ### `0.1.2`
104
+ - add slug argument
105
+ - use slug for uploading
106
+ - add Accept to uploads
107
+
108
+ ### `0.1.1`
109
+ - fix #6, thanks @justmatt
110
+ - add semaphore thread number
111
+
112
+ ### `0.1.0`
113
+ - added more CircleCI env
114
+
115
+ ### `0.0.11`
116
+ - send AppVeyor pr# with reports
117
+
118
+ ### `0.0.10`
119
+ - fix AppVeyor for public repos
120
+
121
+ ### `0.0.9`
122
+ - remove tmp.json creation
123
+
124
+ ### `0.0.8`
125
+ - added more jenkins environment references
126
+
127
+ ### `0.0.7`
128
+ - added GitLab CI Runner support
129
+
130
+ ### `0.0.5`
131
+ - added line messages by @coderanger
132
+ - fixed skip lines during reporting by @coderanger
133
+
134
+ ### `0.0.4`
135
+ - added more test
136
+ - 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
@@ -59,7 +59,6 @@ module Codecov
59
59
 
60
60
  invalid_directories = [
61
61
  'node_modules/',
62
- 'public/',
63
62
  'storage/',
64
63
  'tmp/',
65
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,16 +38,26 @@ class Codecov::Uploader
37
38
 
38
39
  display_header
39
40
  ci = detect_ci
40
- response = upload_to_codecov(ci, report)
41
- if response == false
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
+
52
+ net_blockers(:on) if disable_net_blockers
53
+
54
+ unless response
42
55
  report['result'] = { 'uploaded' => false }
56
+ raise StandardError.new 'Could not upload reports to Codecov' unless ::Codecov.pass_ci_if_error
43
57
  return report
44
58
  end
45
-
46
59
  report['result'] = JSON.parse(response)
47
60
  handle_report_response(report)
48
-
49
- net_blockers(:on) if disable_net_blockers
50
61
  report
51
62
  end
52
63
 
@@ -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')
@@ -115,6 +128,9 @@ class Codecov::Uploader
115
128
  end
116
129
 
117
130
  def self.build_params(ci)
131
+ puts [red('x>'), 'No token specified or token is empty'].join(' ') if
132
+ ENV['CODECOV_TOKEN'].nil? || ENV['CODECOV_TOKEN'].empty?
133
+
118
134
  params = {
119
135
  'token' => ENV['CODECOV_TOKEN'],
120
136
  'flags' => ENV['CODECOV_FLAG'] || ENV['CODECOV_FLAGS'],
@@ -178,18 +194,41 @@ class Codecov::Uploader
178
194
  params[:pr] = ENV['CIRCLE_PR_NUMBER']
179
195
  params[:branch] = ENV['CIRCLE_BRANCH']
180
196
  params[:commit] = ENV['CIRCLE_SHA1']
197
+ when CIRRUS
198
+ # https://cirrus-ci.org/guide/writing-tasks/#environment-variables
199
+ params[:branch] = ENV['CIRRUS_BRANCH']
200
+ params[:build] = ENV['CIRRUS_BUILD_ID']
201
+ params[:build_url] = "https://cirrus-ci.com/tasks/#{ENV['CIRRUS_TASK_ID']}"
202
+ params[:commit] = ENV['CIRRUS_CHANGE_IN_REPO']
203
+ params[:job] = ENV['CIRRUS_TASK_NAME']
204
+ params[:pr] = ENV['CIRRUS_PR']
205
+ params[:service] = 'cirrus-ci'
206
+ params[:slug] = ENV['CIRRUS_REPO_FULL_NAME']
181
207
  when CODEBUILD
182
208
  # https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
209
+ # To use CodePipeline as CodeBuild source which sets no branch and slug variable:
210
+ #
211
+ # 1. Set up CodeStarSourceConnection as source action provider
212
+ # https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodestarConnectionSource.html
213
+ # 2. Add a Namespace to your source action. Example: "CodeStar".
214
+ # https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-variables.html#reference-variables-concepts-namespaces
215
+ # 3. Add these environment variables to your CodeBuild action:
216
+ # - CODESTAR_BRANCH_NAME: #{CodeStar.BranchName}
217
+ # - CODESTAR_FULL_REPOSITORY_NAME: #{CodeStar.FullRepositoryName} (optional)
218
+ # https://docs.aws.amazon.com/codepipeline/latest/userguide/action-reference-CodeBuild.html#action-reference-CodeBuild-config
219
+ #
220
+ # PRs are not supported with CodePipeline.
183
221
  params[:service] = 'codebuild'
184
- params[:branch] = ENV['CODEBUILD_WEBHOOK_HEAD_REF'].split('/')[2]
222
+ params[:branch] = ENV['CODEBUILD_WEBHOOK_HEAD_REF']&.split('/')&.[](2) || ENV['CODESTAR_BRANCH_NAME']
185
223
  params[:build] = ENV['CODEBUILD_BUILD_ID']
186
224
  params[:commit] = ENV['CODEBUILD_RESOLVED_SOURCE_VERSION']
187
225
  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']
226
+ params[:slug] = ENV['CODEBUILD_SOURCE_REPO_URL']&.match(/.*github.com\/(?<slug>.*).git/)&.[]('slug') || ENV['CODESTAR_FULL_REPOSITORY_NAME']
227
+ params[:pr] = if ENV['CODEBUILD_SOURCE_VERSION'] && !(ENV['CODEBUILD_INITIATOR'] =~ /codepipeline/)
190
228
  matched = ENV['CODEBUILD_SOURCE_VERSION'].match(%r{pr/(?<pr>.*)})
191
229
  matched.nil? ? ENV['CODEBUILD_SOURCE_VERSION'] : matched['pr']
192
230
  end
231
+ params[:build_url] = ENV['CODEBUILD_BUILD_URL']
193
232
  when CODESHIP
194
233
  # https://www.codeship.io/documentation/continuous-integration/set-environment-variables/
195
234
  params[:service] = 'codeship'
@@ -415,6 +454,12 @@ class Codecov::Uploader
415
454
 
416
455
  reports_url = response.body.lines[0]
417
456
  s3target = response.body.lines[1]
457
+
458
+ if s3target.nil? || s3target.empty?
459
+ puts red(response.body)
460
+ return false
461
+ end
462
+
418
463
  puts [green('-> '), 'Uploading to'].join(' ')
419
464
  puts s3target
420
465
 
@@ -521,3 +566,6 @@ class Codecov::Uploader
521
566
  str.nil? ? '' : "\e[32m#{str}\e[0m"
522
567
  end
523
568
  end
569
+
570
+ require_relative 'configuration'
571
+ Codecov.extend Codecov::Configuration
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Codecov
4
- VERSION = '0.4.3'
4
+ VERSION = '0.6.0'
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.3
4
+ version: 0.6.0
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-02-04 00:00:00.000000000 Z
12
+ date: 2021-08-18 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.6.0/CHANGELOG.md
125
+ documentation_uri: http://www.rubydoc.info/gems/codecov/0.6.0
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: