Activate hassfest requirements CI check (#39940)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Martin Hjelmare 2020-09-11 21:38:32 +02:00 committed by GitHub
parent f1cb8e80b3
commit 50c573eb4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 27 deletions

View file

@ -518,25 +518,24 @@ jobs:
hassfest: hassfest:
name: Check hassfest name: Check hassfest
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: prepare-base needs: prepare-tests
strategy:
matrix:
python-version: [3.7]
container: homeassistant/ci-azure:${{ matrix.python-version }}
steps: steps:
- name: Check out code from GitHub - name: Check out code from GitHub
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Set up Python ${{ env.DEFAULT_PYTHON }} - name:
uses: actions/setup-python@v2.1.2 Restore full Python ${{ matrix.python-version }} virtual environment
id: python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Restore base Python virtual environment
id: cache-venv id: cache-venv
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: venv path: venv
key: >- key: >-
${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ ${{ env.CACHE_VERSION}}-${{ runner.os }}-venv-${{
steps.python.outputs.python-version }}-${{ matrix.python-version }}-${{ hashFiles('requirements_test.txt')
hashFiles('requirements.txt') }}-${{ }}-${{ hashFiles('requirements_all.txt') }}-${{
hashFiles('requirements_test.txt') }}-${{
hashFiles('homeassistant/package_constraints.txt') }} hashFiles('homeassistant/package_constraints.txt') }}
- name: Fail job if Python cache restore failed - name: Fail job if Python cache restore failed
if: steps.cache-venv.outputs.cache-hit != 'true' if: steps.cache-venv.outputs.cache-hit != 'true'
@ -546,7 +545,7 @@ jobs:
- name: Run hassfest - name: Run hassfest
run: | run: |
. venv/bin/activate . venv/bin/activate
python -m script.hassfest --action validate python -m script.hassfest --requirements --action validate
gen-requirements-all: gen-requirements-all:
name: Check all requirements name: Check all requirements

View file

@ -3,8 +3,16 @@
"name": "HomeKit Controller", "name": "HomeKit Controller",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/homekit_controller", "documentation": "https://www.home-assistant.io/integrations/homekit_controller",
"requirements": ["aiohomekit[IP]==0.2.49"], "requirements": [
"zeroconf": ["_hap._tcp.local."], "aiohomekit==0.2.49"
"after_dependencies": ["zeroconf"], ],
"codeowners": ["@Jc2k"] "zeroconf": [
"_hap._tcp.local."
],
"after_dependencies": [
"zeroconf"
],
"codeowners": [
"@Jc2k"
]
} }

View file

@ -4,13 +4,15 @@
"documentation": "https://www.home-assistant.io/integrations/samsungtv", "documentation": "https://www.home-assistant.io/integrations/samsungtv",
"requirements": [ "requirements": [
"samsungctl[websocket]==0.7.1", "samsungctl[websocket]==0.7.1",
"samsungtvws[websocket]==1.4.0" "samsungtvws==1.4.0"
], ],
"ssdp": [ "ssdp": [
{ {
"st": "urn:samsung.com:device:RemoteControlReceiver:1" "st": "urn:samsung.com:device:RemoteControlReceiver:1"
} }
], ],
"codeowners": ["@escoand"], "codeowners": [
"@escoand"
],
"config_flow": true "config_flow": true
} }

View file

@ -2,7 +2,7 @@
-r requirements.txt -r requirements.txt
# homeassistant.components.nuimo_controller # homeassistant.components.nuimo_controller
--only-binary=all nuimo==0.1.0 # --only-binary=all nuimo==0.1.0
# homeassistant.components.dht # homeassistant.components.dht
# Adafruit-DHT==1.4.0 # Adafruit-DHT==1.4.0
@ -178,7 +178,7 @@ aioguardian==1.0.1
aioharmony==0.2.6 aioharmony==0.2.6
# homeassistant.components.homekit_controller # homeassistant.components.homekit_controller
aiohomekit[IP]==0.2.49 aiohomekit==0.2.49
# homeassistant.components.emulated_hue # homeassistant.components.emulated_hue
# homeassistant.components.http # homeassistant.components.http
@ -1942,7 +1942,7 @@ saltbox==0.1.3
samsungctl[websocket]==0.7.1 samsungctl[websocket]==0.7.1
# homeassistant.components.samsungtv # homeassistant.components.samsungtv
samsungtvws[websocket]==1.4.0 samsungtvws==1.4.0
# homeassistant.components.satel_integra # homeassistant.components.satel_integra
satel_integra==0.3.4 satel_integra==0.3.4

View file

@ -103,7 +103,7 @@ aioguardian==1.0.1
aioharmony==0.2.6 aioharmony==0.2.6
# homeassistant.components.homekit_controller # homeassistant.components.homekit_controller
aiohomekit[IP]==0.2.49 aiohomekit==0.2.49
# homeassistant.components.emulated_hue # homeassistant.components.emulated_hue
# homeassistant.components.http # homeassistant.components.http
@ -905,7 +905,7 @@ rxv==0.6.0
samsungctl[websocket]==0.7.1 samsungctl[websocket]==0.7.1
# homeassistant.components.samsungtv # homeassistant.components.samsungtv
samsungtvws[websocket]==1.4.0 samsungtvws==1.4.0
# homeassistant.components.emulated_kasa # homeassistant.components.emulated_kasa
# homeassistant.components.sense # homeassistant.components.sense

View file

@ -23,11 +23,13 @@ COMMENT_REQUIREMENTS = (
"bme680", "bme680",
"credstash", "credstash",
"decora", "decora",
"decora_wifi",
"env_canada", "env_canada",
"envirophat", "envirophat",
"evdev", "evdev",
"face_recognition", "face_recognition",
"i2csense", "i2csense",
"nuimo",
"opencv-python-headless", "opencv-python-headless",
"py_noaa", "py_noaa",
"pybluez", "pybluez",

View file

@ -2,6 +2,7 @@
from collections import deque from collections import deque
import json import json
import operator import operator
import os
import re import re
import subprocess import subprocess
import sys import sys
@ -31,6 +32,19 @@ SUPPORTED_PYTHON_VERSIONS = [
STD_LIBS = {version: set(stdlib_list(version)) for version in SUPPORTED_PYTHON_VERSIONS} STD_LIBS = {version: set(stdlib_list(version)) for version in SUPPORTED_PYTHON_VERSIONS}
PIPDEPTREE_CACHE = None PIPDEPTREE_CACHE = None
IGNORE_VIOLATIONS = {
# Still has standard library requirements.
"acmeda",
"blink",
"ezviz",
"hdmi_cec",
"juicenet",
"lupusec",
"rainbird",
"slide",
"suez_water",
}
def normalize_package_name(requirement: str) -> str: def normalize_package_name(requirement: str) -> str:
"""Return a normalized package name from a requirement string.""" """Return a normalized package name from a requirement string."""
@ -49,12 +63,10 @@ def validate(integrations: Dict[str, Integration], config: Config):
ensure_cache() ensure_cache()
# check for incompatible requirements # check for incompatible requirements
items = integrations.values()
if not config.specific_integrations: disable_tqdm = config.specific_integrations or os.environ.get("CI", False)
tqdm(items)
for integration in items: for integration in tqdm(integrations.values(), disable=disable_tqdm):
if not integration.manifest: if not integration.manifest:
continue continue
@ -63,6 +75,10 @@ def validate(integrations: Dict[str, Integration], config: Config):
def validate_requirements(integration: Integration): def validate_requirements(integration: Integration):
"""Validate requirements.""" """Validate requirements."""
# Some integrations have not been fixed yet so are allowed to have violations.
if integration.domain in IGNORE_VIOLATIONS:
return
integration_requirements = set() integration_requirements = set()
integration_packages = set() integration_packages = set()
for req in integration.requirements: for req in integration.requirements: