Add first unittest for Base device #9
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: Run Python UnitTests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Checkout Repo Code | |
uses: actions/checkout@v4 | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r src/abbfreeathome/dev-requirements.txt | |
- name: Install abbfreeathome Python Package | |
run: | | |
pip install . | |
- name: Test with pytest | |
run: | | |
pytest \ | |
--doctest-modules \ | |
--junitxml=junit/test-results.xml \ | |
--cov=abbfreeathome \ | |
--cov-report=xml:coverage/coverage.xml \ | |
--cov-report=html:coverage/htmlcov | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
with: | |
filename: coverage/coverage.xml | |
badge: true | |
format: markdown | |
output: both | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
hide_and_recreate: true | |
path: code-coverage-results.md | |
- name: Write to Job Summary | |
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
files: | | |
junit/test-results.xml |