A GitHub Actions example for privately viewing self-contained pytest-html reports #1074
eloktev
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I maintain Artifact Relay, an MIT-licensed, self-hosted service for viewing standalone HTML behind a password. I added a copyable pytest-html workflow for cases where a report should be browser-viewable without making it public.
Workflow YAML, pinned to the example's commit
The useful part is preserving failure reports without hiding test failures:
pytest-report.htmlwithpytest --html=pytest-report.html --self-contained-html.continue-on-erroron the test step, with an explicit publish condition).steps.pytest.outcome == 'failure'.The example runs manually with
workflow_dispatchand uses the versionedeloktev/artifact-relay@v1.3.0action. To try it, deploy a relay reachable by your runner, configure theARTIFACT_RELAY_BASE_URLActions variable andARTIFACT_RELAY_API_TOKENActions secret, and adapt the dependency-install step to your project. The localhost-only default deployment is not reachable from a GitHub-hosted runner. Don't expose the publisher secret to untrusted pull-request code or print it in logs.A few limits worth calling out: this is a single-user/password-protected viewer, not team SSO; the example publishes one HTML file, so images referenced as files or external links are not automatically bundled. It is an optional delivery step, not a replacement for pytest-html or your existing CI artifacts.
All reactions