- Notifications
You must be signed in to change notification settings - Fork65
GitHub Action to send your code coverage to CodeClimate
License
paambaati/codeclimate-action
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Important
CodeClimate has now been deprecated in favour of Qlty (read announcement post). Seehttps://docs.qlty.sh/migration/coverage to learn how to migrate to their new official GitHub Action workflow.
A GitHub action that publishes your code coverage toCode Climate.
This action requires that you set theCC_TEST_REPORTER_ID environment variable. You can find it under Repo Settings in your Code Climate project.
| Input | Default | Description |
|---|---|---|
coverageCommand | The actual command that should be executed to run your tests and capture coverage. | |
workingDirectory | Specify a custom working directory where the coverage command should be executed. | |
debug | false | Enable Code Coverage debug output when set totrue. |
coverageLocations | Locations to find code coverage as a multiline string. Each line should be of the form <location>:<type>.type can be any one ofclover, cobertura, coverage.py, excoveralls, gcov, gocov, jacoco, lcov, lcov-json, simplecov, xccov. See examples below. | |
prefix | undefined | See--prefix |
verifyDownload | true | Verifies the downloaded Code Climate reporter binary's checksum and GPG signature. SeeVerifying binaries |
verifyEnvironment | true | Verifies the current runtime environment (operating system and CPU architecture) is supported by the Code Climate reporter. Seelist of supported platforms |
batchSize | Batch size for source files (cc-test-reporter upload-coverage uses 500 by default) |
NoteIf you are a Ruby developer usingSimpleCov, other users have recommended installing an additional gem –
gem "simplecov_json_formatter"– this gem fixesjsonerror from the defaultcoverage/.resultset.jsonoutput from SimpleCov.
steps: -name:Test & publish code coverageuses:paambaati/codeclimate-action@v9.0.0env:CC_TEST_REPORTER_ID:<code_climate_reporter_id>with:coverageCommand:npm run coveragedebug:true
When you've already generated the coverage report in a previous step and wish to just upload the coverage data to Code Climate, you can leave out thecoverageCommand option.
steps: -name:Test & publish code coverageuses:paambaati/codeclimate-action@v9.0.0env:CC_TEST_REPORTER_ID:<code_climate_reporter_id>
This action supports basic glob patterns to search for files matching given patterns. It uses@actions/glob to expand the glob patterns.
steps: -name:Test & publish code coverageuses:paambaati/codeclimate-action@v9.0.0env:CC_TEST_REPORTER_ID:<code_climate_reporter_id>with:coverageCommand:yarn run coveragecoverageLocations:| ${{github.workspace}}/*.lcov:lcov
steps: -name:Test & publish code coverageuses:paambaati/codeclimate-action@v9.0.0env:# Set CC_TEST_REPORTER_ID as secret of your repoCC_TEST_REPORTER_ID:${{secrets.CC_TEST_REPORTER_ID}}JACOCO_SOURCE_PATH:"${{github.workspace}}/src/main/java"with:# The report file must be there, otherwise Code Climate won't find itcoverageCommand:mvn testcoverageLocations:${{github.workspace}}/target/site/jacoco/jacoco.xml:jacoco
Let's say you have a monorepo with two folders —client andserver, both with their own coverage folders and ayarn coverage script which runs Jest within both folders.
"scripts": {"coverage":"yarn client coverage && yarn server coverage"}
First be sure that paths in yourcoverage/lcov.info are correct; they should be either absolute or relative to theroot of the monorepo. Openlcov.info and search for any path. For example —
SF:src/server.tsIf you find arelative path like this (happens for Jest 25+), it's incorrect as it is relative to the sub-package. This can be fixed by configuring Jest to set the root of your monorepo —
// server/jest.config.jsmodule.exports={ ...coverageReporters:[['lcov',{projectRoot:'..'}]]...};
steps: -name:Test & publish code coverageuses:paambaati/codeclimate-action@v9.0.0env:CC_TEST_REPORTER_ID:${{secrets.CC_TEST_REPORTER_ID}}with:coverageCommand:yarn run coveragecoverageLocations:| ${{github.workspace}}/client/coverage/lcov.info:lcov ${{github.workspace}}/server/coverage/lcov.info:lcov
Example projects
About
GitHub Action to send your code coverage to CodeClimate
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.