From e94fbd26a40ddea3eee31b69c73f722a1ebf5b67 Mon Sep 17 00:00:00 2001 From: Xavier Berger Date: Tue, 19 Sep 2023 14:01:14 +0200 Subject: [PATCH] fix(ci): Update ci script and badge generator --- .github/workflows/continuous_integration.yml | 2 +- README.md | 12 +++++++++--- appdaemon/test/continuous_integration.sh | 15 +++++++-------- appdaemon/test/requirements.txt | 1 + packages/README.md | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 8302850..3d02be8 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -50,7 +50,7 @@ jobs: continue-on-error: true run: | cd appdaemon - test/generate_badges.sh + test/continuous_integration.sh - name: Setup Pages uses: actions/configure-pages@v3 diff --git a/README.md b/README.md index 129b1cf..c95b038 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,18 @@ The architecture of my installation is detailed into [**Architecture page**](arc ![](https://xavierberger.github.io/homeassistant-config/pylint.svg) ![](https://xavierberger.github.io/homeassistant-config/pytest.svg) -![](https://xavierberger.github.io/homeassistant-config/coverage.svg) +![code coverage](https://xavierberger.github.io/homeassistant-config/coverage.svg) AppDaemon directory is gathering the application I use to manage automower, garage door, shopping list, ... All details of theses applications are available into a [**Appdaemon** page](appdaemon/README.md). -A specific effort has been made on test. Detail of tests are explained into [**Appdaemon Test** page](appdaemon/test/README.md). The result of tests are listed in badges bellow: +* [multiple shopping list](appdaemon#multiple-shopping-list-manager) : Manage multiple shopping lists +* [Garage door](appdaemon#garage-door) : Send notification is garage dorr remain open at night +* [Automower](appdaemon#automower) : Advanced management of automower + +A specific effort has been made on test. Detail of tests are explained into [**Appdaemon Test** page](appdaemon/test/README.md). Code coverage report is available [here](https://xavierberger.github.io/homeassistant-config/). ## Configuration -Configuration is organized into packages. Detail of tests are explained into [**Packages** page](packages/README.md). \ No newline at end of file +Configuration is organized into packages. Detail of tests are explained into [**Packages** page](packages/README.md). + +* \ No newline at end of file diff --git a/appdaemon/test/continuous_integration.sh b/appdaemon/test/continuous_integration.sh index 08d1366..7e5ce8f 100755 --- a/appdaemon/test/continuous_integration.sh +++ b/appdaemon/test/continuous_integration.sh @@ -5,13 +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 |& echo -n -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 |& echo -n +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 ${appdaemon_dir}/htmlcov/index.html -echo "Analysing code with pylint..." -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 |& echo -n +echo ${test_dir}/htmlcov/index.html +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 \ No newline at end of file diff --git a/appdaemon/test/requirements.txt b/appdaemon/test/requirements.txt index 8c752e8..bc34e8f 100644 --- a/appdaemon/test/requirements.txt +++ b/appdaemon/test/requirements.txt @@ -1,3 +1,4 @@ +anybadge appdaemon coverage esphome diff --git a/packages/README.md b/packages/README.md index 79178dc..676252e 100644 --- a/packages/README.md +++ b/packages/README.md @@ -1,6 +1,6 @@ # Package configuration ``` -config +packages ├── addons │ ├── proximity.yaml │ ├── sun.yaml