diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ec7b77..10a646c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,44 @@ jobs: - uses: pre-commit/action@v3.0.1 + tests: + name: Run tests (${{ matrix.ha-version }}) + runs-on: ubuntu-latest + strategy: + matrix: + include: + - ha-version: '2023.9' + python-version: '3.11' + - ha-version: '2023.10' + python-version: '3.11' + - ha-version: '2023.11' + python-version: '3.11' + - ha-version: '2023.12' + python-version: '3.11' + - ha-version: '2024.1' + python-version: '3.11' + - ha-version: '2024.1' + python-version: '3.11' + - ha-version: '2024.2' + python-version: '3.12' + - ha-version: '2024.4' + python-version: '3.12' + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: pip + cache-dependency-path: tests/requirements_${{ matrix.ha-version }}.txt + + - name: Install dependencies + run: | + pip install -r tests/requirements_${{ matrix.ha-version }}.txt + + - name: Test with pytest + run: pytest + validate: name: Validate for HACS runs-on: ubuntu-latest diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/requirements_2023.10.txt b/tests/requirements_2023.10.txt new file mode 100644 index 0000000..482d9bf --- /dev/null +++ b/tests/requirements_2023.10.txt @@ -0,0 +1,2 @@ +pytest-homeassistant-custom-component==0.13.63 +voluptuous-stubs==0.1.1 diff --git a/tests/requirements_2023.11.txt b/tests/requirements_2023.11.txt new file mode 100644 index 0000000..09cb7d6 --- /dev/null +++ b/tests/requirements_2023.11.txt @@ -0,0 +1,2 @@ +pytest-homeassistant-custom-component==0.13.70 +voluptuous-stubs==0.1.1 diff --git a/tests/requirements_2023.12.txt b/tests/requirements_2023.12.txt new file mode 100644 index 0000000..56c7e17 --- /dev/null +++ b/tests/requirements_2023.12.txt @@ -0,0 +1,2 @@ +pytest-homeassistant-custom-component==0.13.82 +voluptuous-stubs==0.1.1 diff --git a/tests/requirements_2023.9.txt b/tests/requirements_2023.9.txt new file mode 100644 index 0000000..ed571e1 --- /dev/null +++ b/tests/requirements_2023.9.txt @@ -0,0 +1,2 @@ +pytest-homeassistant-custom-component==0.13.54 +voluptuous-stubs==0.1.1 diff --git a/tests/requirements_2024.1.txt b/tests/requirements_2024.1.txt new file mode 100644 index 0000000..e77e0cc --- /dev/null +++ b/tests/requirements_2024.1.txt @@ -0,0 +1,2 @@ +pytest-homeassistant-custom-component==0.13.88 +voluptuous-stubs==0.1.1 diff --git a/tests/requirements_2024.2.txt b/tests/requirements_2024.2.txt new file mode 100644 index 0000000..f520ffa --- /dev/null +++ b/tests/requirements_2024.2.txt @@ -0,0 +1,2 @@ +pytest-homeassistant-custom-component==0.13.100 +voluptuous-stubs==0.1.1 diff --git a/tests/requirements_2024.4.txt b/tests/requirements_2024.4.txt new file mode 100644 index 0000000..dd9c8b2 --- /dev/null +++ b/tests/requirements_2024.4.txt @@ -0,0 +1,2 @@ +pytest-homeassistant-custom-component==0.13.112 +voluptuous-stubs==0.1.1 diff --git a/tests/test_backward.py b/tests/test_backward.py new file mode 100644 index 0000000..70cbdda --- /dev/null +++ b/tests/test_backward.py @@ -0,0 +1,17 @@ +def test_backward() -> None: + from custom_components.yandex_station_intents import async_setup + from custom_components.yandex_station_intents.config_flow import YandexSmartHomeIntentsFlowHandler + from custom_components.yandex_station_intents.media_player import YandexStationIntentMediaPlayer + from custom_components.yandex_station_intents.yandex_intent import IntentManager + from custom_components.yandex_station_intents.yandex_quasar import YandexQuasar + from custom_components.yandex_station_intents.yandex_session import YandexSession + + for o in [ + async_setup, + YandexSmartHomeIntentsFlowHandler, + YandexStationIntentMediaPlayer, + IntentManager, + YandexQuasar, + YandexSession, + ]: + assert o