Skip to content

UNMAINTAINED - Github Code Coverage Action. The code does not use any of your data.

License

Notifications You must be signed in to change notification settings

shravan097/codecoverage

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Coverage Status

Build Status

Code Coverage Annotation

Generate code coverage annotation in pull request within Github Action Workflow environment. No data is sent to an external server.

NOTE:

  • Test file and code file name should be same. (ie. index.ts should have test file named index.test.ts, the test file may exist in any directory)
  • You must invoke the function/class at least once.

Sample PR Annotation

Screen Shot 2022-06-26 at 7 11 21 PM

Inputs

Key Required Default Description
GITHUB_TOKEN yes - Github Token generated by Github Action workflow. You can pass this in as ${{secrets.GITHUB_TOKEN}}
LCOV_FILE_PATH yes - Location of Lcov.info file that was generatedcommand

Example

- name: Code Coverage Annotation Line by Line
  uses: shravan097/codecoverage@release/v0.5.1
  with:
    GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
    LCOV_FILE_PATH: "./coverage/lcov.info"

Code in Main

First, you'll need to have a reasonably modern version of node handy. This won't work with versions older than 9, for instance.

Install the dependencies

$ npm install

Build the typescript and package it for distribution

$ npm run build && npm run package

Run the tests ✔️

$ npm test
...

Publish to a distribution branch

Actions are run from GitHub repos so we will checkin the packed dist folder.

Then run ncc and push the results:

$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1

Note: We recommend using the --license option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! 🚀

See the versioning documentation

Validate

You can now validate the action by referencing ./ in a workflow in your repo (see test.yml)

uses: ./
with:
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  LCOV_FILE_PATH: "./coverage/lcov.info"

See the actions tab for runs of this action! 🚀

About

UNMAINTAINED - Github Code Coverage Action. The code does not use any of your data.

Resources

License

Stars

Watchers

Forks

Packages