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

31
.github/workflows/ci.yaml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: CI
on: [pull_request, pull_request_target]
jobs:
build:
name: >-
${{ matrix.python-version }}
/
${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
# https://help.github.com/articles/virtual-environments-for-github-actions
platform:
- ubuntu-latest
python-version:
- 3.7
- 3.8
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade setuptools pip
python -m pip install tox-gh-actions
- name: Run tox
run: tox -q -p auto

14
.github/workflows/hassfest.yaml vendored Normal file
View File

@@ -0,0 +1,14 @@
name: Validate with hassfest
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: home-assistant/actions/hassfest@master