Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support Coveralls parallel runs #523

Merged
merged 3 commits into from
Oct 20, 2022
Merged
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
22 changes: 17 additions & 5 deletions lib/slather/coverage_service/coveralls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,21 @@ def github_build_url
end
private :github_build_url

def is_parallel
ENV['IS_PARALLEL'] != nil
end
private :is_parallel

def github_job_name
ENV['GITHUB_JOB']
end
private :github_job_name

def coveralls_coverage_data
if ci_service == :travis_ci || ci_service == :travis_pro
if travis_job_id
if ci_service == :travis_ci

if coverage_access_token.to_s.strip.length > 0
raise StandardError, "Access token is set. Uploading coverage data for public repositories doesn't require an access token."
end
Expand All @@ -198,7 +208,7 @@ def coveralls_coverage_data
:service_name => "travis-ci",
:source_files => coverage_files.map(&:as_json)
}.to_json
elsif ci_service == :travis_pro
elsif ci_service == :travis_pro

if coverage_access_token.to_s.strip.length == 0
raise StandardError, "Access token is not set. Uploading coverage data for private repositories requires an access token."
Expand Down Expand Up @@ -286,7 +296,9 @@ def coveralls_coverage_data
:source_files => coverage_files.map(&:as_json),
:service_build_url => github_build_url,
:service_pull_request => github_pull_request,
:git => github_git_info
:git => github_git_info,
:parallel => is_parallel,
:flag_name => github_job_name
}.to_json
else
raise StandardError, "Environment variable `GITHUB_RUN_ID` not set. Is this running on github build?"
Expand Down Expand Up @@ -332,8 +344,8 @@ def post

curl_result = `curl -s --form json_file=@#{f.path} #{coveralls_api_jobs_path}`

if curl_result.is_a? String
curl_result_json = JSON.parse(curl_result)
if curl_result.is_a? String
curl_result_json = JSON.parse(curl_result)

if curl_result_json["error"]
error_message = curl_result_json["message"]
Expand Down