Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include test coverage results in GitHub Action CI script #1148

Open
dondi opened this issue Nov 13, 2024 · 3 comments
Open

Include test coverage results in GitHub Action CI script #1148

dondi opened this issue Nov 13, 2024 · 3 comments
Assignees

Comments

@dondi
Copy link
Owner

dondi commented Nov 13, 2024

In addition to running tests, we should start recapturing coverage results from the tests (formerly handled by Coveralls) and include this in the script as well. Per #1146, once we have coverage captured, it would be good to also include these results in the README badge

@akaiap
Copy link
Collaborator

akaiap commented Nov 20, 2024

  1. I will modify the Github Actions workflow to generate coverage reports
  • run: npm test -- --coverage --coverageReporters=text-lcov | coveralls env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} Need to confirm coveralls account in repo secrets
  1. Update README file
  • [![Coverage Status](https://coveralls.io/repos/github/<OWNER>/<REPO>/badge.svg?branch=master)](https://coveralls.io/github/<OWNER>/<REPO>?branch=master)
  • Test Test Test

@dondi
Copy link
Owner Author

dondi commented Nov 20, 2024

Instructions look good; learning about secrets systems comes with the territory so is a good aspect of these tickets

@akaiap
Copy link
Collaborator

akaiap commented Dec 4, 2024

What I have done so far

  • Updated the scripts in mocha
  • Did some tested and updated mocha's version.

-coverage: Uses nyc with mocha to run tests and collect coverage data.
coveralls: Generates a coverage report in LCOV format and pipes it to coveralls.
  • After removing Istanbul and installed I did some testing using npm run coverage and npm run coveralls
  • and success ! Screenshot 2024-12-04 at 12 30 13 PM
  • However, adding the coverage badge can get complicated due to GitHub "secrets." These secrets are admin tokens for Coveralls, and the safest approach is to avoid committing the token.

next steps to get the token:
Sign in to Coveralls.io with GRNSight account.
Enable repository if not already active.
Navigate to the repository's settings on Coveralls.
Copy the Repo Token provided.
Add the Token to GitHub Repository Secrets:

Click on Settings > Secrets and variables > Actions.
Click on New repository secret.
Name the secret COVERALLS_REPO_TOKEN.
Paste the token you copied from Coveralls.
Save the secret.

This way this token will not be pushed to the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants