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

Support Heroku CI #28

Merged
merged 2 commits into from
Oct 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/codecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,14 @@ def format(result)
params[:build_url] = "#{ENV['SYSTEM_TEAMFOUNDATIONSERVERURI']}/#{ENV['SYSTEM_TEAMPROJECT']}/_build/results?buildId=#{ENV['BUILD_BUILDID']}"
params[:commit] = ENV['BUILD_SOURCEVERSION']
params[:slug] = ENV['BUILD_REPOSITORY_ID']

# Heroku CI
# ---------
elsif ENV['HEROKU_TEST_RUN_ID']
params[:service] = 'heroku'
params[:branch] = ENV['HEROKU_TEST_RUN_BRANCH']
params[:build] = ENV['HEROKU_TEST_RUN_ID']
params[:commit] = ENV['HEROKU_TEST_RUN_COMMIT_VERSION']
end

if params[:branch] == nil
Expand Down
16 changes: 16 additions & 0 deletions test/test_codecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ def teardown
ENV['GIT_BRANCH'] = nil
ENV['GIT_COMMIT'] = nil
ENV['GITLAB_CI'] = nil
ENV['HEROKU_TEST_RUN_ID'] = nil
ENV['HEROKU_TEST_RUN_BRANCH'] = nil
ENV['HEROKU_TEST_RUN_COMMIT_VERSION'] = nil
ENV['JENKINS_URL'] = nil
ENV['MAGNUM'] = nil
ENV['PULL_REQUEST'] = nil
Expand Down Expand Up @@ -394,6 +397,19 @@ def test_azure_pipelines
assert_equal("owner/repo", result['params'][:slug])
assert_equal('f881216b-b5c0-4eb1-8f21-b51887d1d506', result['params']['token'])
end
def test_heroku
ENV['HEROKU_TEST_RUN_ID'] = "454f5dc9-afa4-433f-bb28-84678a00fd98"
ENV['HEROKU_TEST_RUN_BRANCH'] = "master"
ENV['HEROKU_TEST_RUN_COMMIT_VERSION'] = "743b04806ea677403aa2ff26c6bdeb85005de658"
ENV['CODECOV_TOKEN'] = 'f881216b-b5c0-4eb1-8f21-b51887d1d506'

result = upload
assert_equal("heroku", result['params'][:service])
assert_equal("743b04806ea677403aa2ff26c6bdeb85005de658", result['params'][:commit])
assert_equal("454f5dc9-afa4-433f-bb28-84678a00fd98", result['params'][:build])
assert_equal("master", result['params'][:branch])
assert_equal('f881216b-b5c0-4eb1-8f21-b51887d1d506', result['params']['token'])
end

def test_filenames_are_shortened_correctly
formatter = SimpleCov::Formatter::Codecov.new
Expand Down