Skip to content

Commit

Permalink
f ghp
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierBerger committed Sep 8, 2023
1 parent eac7ae3 commit 8b5ce00
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 75 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,12 @@ jobs:
python -m pip install --upgrade pip
pip install -r appdaemon/test/requirements.txt
- name: Lint code with pylint
run: |
pylint $(git ls-files '*.py' | grep -v notifier.py | grep -v hass_driver.py)
- name: Run coverage analysis
- name: Perform QA and generate badges
continue-on-error: true
run: |
cd appdaemon
coverage run --source apps -m pytest test
coverage report -m
coverage html
test/generate_badges.sh
- name: Test with pytest
run: |
cd appdaemon/test
pytest -v
- name: Setup Pages
uses: actions/configure-pages@v3

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![](images/pylint.svg) ![](images/pytest.svg) ![](images/coverage.svg)
![](images/license.svg) ![](https://xavierberger.github.io/homeassistant-config/pylint.svg) ![](https://xavierberger.github.io/homeassistant-config/pytest.svg) ![](https://xavierberger.github.io/homeassistant-config/coverage.svg)

# Home Assistant Config

Expand Down
12 changes: 6 additions & 6 deletions appdaemon/test/generate_badges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ git_dir=$(realpath "${appdaemon_dir}/../")
apps_dir=$(realpath "${appdaemon_dir}/apps/")
pushd ${appdaemon_dir} > /dev/null
export PYTHONPATH=${apps_dir}
value=$(coverage run --source ${apps_dir} -m pytest | tee /dev/tty | perl -ne '/\[(.*)\]/ and print "$1\n"' | tail -1)
anybadge -l "pytest success" -v ${value} -o -f ../images/pytest.svg 70=red 80=orange 90=yellow 100=green
value=$(coverage report -m |& tee /dev/tty | perl -ne '/TOTAL.* (\S+%)/ and print "$1"')
anybadge -l coverage -v ${value} -o -f ../images/coverage.svg 70=red 80=orange 90=yellow 100=green
pytest=$(coverage run --source ${apps_dir} -m pytest | tee /dev/tty | perl -ne '/========== (.*) ==========/ and print "$1\n"' | tail -1)
coverage=$(coverage report -m |& tee /dev/tty | perl -ne '/TOTAL.* (\S+%)/ and print "$1"')
coverage html
echo ${test_dir}/htmlcov/index.html
value=$(pylint $(git ls-files '*.py' | grep -v notifier.py | grep -v hass_driver.py) --rcfile ${git_dir}/.pylintrc | tee /dev/tty | perl -ne '/at (\S+)/ and print "$1"')
anybadge -l pylint -v "${value}" -o -f ../images/pylint.svg 70=red 80=orange 90=yellow 100=green
pylint=$(pylint $(git ls-files '*.py' | grep -v notifier.py | grep -v hass_driver.py) --rcfile ${git_dir}/.pylintrc | tee /dev/tty | perl -ne '/at (\S+)/ and print "$1"')
anybadge -l pytest -v "${pytest}" -o -f htmlcov/pytest.svg -c "#4589CD"
anybadge -l coverage -v "${coverage}" -o -f htmlcov/coverage.svg 70=red 80=orange 90=yellow 100=green
anybadge -l pylint -v "${pylint}" -o -f htmlcov/pylint.svg 70=red 80=orange 90=yellow 100=green
popd > /dev/null
18 changes: 9 additions & 9 deletions images/coverage.svg → images/license.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 0 additions & 23 deletions images/pylint.svg

This file was deleted.

23 changes: 0 additions & 23 deletions images/pytest.svg

This file was deleted.

0 comments on commit 8b5ce00

Please sign in to comment.