Add test coverage on the main page of albs-sign-node repository #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pytest | |
on: | |
pull_request: | |
branches: | |
- "**" | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
name: Check out repository | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Prepare python env | |
run: | | |
python -m venv env | |
env/bin/python -m pip install -U pip | |
env/bin/python -m pip install -r requirements.txt | |
- name: Run unit tests (pytest) | |
run: set -o pipefail && env/bin/python -m pytest -v --cov-report term-missing:skip-covered | |
--cov-report xml:/tmp/coverage.xml --junitxml=/tmp/pytest.xml | |
--cov=sign_node tests/ | tee /tmp/pytest-coverage.txt | |
- name: Pytest coverage comment | |
uses: MishaKav/pytest-coverage-comment@main | |
id: coverageComment | |
with: | |
pytest-coverage-path: /tmp/pytest-coverage.txt | |
pytest-xml-coverage-path: /tmp/coverage.xml | |
title: Coverage report for changed files | |
badge-title: Total coverage | |
hide-badge: false | |
hide-report: false | |
report-only-changed-files: true | |
hide-comment: false | |
remove-link-from-badge: false | |
junitxml-path: /tmp/pytest.xml | |
- name: Create the Badge | |
if: ${{ github.ref == 'refs/heads/master' && steps.coverageComment.outputs.coverage }} | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 7d2552a0fbf81edbaa7d3deb001e142b | |
filename: sign-node-badge__master.json | |
label: Test Coverage | |
message: ${{ steps.coverageComment.outputs.coverage }} | |
color: ${{ steps.coverageComment.outputs.color }} | |
namedLogo: pytest |