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

Enable code coverage analysis locally and in CI #830

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

rwood-moz
Copy link
Contributor

@rwood-moz rwood-moz commented Jan 21, 2025

Enable code coverage analysis (for the backend tests) both when running the tests locally as well as in CI. See the updated README file for more information.

Thanks @MelissaAutumn as you already had the groundwork for this in the repo! I am just updating the README and enabling the code coverage tool to run in CI.

@rwood-moz rwood-moz linked an issue Jan 21, 2025 that may be closed by this pull request
@rwood-moz rwood-moz added the testing Issues specific to automated testing label Jan 21, 2025
@rwood-moz rwood-moz force-pushed the testing/code-coverage branch from e95c299 to 83fa29b Compare January 21, 2025 20:51
@rwood-moz rwood-moz force-pushed the testing/code-coverage branch from 83fa29b to 786fe75 Compare January 21, 2025 20:58
@rwood-moz rwood-moz force-pushed the testing/code-coverage branch from 786fe75 to 7651ef0 Compare January 21, 2025 21:00
@rwood-moz rwood-moz force-pushed the testing/code-coverage branch from 7651ef0 to c59a692 Compare January 21, 2025 21:03
@rwood-moz rwood-moz force-pushed the testing/code-coverage branch from c59a692 to e7308e4 Compare January 21, 2025 21:08
@rwood-moz rwood-moz force-pushed the testing/code-coverage branch from e7308e4 to 929ba0b Compare January 21, 2025 21:41
@rwood-moz
Copy link
Contributor Author

Got the code coverage report working both locally and in CI now \o/

Here's a link to a GHA validate-backend CI run and you can see the code coverage report:
https://github.com/thunderbird/appointment/actions/runs/12933592396/job/36072579769

Note: I am setting the continue-on-error: true flag for the generate code coverage report step because if the report fails or code coverage is under the threshold (70%) I don't want that to fail the entire workflow and block deployments.

Screenshot 2025-01-23 at 11 32 11 AM

@rwood-moz rwood-moz marked this pull request as ready for review January 23, 2025 16:36
Copy link
Member

@MelissaAutumn MelissaAutumn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Some minor things but nothing thats not a 2 second fix.

Do we have a way to view the coveeage level from the pr?

.github/workflows/validate.yml Outdated Show resolved Hide resolved
backend/README.md Outdated Show resolved Hide resolved
backend/README.md Show resolved Hide resolved
Copy link
Collaborator

@devmount devmount left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, thank you Rob!

@@ -137,19 +137,30 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version: '3.13'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This should fix some issues we had due to different python versions 👍🏻

@rwood-moz
Copy link
Contributor Author

Looks good! Some minor things but nothing thats not a 2 second fix.

Do we have a way to view the coveeage level from the pr?

There are some third-party github actions that allow just that - publish your code coverage results to a PR comment, i.e.:

https://github.com/marketplace/actions/python-coverage

However I'm not sure if we want to use third-party GHA that aren't certified by GitHub because of security; also it requires a separate github token also. Maybe something to consider in the future though!

@rwood-moz rwood-moz merged commit da2e240 into main Jan 23, 2025
4 checks passed
@rwood-moz rwood-moz deleted the testing/code-coverage branch January 23, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Issues specific to automated testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add code coverage analysis for unit and integration tests
3 participants