Learn R Programming

covr (version 4.0.0)

coveralls: Run covr on a package and upload the result to coveralls

Description

On GitHub Actions, use the official Coveralls action instead of this function: write the coverage with cobertura() and upload cobertura.xml with coverallsapp/github-action@v2. See the README for an example workflow. With branch coverage, upload the LCOV file written by lcov() instead, as the action reads which branches were taken from it.

Usage

coveralls(
  ...,
  coverage = NULL,
  repo_token = env_var("COVERALLS_TOKEN", "COVERALLS_REPO_TOKEN"),
  service_name = NULL,
  quiet = TRUE
)

Value

The response of Coveralls, parsed from JSON, invisibly. If Coveralls doesn't accept the upload, coveralls() throws an error of class covr_coveralls_error with the HTTP status and the response of Coveralls in its message.

Arguments

...

arguments passed to package_coverage()

coverage

an existing coverage object to submit, if NULL, package_coverage() will be called with the arguments from ...

repo_token

The secret repo token for your repository, found on your repository's page on Coveralls. The default is the environment variable COVERALLS_TOKEN, or if it is not set, COVERALLS_REPO_TOKEN, the name Coveralls uses for it. Coveralls requires a token (see https://docs.coveralls.io/api-jobs-endpoint). Without one ("" or NULL), only the CI service and job are submitted, which Coveralls rejects unless the CI service identifies the repository by itself. With a token, information about the git commit, branch and remote is also submitted.

service_name

The name of the CI service. If NULL, the environment variable CI_NAME is used if it is set, otherwise the CI service is detected from the environment, e.g. ‘github’ on GitHub Actions and ‘travis-ci’ on Travis CI. Outside a supported CI service it is ‘local’.

quiet

if FALSE, print the output of running the tests (see package_coverage(), which is called when coverage is NULL) and the coverage before submission.

Details

With branch coverage (see covr.branch_coverage), each source file sent to Coveralls also has its branches: the line, block, branch and count of each branch, as in lcov(). A branch that was never taken has a count of zero.

The CI service, job, pull request, branch and commit are detected from the environment variables of the services codecov() supports. Anywhere else, the branch, commit and remote are looked up from the local git repository. The environment variables CI_BRANCH and CI_REMOTE override the detected branch and remote.