From 8b5ce0050b87097214e93821dc1f46d668089e90 Mon Sep 17 00:00:00 2001 From: Xavier Berger Date: Fri, 8 Sep 2023 18:59:06 +0200 Subject: [PATCH] f ghp --- .github/workflows/continuous_integration.yml | 15 ++----------- README.md | 2 +- appdaemon/test/generate_badges.sh | 12 +++++----- images/{coverage.svg => license.svg} | 18 +++++++-------- images/pylint.svg | 23 -------------------- images/pytest.svg | 23 -------------------- 6 files changed, 18 insertions(+), 75 deletions(-) rename images/{coverage.svg => license.svg} (51%) delete mode 100644 images/pylint.svg delete mode 100644 images/pytest.svg diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index 95f51ce..8302850 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -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 diff --git a/README.md b/README.md index a7a2476..c0841cf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/appdaemon/test/generate_badges.sh b/appdaemon/test/generate_badges.sh index abceea7..7e5ce8f 100755 --- a/appdaemon/test/generate_badges.sh +++ b/appdaemon/test/generate_badges.sh @@ -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 \ No newline at end of file diff --git a/images/coverage.svg b/images/license.svg similarity index 51% rename from images/coverage.svg rename to images/license.svg index 2440538..87430a4 100644 --- a/images/coverage.svg +++ b/images/license.svg @@ -1,23 +1,23 @@ - + - + - - - + + + - coverage - coverage + License + License - 100% - 100% + MIT + MIT diff --git a/images/pylint.svg b/images/pylint.svg deleted file mode 100644 index e382c59..0000000 --- a/images/pylint.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - pylint - pylint - - - 10.00/10 - 10.00/10 - - diff --git a/images/pytest.svg b/images/pytest.svg deleted file mode 100644 index e1d2cfb..0000000 --- a/images/pytest.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - pytest success - pytest success - - - 100% - 100% - -