codecov / codecov-ruby

Ruby uploader for Codecov
https://codecov.io
MIT License
73 stars 82 forks source link

fix crash and support CodeBuild under CodePipeline #131

Closed klausbadelt closed 3 years ago

klausbadelt commented 3 years ago

CodeBuild under CodePipeline sets environment variables differently, causing Formatter SimpleCov::Formatter::Codecov failed with NoMethodError: undefined methodsplit' for nil:NilClass`. This PR fixes that.

Branch name and slug are supported too, but need some setup. These instructions are included in the source. (I couldn't a home for these elsewhere):

CodePipeline with CodeBuild

To setup branch and slug with CodePipeline as CodeBuild source:

  1. Set up CodeStarSourceConnection as source action provider See AWS CodePipeline CodeStarConnection Reference.
  2. Add a Namespace to your source action. Example: "CodeStar" See AWS CodePipeline Namespaces Reference.
  3. Add these environment variables to your CodeBuild action:
    • CODESTAR_BRANCH_NAME: set to #{GitHub.BranchName}
    • CODESTAR_FULL_REPOSITORY_NAME: set to #{GitHub.FullRepositoryName} (optional) See AWS CodePipeline Action Reference.

(Uploading PR number support is unfortunately not included nor easily possible IMHO).

codecov[bot] commented 3 years ago

Codecov Report

Merging #131 (8b7b0ef) into master (e0ff57f) will increase coverage by 0.02%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
+ Coverage   91.84%   91.86%   +0.02%     
==========================================
  Files           3        3              
  Lines         368      369       +1     
==========================================
+ Hits          338      339       +1     
  Misses         30       30              
Impacted Files Coverage Δ
lib/codecov/uploader.rb 91.29% <100.00%> (+0.02%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e0ff57f...8b7b0ef. Read the comment docs.