View reports in pull requests
Stoat can help you view HTML build reports generated as part of your build in a comment on your pull request.
Here's an example of a Stoat comment that links to various Java build reports generated by the latest build:
- Test results (JUnit, Jest, Mocha, pytest-html, etc.)
- Test coverage (JaCoCo, coverage.py, etc.)
- Static analysis (Checkstyle, PMD violations, etc.)
- API Docs (Swagger, ReDoc, etc.)
- Code Docs (Javadoc, pydoc, pdoc, etc.)
- ...and any other static HTML reports!
See a real build that generates various Java reports links them in a Stoat comment in this pull request.
Adding static reports to the Stoat comment
In this tutorial we will show how to add a Jest test coverage report to the Stoat comment, but the same approach applies for any static HTML report produced by your build.
Set up Stoat with our getting started guide.
Make sure the Stoat Action appears after the GitHub workflow step that generates your Jest HTML test coverage report..github/workflows/docs.yaml
# existing step in your repo that runs Jest
- name: Run Tests
npm run jest --coverage
- name: Run Stoat Action
Point Stoat at the generated Jest HTML test coverage report by adding a new task that uses the
# a name for the Jest task
name: "Jest Coverage"
# path to the Jest coverage report
npm run jest --coveragewill generate a HTML report in the
coverage/lcov-reportdirectory (documentation here). This is the directory to set for the
pathfield in the Stoat config file. If Jest is built in a subdirectory of the Git repository or if you're using a different tool to generate an HTML report, the path will be different.
That's it! Now, every time you open a pull request, Stoat will host the Jest report and post a comment with a link to view it. See an example in this pull request.