Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage #533

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use ReportGenerator
  • Loading branch information
basnijholt committed Apr 4, 2023
commit e3e85abaf62c77bfd63d8a5b0373d10ec3fcef75
17 changes: 12 additions & 5 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,24 @@ jobs:
-p no:sugar \
tests/components/adaptive_lighting

- name: Run Tests with Coverage
run: |
cd core
pytest --cov=homeassistant --cov-report=html tests/components/adaptive_lighting
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5.1.19
with:
reports: 'core/coverage.xml'
targetdir: 'coveragereport'
reporttypes: 'HtmlInline;Cobertura'
assemblyfilters: '+*'
classfilters: '+*'
filefilters: '+*'
verbosity: 'Info'
tag: '${{ github.run_number }}_${{ github.run_id }}'

- name: Push Coverage Report to Branch
run: |
git config user.name "GitHub Actions"
git config user.email "actions@users.noreply.github.com"
git checkout -B coverage-report
mv core/htmlcov coverage-report
mv coveragereport coverage-report
git add coverage-report
git commit -m "Update coverage report"
git push -f origin coverage-report
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ENTRYPOINT ["python3", \
# Print the 10 slowest tests
"--durations=10", \
# Measure code coverage for the 'homeassistant' package
"--cov='homeassistant'", \
"--cov='homeassistant/components/adaptive_lighting'", \
# Generate an XML report of the code coverage
"--cov-report=xml", \
# Generate an HTML report of the code coverage
Expand Down