aioesphomeapi/.github/workflows/ci.yml

66 lines
2.0 KiB
YAML
Raw Normal View History

2020-07-14 20:00:12 +02:00
name: CI
on:
push:
2021-06-30 18:08:56 +02:00
branches: [main]
2020-07-14 20:00:12 +02:00
pull_request:
jobs:
2021-06-30 17:03:55 +02:00
ci:
name: ${{ matrix.name }}
2020-07-14 20:00:12 +02:00
runs-on: ubuntu-latest
2021-06-30 17:03:55 +02:00
strategy:
matrix:
include:
- id: flake8
name: Lint with flake8
- id: pylint
name: Lint with pylint
- id: black
name: Check formatting with black
- id: isort
name: Check import order with isort
- id: mypy
name: Check typing with mypy
2020-07-14 20:00:12 +02:00
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
2021-06-30 17:03:55 +02:00
id: python
2020-07-14 20:00:12 +02:00
with:
python-version: '3.7'
2021-06-30 17:03:55 +02:00
- name: Get pip cache dir
id: pip-cache
run: |
2021-06-30 17:03:55 +02:00
echo "::set-output name=dir::$(pip cache dir)"
- name: Restore PIP cache
uses: actions/cache@v2
with:
2021-06-30 17:03:55 +02:00
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ steps.python.outputs.python-version }}-${{ hashFiles('requirements.txt', 'requirements_test.txt') }}
restore-keys: |
pip-${{ steps.python.outputs.python-version }}-
- name: Set up Python environment
run: |
2021-06-30 17:03:55 +02:00
pip3 install -r requirements.txt -r requirements_test.txt
pip3 install -e .
2021-06-30 17:03:55 +02:00
- name: Register problem matchers
run: |
echo "::add-matcher::.github/workflows/matchers/flake8.json"
2021-06-30 17:03:55 +02:00
echo "::add-matcher::.github/workflows/matchers/pylint.json"
echo "::add-matcher::.github/workflows/matchers/isort.json"
echo "::add-matcher::.github/workflows/matchers/mypy.json"
2021-06-30 17:03:55 +02:00
- run: flake8 aioesphomeapi
if: ${{ matrix.id == 'flake8' }}
- run: pylint aioesphomeapi
if: ${{ matrix.id == 'pylint' }}
- run: black --check --diff --color aioesphomeapi
if: ${{ matrix.id == 'black' }}
- run: isort --check --diff aioesphomeapi
if: ${{ matrix.id == 'isort' }}
- run: mypy aioesphomeapi
if: ${{ matrix.id == 'mypy' }}