DryCreations / pdfproject

Adapting starter code that uses itext7, into a program that can draw onto pdfs, and export files to pdf
1 stars 3 forks source link

Action58: Added JaCoCo code coverage functionality #52

Closed charleswitherspoon closed 3 years ago

charleswitherspoon commented 3 years ago

List Any Relevant Actions or Tasks

Actions

Action 58 - implement test coverage Action 31 - automated testing with GitHub

Tasks

N/A

Description of Changes

Added code coverage functionality and a sample test class.

Relevant Artifacts

Project Structure Code Coverage: project_structure_code_coverage

Detailed Code Coverage: detailed_code_coverage

JaCoCo Report Location: jacoco-report-artifact

JaCoCo Report HTML File: jacoco-report-html-example

Other Comments

The "Run Tests" GitHub action has been modified to generate a JaCoCo coverage badge at .github/badges/jacoco.svg as well as a code coverage zip file that can be downloaded. In the zip is an HTML file that details the code coverage. The zip file can be found in the artifacts section of the "Run Tests" GitHub action.

PythonProgramm3r commented 3 years ago

@charleswitherspoon should we get together ( maybe once senior design class is done tomorrow ) to discuss merging where our test files are in the directory?

DryCreations commented 3 years ago

It's a really good idea to generate this badge so that code coverage results can be viewed easily. I noticed that the most recent commit https://github.com/DryCreations/pdfproject/pull/52/commits/25f31dc1751f81594c77194617a98ac59f877dab doesn't trigger any actions, and therefore we have to click on previous commits to make sure the validator passes. Is this because it was done by a github action?

Would it make more sense to have a dedicated branch to store badges on, rather than pushing them to the same branch the commit was made on?

I also am not sure how this will act when it's pushed to main, main is a protected branch, I don't it will have permission to push this directly to main when this action is triggered.

charleswitherspoon commented 3 years ago

It's a really good idea to generate this badge so that code coverage results can be viewed easily. I noticed that the most recent commit 25f31dc doesn't trigger any actions, and therefore we have to click on previous commits to make sure the validator passes. Is this because it was done by a github action?

Yes, I noticed that as well. I'll see if there's a way to resolve that because I think this could be an issue if the validator fails but testing/code coverage doesn't.

Would it make more sense to have a dedicated branch to store badges on, rather than pushing them to the same branch the commit was made on?

This could be a solution. Another one might be to trigger the JaCoCo generation on pull request approval/merge if possible.

I also am not sure how this will act when it's pushed to main, main is a protected branch, I don't it will have permission to push this directly to main when this action is triggered.

I think it should avoid that issue as long as it's pushed to the PR branch instead of main and then merged into main, but this should be investigated as well.