1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-02 16:11:53 +00:00

Add pytest to CI (#1138)

This commit is contained in:
Otto Winter
2020-07-15 14:00:02 +02:00
committed by GitHub
parent a20e71b32a
commit d5c59292c8
7 changed files with 120 additions and 39 deletions

View File

@@ -128,15 +128,6 @@ jobs:
key: test-home-platformio-${{ matrix.test }}-${{ hashFiles('esphome/core_config.py') }}
restore-keys: |
test-home-platformio-${{ matrix.test }}-
# Cache the intermediary build files
- name: Cache Test Build
uses: actions/cache@v1
with:
path: tests/build/${{ matrix.test }}
key: test-pio-${{ matrix.test }}-${{ hashFiles('esphome/core_config.py') }}-${{ hashFiles('esphome/**') }}
restore-keys: |
test-pio-${{ matrix.test }}-${{ hashFiles('esphome/core_config.py') }}-
test-pio-${{ matrix.test }}-
- name: Set up environment
run: script/setup
@@ -145,10 +136,41 @@ jobs:
echo "::add-matcher::.github/workflows/matchers/gcc.json"
echo "::add-matcher::.github/workflows/matchers/python.json"
- run: esphome tests/${{ matrix.test }}.yaml compile
pytest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Cache pip modules
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: esphome-pip-3.7-${{ hashFiles('setup.py') }}
restore-keys: |
esphome-pip-3.7-
- name: Set up environment
run: script/setup
- name: Install Github Actions annotator
run: pip install pytest-github-actions-annotate-failures
- name: Register problem matchers
run: |
echo "::add-matcher::.github/workflows/matchers/python.json"
- name: Run pytest
run: |
pytest \
-qq \
--durations=10 \
-o console_output_style=count \
tests
deploy-pypi:
name: Build and publish to PyPi
needs: [lint-clang-format, lint-clang-tidy, lint-python, test]
needs: [lint-clang-format, lint-clang-tidy, lint-python, test, pytest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@@ -171,7 +193,7 @@ jobs:
deploy-docker:
name: Build and publish docker containers
runs-on: ubuntu-latest
needs: [lint-clang-format, lint-clang-tidy, lint-python, test]
needs: [lint-clang-format, lint-clang-tidy, lint-python, test, pytest]
strategy:
matrix:
arch: [amd64, i386, armv7, aarch64]