Skip to content

Commit

Permalink
fix(ci): Update ci script and badge generator
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierBerger committed Sep 20, 2023
1 parent ced0eb2 commit 6aa5f7e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 8 additions & 9 deletions appdaemon/test/continuous_integration.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
#!/bin/bash
#! /bin/bash
test_dir=$(realpath "$(dirname $0)")
appdaemon_dir=$(realpath "${test_dir}/../")
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

0 comments on commit 6aa5f7e

Please sign in to comment.