CI Integration / Uploader
Integrating code coverage reporting into your CI pipeline ensures that coverage data is consistently collected and reported for every build.
Qlty is compatible with every major CI provider, and offers specific workflow support for GitHub (via a GitHub Action) and Circle CI (via an Orb).
CI Provider Integration
GitHub Actions
Use Qlty’s official GitHub Action for the simplest integration.
Using OIDC (Recommended)
Using a Coverage Token
CircleCI
Qlty offers a CircleCI Orb for easy integration.
Using the Orb
Add the Qlty orb to your .circleci/config.yml
:
Manual Integration
If you prefer not to use the orb:
Travis CI
Add Qlty coverage reporting to your .travis.yml
:
Make sure to add your QLTY_COVERAGE_TOKEN
in the Travis CI repository settings.
GitLab CI
Add coverage reporting to your .gitlab-ci.yml
:
Add your QLTY_COVERAGE_TOKEN
as a CI/CD variable in your GitLab project settings.
Buildkite
Add the following steps to your pipeline.yml
:
Manual Integration
The Qlty CLI coverage sub-commands leverage as much information from its environment as possible to ease integration. This includes environment variables as well as git metadata from the current working directory. However, sometimes Qlty is run without access to one or both of these. In these cases, customers must supply command line arguments to coverage publish
to replace what otherwise would come from the environment. These are referred to as “overrides” because they also override the values, if any, detected from the environment.
Which of these are necessary depends on your environment — when running qlty coverage publish
, the command will error with which overrides are required if it’s unable to detect them from the environment.
Reference Overrides
When publishing coverage, Qlty associates the coverage data with a single reference. The reference can be one of:
- a branch
- a pull request
- a git tag
When running in a CI workflow, qlty
is often able to determine the reference from environment variables provided by the CI vendor. Without this, users must provide one of the following to help Qlty construct the appropriate reference:
- pull request:
--override-pr-number <PR_NUMBER>
- branch:
--override-branch <BRANCH_NAME>
(can be used alongside--override-pr-number
) - git tag:
--override-git-tag <TAG_NAME>
(cannot be combined with either--override-pr-number
or--override-branch
)
Commit SHA Override
A commit sha is always required when sending coverage data to Qlty.sh. Similarly, this can be manually specified with:
--override-commit-sha <COMMIT_SHA>
Commit Time Override
A timestamp associated with the commit is also required. This can be specified with:
--override-commit-time <OVERRIDE_COMMIT_TIME>
The commit time can be a Unix timestamp (seconds since epoch) or a date in RFC3339/ISO8601 format.
Examples
Advanced CI Configuration
Parallelized Tests
When running tests in parallel, you’ll need to merge the coverage reports before uploading. Qlty supports both client-side and server-side merging.
Client-side Merging
Collect all coverage reports into a single location and upload them together:
Server-side Merging
Upload each part separately and specify the total number of parts:
Learn more about Coverage Merging.
Multiple Test Suites
If you have different types of tests (unit, integration, e2e), you can track them separately using coverage tags:
Learn more about Coverage Tags.
CI Provider Detection
Qlty automatically detects and extracts metadata from these CI providers:
- GitHub Actions
- CircleCI
- Travis CI
- GitLab CI
- Buildkite
- Codefresh
- Semaphore
If your CI provider is not listed above, double check our Qlty repository to see if an implementation has been added recently (and let us know so we can update our docs).
If your CI provider is not support, you’ll need to manually provide the following required arguments to qlty coverage publish
:
--override-branch
--override-commit
--override-build-id
Troubleshooting
Common Issues
- Authentication failures: Check that your token is correctly set as an environment variable
- Report format not recognized: Make sure you’re using a supported coverage format
- Path mismatches: Use the
--strip-prefix
and--add-prefix
options to fix file paths - Missing metadata: Use
--override-branch
,--override-commit
and--override-build-id
if CI detection fails
See Also
- Coverage Merging - Combine multiple coverage reports
- Coverage Tags - Track different test suites separately