codecov 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codecov.rb +4 -4
  3. data/test/test_codecov.rb +23 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0935d5766e38b05f8e3c567c1b16dfd7763902ac06073eabb8a3dc49768fec31'
4
- data.tar.gz: 3a97f5b053e2e5a934fbe5fb5f13401d0c6befed9e20d7d9ca53990469946c48
3
+ metadata.gz: 8b2e67c7bb37041adf9adb9dbe2fd8f9c2966131d338961785a29b25090e7206
4
+ data.tar.gz: 2ada93e046953b7e77397831259a21fcaef09012f4ea0c2c4584668b080d68a6
5
5
  SHA512:
6
- metadata.gz: 7fd075c6ec939eb9cd895c24d7e96199bb2fc4a501219c7af6f8ada9e0242f8cccb841b06d7c179c10bf5716ad08b41a101a50ed8db56c90cfe0112fb4f50dc5
7
- data.tar.gz: 7db5f6d020b1a71cff306b11ef7a4304e5606b691264cb66015b1c11a9254c0f7cac7f8222d4f4ff1c03c55484a1548b1c09d366909ba7ceb8e50951d083fa5c
6
+ metadata.gz: faf56288e9f75ee77f230da561da1ee87e3305fa7220e4b5962e2011e7f7d8c1f3c1a234a386ac698b00ad8999f500787f6b218c78c9009cb25bc096c056093c
7
+ data.tar.gz: 233cbebb75102d82b62daf1087a490493ee3cef84de7e91163bc8c5040076f2f1798ebde32aa7971c2234c306adcc13c7a3abcc1929489c1aba124a319f195cb
@@ -8,7 +8,7 @@ require 'colorize'
8
8
  require 'zlib'
9
9
 
10
10
  class SimpleCov::Formatter::Codecov
11
- VERSION = '0.2.5'
11
+ VERSION = '0.2.6'
12
12
 
13
13
  ### CIs
14
14
  RECOGNIZED_CIS = [
@@ -178,9 +178,9 @@ class SimpleCov::Formatter::Codecov
178
178
  when GITHUB
179
179
  # https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
180
180
  params[:service] = 'github-actions'
181
- params[:branch] = ENV['GITHUB_HEAD_REF'] || ENV['GITHUB_REF'].sub('refs/heads/', '')
182
- # PR refs are in the format: refs/pull/7/merge
183
- params[:pr] = ENV['GITHUB_REF'].split('/')[2] if ENV['GITHUB_HEAD_REF']
181
+ params[:branch] = ENV['GITHUB_HEAD_REF'] || ENV['GITHUB_REF'].sub('refs/head/', '')
182
+ # PR refs are in the format: refs/pull/7/merge for pull_request events
183
+ params[:pr] = ENV['GITHUB_REF'].split('/')[2] unless ENV['GITHUB_HEAD_REF'].nil? || ENV['GITHUB_HEAD_REF'].empty?
184
184
  params[:slug] = ENV['GITHUB_REPOSITORY']
185
185
  params[:build] = ENV['GITHUB_RUN_ID']
186
186
  params[:commit] = ENV['GITHUB_SHA']
@@ -425,9 +425,29 @@ class TestCodecov < Minitest::Test
425
425
  assert_equal('f881216b-b5c0-4eb1-8f21-b51887d1d506', result['params']['token'])
426
426
  end
427
427
 
428
- def test_github
428
+ def test_github_pull_request
429
429
  ENV['CI'] = 'true'
430
430
  ENV['GITHUB_ACTIONS'] = 'true'
431
+ ENV['GITHUB_HEAD_REF'] = 'patch-2'
432
+ ENV['GITHUB_REF'] = 'refs/pull/7/merge'
433
+ ENV['GITHUB_REPOSITORY'] = 'codecov/ci-repo'
434
+ ENV['GITHUB_RUN_ID'] = '1'
435
+ ENV['GITHUB_SHA'] = 'c739768fcac68144a3a6d82305b9c4106934d31a'
436
+ ENV['CODECOV_TOKEN'] = 'f881216b-b5c0-4eb1-8f21-b51887d1d506'
437
+ result = upload
438
+ assert_equal('github-actions', result['params'][:service])
439
+ assert_equal('c739768fcac68144a3a6d82305b9c4106934d31a', result['params'][:commit])
440
+ assert_equal('codecov/ci-repo', result['params'][:slug])
441
+ assert_equal('1', result['params'][:build])
442
+ assert_equal('f881216b-b5c0-4eb1-8f21-b51887d1d506', result['params']['token'])
443
+ assert_equal('patch-2', result['params'][:branch])
444
+ assert_equal('7', result['params'][:pr])
445
+ end
446
+
447
+ def test_github_push
448
+ ENV['CI'] = 'true'
449
+ ENV['GITHUB_ACTIONS'] = 'true'
450
+ ENV['GITHUB_HEAD_REF'] = nil
431
451
  ENV['GITHUB_REF'] = 'refs/head/master'
432
452
  ENV['GITHUB_REPOSITORY'] = 'codecov/ci-repo'
433
453
  ENV['GITHUB_RUN_ID'] = '1'
@@ -439,6 +459,8 @@ class TestCodecov < Minitest::Test
439
459
  assert_equal('codecov/ci-repo', result['params'][:slug])
440
460
  assert_equal('1', result['params'][:build])
441
461
  assert_equal('f881216b-b5c0-4eb1-8f21-b51887d1d506', result['params']['token'])
462
+ assert_equal('master', result['params'][:branch])
463
+ assert_equal(false, result['params'].key?(:pr))
442
464
  end
443
465
 
444
466
  def test_gitlab
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codecov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - codecov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-06 00:00:00.000000000 Z
11
+ date: 2020-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - ">="
145
145
  - !ruby/object:Gem::Version
146
- version: '0'
146
+ version: '2.4'
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
149
  - - ">="