|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + schedule: |
| 8 | + - cron: "17 4 * * 1" |
| 9 | + |
| 10 | +jobs: |
| 11 | + lint: |
| 12 | + name: Lint and type check |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v5 |
| 16 | + - uses: actions/setup-python@v6 |
| 17 | + with: |
| 18 | + python-version: "3.12" |
| 19 | + - name: Install ruff |
| 20 | + run: pip install "ruff==0.15.22" |
| 21 | + - name: Ruff |
| 22 | + run: ruff check . |
| 23 | + |
| 24 | + test: |
| 25 | + name: Tests |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v5 |
| 29 | + - uses: actions/setup-python@v6 |
| 30 | + with: |
| 31 | + python-version: "3.12" |
| 32 | + - name: Install test dependencies |
| 33 | + run: | |
| 34 | + python -m pip install --upgrade pip |
| 35 | + # aiohttp, crcmod and paho-mqtt are manifest.json runtime |
| 36 | + # requirements: the suite loads core/api_client.py, |
| 37 | + # core/realtime_parser.py and core/mqtt_client.py by path, and each |
| 38 | + # imports its transport at module scope, so the API-client tests fail |
| 39 | + # to import without them even though no test opens a real connection. |
| 40 | + pip install pytest pytest-asyncio "aiohttp>=3.8.0" "paho-mqtt>=1.6.0" "crcmod>=1.7" |
| 41 | + - name: Run tests |
| 42 | + run: pytest tests/ -v |
| 43 | + |
| 44 | + hassfest: |
| 45 | + name: Hassfest |
| 46 | + runs-on: ubuntu-latest |
| 47 | + steps: |
| 48 | + # hassfest compares manifest["domain"] against the *integration |
| 49 | + # directory name*, and has no notion of hacs.json's content_in_root. |
| 50 | + # This repo deliberately keeps the integration at the repository root |
| 51 | + # (hacs.json "content_in_root": true), so a plain checkout presents |
| 52 | + # hassfest with a directory named after the runner workspace and the |
| 53 | + # domain check can never pass. Checking out into custom_components/, |
| 54 | + # the layout hassfest expects, gives it a directory whose name matches |
| 55 | + # the domain. This only relocates the checkout: the mounted workspace |
| 56 | + # and the set of files hassfest validates are unchanged. |
| 57 | + - uses: actions/checkout@v5 |
| 58 | + with: |
| 59 | + path: custom_components/lumentree |
| 60 | + - uses: home-assistant/actions/hassfest@master |
| 61 | + |
| 62 | + hacs: |
| 63 | + name: HACS |
| 64 | + runs-on: ubuntu-latest |
| 65 | + steps: |
| 66 | + - uses: actions/checkout@v5 |
| 67 | + - uses: hacs/action@main |
| 68 | + with: |
| 69 | + category: integration |
0 commit comments