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 environment variable #250

Merged
merged 7 commits into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ julia:
- nightly

notifications:
email: false
webhooks: https://coveralls.io/webhook
email: false

script:
- julia --check-bounds=yes etc/travis-test.jl
- export COVERALLS_PARALLEL=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a reason to hold up this PR, just wondering, but: is there any reason to do it like this, and now how the README suggests to do i? I.e.,

env:
  global:
    - COVERALLS_PARALLEL=true

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just that it confuses testing to set it globally. We similarly don't use the suggested script either.

# submit coverage data, and collect new coverage data on that
- julia --code-coverage=user etc/travis-coverage.jl
# submit coverage data *again*, this time without code coverage
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,18 @@ When using Coverage.jl locally, over time a lot of `.cov` files can accumulate.
- C:\projects\julia\bin\julia -e "using Pkg; Pkg.add(\"Coverage\"); using Coverage; Coveralls.submit(process_folder())"
```

4. If you are uploading from multiple jobs, you'll need to tell Coveralls to merge the results after all CI jobs have completed. See https://docs.coveralls.io/parallel-build-webhook for general instructions.

For Travis, this can be achieved by adding the following to `.travis.yml`:

env:
global:
- COVERALLS_PARALLEL=true
notifications:
webhooks: https://coveralls.io/webhook



vtjnash marked this conversation as resolved.
Show resolved Hide resolved
## A note for advanced users

Coverage tracking in Julia is not yet quite perfect. One problem is that (at
Expand Down
4 changes: 4 additions & 0 deletions src/coveralls.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ module Coveralls
end

data = add_repo_token(data, local_env)
if get(ENV, "COVERALLS_PARALLEL", "false") == "true"
data["parallel"] = "true"
end
return data
end

Expand Down Expand Up @@ -181,6 +184,7 @@ module Coveralls
verbose && @info "Submitting data to Coveralls..."
req = HTTP.post("https://coveralls.io/api/v1/jobs", HTTP.Form(makebody(data)))
verbose && @debug "Result of submission:\n" * String(req.body)
nothing
end

# adds the repo token to the data
Expand Down
9 changes: 7 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -602,26 +602,31 @@ end
@test request["repo_token"] == "token_name_1"
@test request["service_job_id"] == "my_job_id"
@test request["service_name"] == "appveyor"
@test !haskey(request, "parallel")
end

# test Travis
withenv("TRAVIS" => "true",
"TRAVIS_JOB_ID" => "my_job_id") do
"TRAVIS_JOB_ID" => "my_job_id",
"COVERALLS_PARALLEL" => "true") do
request = Coverage.Coveralls.prepare_request(fcs, false)
@test request["repo_token"] == "token_name_1"
@test request["service_job_id"] == "my_job_id"
@test request["service_name"] == "travis-ci"
@test request["parallel"] == "true"
end

# test Jenkins
withenv("JENKINS" => "true",
"BUILD_ID" => "my_job_id",
"CI_PULL_REQUEST" => true) do
"CI_PULL_REQUEST" => true,
"COVERALLS_PARALLEL" => "not") do
my_git_info = Dict("remote_name" => "my_origin")
request = Coverage.Coveralls.prepare_request(fcs, false)
@test request["repo_token"] == "token_name_1"
@test request["service_job_id"] == "my_job_id"
@test request["service_name"] == "jenkins-ci"
@test !haskey(request, "parallel")

withenv("CI_PULL_REQUEST" => "false",
"GIT_BRANCH" => "my_remote/my_branch") do
Expand Down