Initial step to have continuous integration

This commit introduces the use of tox, which currently only verifies
that code is formatted according to the black project. More checks will
come in upcoming PRs for codespell, pydocstyle, flake8 and mypy.

A GitHub actions is included that runs tox on new pull requests, so we
get automatic feedback and can block commits that fail any check.
Another (official) action that runs hassfest is included as well, to
make sure we are compatible with Home Assistant.
This commit is contained in:
Pierre Ståhl
2020-09-22 09:38:14 +02:00
parent 83b3b6f21b
commit 30392d3ac5
7 changed files with 266 additions and 143 deletions

40
tox.ini Normal file
View File

@@ -0,0 +1,40 @@
[tox]
skipsdist = true
envlist = py{37,38}, lint, typing
skip_missing_interpreters = True
cs_exclude_words =
[gh-actions]
python =
3.7: clean, py37, lint, typing
3.8: clean, py38, lint, typing
[testenv]
passenv = TOXENV CI
whitelist_externals =
true
setenv =
LANG=en_US.UTF-8
PYTHONPATH = {toxinidir}/localtuya-homeassistant
deps =
-r{toxinidir}/requirements_test.txt
commands =
true # TODO: Run tests later
#pytest -n auto --log-level=debug -v --timeout=30 --durations=10 {posargs}
[testenv:lint]
ignore_errors = True
deps =
{[testenv]deps}
commands =
#codespell -q 4 -L {[tox]cs_exclude_words} --skip="*.pyc,*.pyi,*~" custom_components
#flake8 cu
black --fast --check .
#pydocstyle -v custom_components
[testenv:typing]
whitelist_externals =
true
commands =
true
#mypy --ignore-missing-imports --follow-imports=skip custom_components