Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #145 from codecov/0.6.0
Browse files Browse the repository at this point in the history
Bump version to 0.6.0
  • Loading branch information
drazisil-codecov authored Aug 18, 2021
2 parents a9988fb + 576d544 commit 6300976
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### `0.6.0`
- #145 Fixes issue with nil URI and provides more token information

### `0.5.2`
- #141 Add Cirrus CI support

Expand Down
17 changes: 13 additions & 4 deletions lib/codecov/uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def self.upload(report, disable_net_blockers = true)
response = false
end

if response == false
net_blockers(:on) if disable_net_blockers

unless response
report['result'] = { 'uploaded' => false }
raise StandardError.new 'Could not upload reports to Codecov' unless ::Codecov.pass_ci_if_error
return report
end

report['result'] = JSON.parse(response)
handle_report_response(report)

net_blockers(:on) if disable_net_blockers
report
end

Expand Down Expand Up @@ -128,6 +128,9 @@ def self.detect_ci
end

def self.build_params(ci)
puts [red('x>'), 'No token specified or token is empty'].join(' ') if
ENV['CODECOV_TOKEN'].nil? || ENV['CODECOV_TOKEN'].empty?

params = {
'token' => ENV['CODECOV_TOKEN'],
'flags' => ENV['CODECOV_FLAG'] || ENV['CODECOV_FLAGS'],
Expand Down Expand Up @@ -451,6 +454,12 @@ def self.upload_to_v4(url, report, query, query_without_token)

reports_url = response.body.lines[0]
s3target = response.body.lines[1]

if s3target.nil? || s3target.empty?
puts red(response.body)
return false
end

puts [green('-> '), 'Uploading to'].join(' ')
puts s3target

Expand Down
2 changes: 1 addition & 1 deletion lib/codecov/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Codecov
VERSION = '0.5.2'
VERSION = '0.6.0'
end
2 changes: 1 addition & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end
require_relative '../lib/codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov if ENV['CI'] == 'true'
Codecov.pass_ci_if_error = true
Codecov.pass_ci_if_error = false

require 'minitest/autorun'
require 'mocha/minitest'
Expand Down
11 changes: 9 additions & 2 deletions test/test_codecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ class TestCodecov < Minitest::Test
'CIRCLE_REPOSITORY_URL' => ENV['CIRCLE_REPOSITORY_URL'],
'CIRCLE_PR_NUMBER' => ENV['CIRCLE_PR_NUMBER'],
'CIRCLE_BRANCH' => ENV['CIRCLE_BRANCH'],
'CIRCLE_SHA1' => ENV['CIRCLE_SHA1']
'CIRCLE_SHA1' => ENV['CIRCLE_SHA1'],
'CODECOV_TOKEN' => ENV['CODECOV_TOKEN']
}
when Codecov::Uploader::GITHUB
{
'CODECOV_TOKEN' => ENV['CODECOV_TOKEN'],
'GITHUB_ACTIONS' => ENV['GITHUB_ACTIONS'],
'GITHUB_HEAD_REF' => ENV['GITHUB_HEAD_REF'],
'GITHUB_REF' => ENV['GITHUB_REF'],
Expand All @@ -30,6 +32,7 @@ class TestCodecov < Minitest::Test
}
when Codecov::Uploader::TRAVIS
{
'CODECOV_TOKEN' => ENV['CODECOV_TOKEN'],
'TRAVIS' => ENV['TRAVIS'],
'TRAVIS_BRANCH' => ENV['TRAVIS_BRANCH'],
'TRAVIS_COMMIT' => ENV['TRAVIS_COMMIT'],
Expand All @@ -39,7 +42,9 @@ class TestCodecov < Minitest::Test
'TRAVIS_JOB_ID' => ENV['TRAVIS_JOB_ID']
}
else
{}
{
'CODECOV_TOKEN' => ENV['CODECOV_TOKEN']
}
end.freeze

def url
Expand Down Expand Up @@ -109,6 +114,7 @@ def setup
ENV['CIRCLECI'] = nil
ENV['GITHUB_ACTIONS'] = nil
ENV['TRAVIS'] = nil
::Codecov.pass_ci_if_error = true
end

def teardown
Expand Down Expand Up @@ -237,6 +243,7 @@ def teardown
ENV['WORKSPACE'] = nil

REALENV.each_pair { |k, v| ENV[k] = v }
::Codecov.pass_ci_if_error = false
end

def test_git
Expand Down

0 comments on commit 6300976

Please sign in to comment.