• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GitHub Action to send your code coverage to CodeClimate

codeclimate-action

Test Coverage Build Status MIT License

A GitHub action that publishes your code coverage to Code Climate.

Warning

Please upgrade to v3.1.1 (or higher) immediately. v3.1.0 was recently broken inadverdently, and the only fix is to upgrade your action to v3.1.1 or higher. Please see #626 for more details.

Usage

This action requires that you set the CC_TEST_REPORTER_ID environment variable. You can find it under Repo Settings in your Code Climate project.

Inputs

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 to true.
coverageLocations Locations to find code coverage as a multiline string.
Each line should be of the form <location>:<type>.
type can be any one of clover, 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. See Verifying binaries

Example

steps:
  - name: Test & publish code coverage
    uses: paambaati/[email protected]
    env:
      CC_TEST_REPORTER_ID: <code_climate_reporter_id>
    with:
      coverageCommand: npm run coverage
      debug: true

Example with only upload

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 the coverageCommand option.

steps:
  - name: Test & publish code coverage
    uses: paambaati/[email protected]
    env:
      CC_TEST_REPORTER_ID: <code_climate_reporter_id>

Example with wildcard (glob) pattern

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 coverage
    uses: paambaati/[email protected]
    env:
      CC_TEST_REPORTER_ID: <code_climate_reporter_id>
    with:
      coverageCommand: yarn run coverage
      coverageLocations: |
        ${{github.workspace}}/*.lcov:lcov

Example with Jacoco

steps:
  - name: Test & publish code coverage
    uses: paambaati/[email protected]
    env:
      # Set CC_TEST_REPORTER_ID as secret of your repo
      CC_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 it
      coverageCommand: mvn test
      coverageLocations: ${{github.workspace}}/target/site/jacoco/jacoco.xml:jacoco

Example of multiple test coverages for monorepo with Jest

Let's say you have a monorepo with two folders β€”client and server, both with their own coverage folders and a yarn coverage script which runs Jest within both folders.

"scripts": {
  "coverage": "yarn client coverage && yarn server coverage"
}

First be sure that paths in your coverage/lcov.info are correct; they should be either absolute or relative to the root of the monorepo. Open lcov.info and search for any path. For example β€”

SF:src/server.ts

If you find a relative 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.js
module.exports = {
  ...
  coverageReporters: [['lcov', { projectRoot: '..' }]]
  ...
};
steps:
  - name: Test & publish code coverage
    uses: paambaati/[email protected]
    env:
      CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
    with:
      coverageCommand: yarn run coverage
      coverageLocations: |
        ${{github.workspace}}/client/coverage/lcov.info:lcov
        ${{github.workspace}}/server/coverage/lcov.info:lcov

Example projects

  1. paambaati/websight

  2. MartinNuc/coverage-ga-test

More Repositories

1

nodequiz

A kickass Quiz app designed to be run inside an organization - users can register and take a quiz everyday. Also features a full-fledged admin interface for adding questions.
JavaScript
31
star
2

express-api-helper

Simple API helper module for Express apps.
JavaScript
20
star
3

itunes-artwork

A simple API for searching the iTunes Artwork library built using Node.JS and Restify.
JavaScript
19
star
4

websight

πŸ•·A simple but *really* fast crawler built with Node.js & TypeScript
TypeScript
18
star
5

neon-js-sdk

TypeScript SDK for managing your Neon Serverless PostgreSQL projects
TypeScript
17
star
6

node-liftbridge

πŸŒ‰ Node.js client for Liftbridge
JavaScript
13
star
7

daily-dilbert

Simple scraper that picks up the day's Dilbert comic strip and sends it to an email list.
Python
5
star
8

rendering-at-scale

Public talk about how we at @Indix render webpages at scale.
CSS
3
star
9

pickyourtrade

⚑️A portfolio tracker built on Node, TypeScript, Vue/Buefy & SQLite3
HTML
3
star
10

pleer-scraper

A quick and dirty script that scrapes pleer.com's search results and lets you download MP3s.
Python
3
star
11

tfc-output-action

GitHub Action to fetch output variable values from Terraform Cloud
TypeScript
2
star
12

airtel-usage

Python script that finds your Airtel Broadband usage and sends a notification to OS X's notification center.
Python
2
star
13

scrappydoo-node

Crawl server & companion for Chrome extension https://github.com/paambaati/scrappydoo-chrome
HTML
2
star
14

scrappydoo-chrome

Data scrape helper & companion for crawl server https://github.com/paambaati/scrappydoo-node
JavaScript
1
star
15

mae

πŸ”₯Mesos app exporter for Prometheus
Python
1
star
16

burry-docker

🐳 Docker image for burry.sh
Dockerfile
1
star
17

bumplan

A simple program that finds the seating arrangement for passengers for a given custom airplane seat layout.
TypeScript
1
star
18

fold-backend-assignment

Assignment solution for Fold
TypeScript
1
star
19

sqlary

API server that exposes endpoints to modify and view salary information.
TypeScript
1
star