1.7.0-3 Bugfixes #59
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Home Assistant Dependency Compatibility Check | |
| on: | |
| pull_request: | |
| schedule: | |
| - cron: "0 6 * * 1" # Every Monday at 06:00 UTC | |
| workflow_dispatch: | |
| inputs: | |
| ha_version: | |
| description: "Home Assistant version to test against (leave empty for latest)" | |
| required: false | |
| default: "" | |
| find_minimum: | |
| description: "Find minimum compatible HA version" | |
| required: false | |
| default: "false" | |
| type: boolean | |
| env: | |
| PYTHON_VERSION: "3.13" | |
| jobs: | |
| check-latest-ha: | |
| name: Check Latest HA Compatibility | |
| runs-on: ubuntu-latest | |
| outputs: | |
| compatible: ${{ steps.check.outputs.compatible }} | |
| ha_version: ${{ steps.check.outputs.ha_version }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: pip install packaging | |
| - name: Check compatibility with latest HA | |
| id: check | |
| run: | | |
| set +e | |
| if [ -n "${{ github.event.inputs.ha_version }}" ]; then | |
| HA_VERSION="${{ github.event.inputs.ha_version }}" | |
| python script/check_ha_compatibility.py --ha-version "$HA_VERSION" --verbose 2>&1 | tee output.txt | |
| else | |
| HA_VERSION="latest (dev)" | |
| python script/check_ha_compatibility.py --verbose 2>&1 | tee output.txt | |
| fi | |
| EXIT_CODE=${PIPESTATUS[0]} | |
| echo "ha_version=$HA_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "compatible=$( [ $EXIT_CODE -eq 0 ] && echo true || echo false )" >> "$GITHUB_OUTPUT" | |
| exit $EXIT_CODE | |
| - name: Write job summary | |
| if: always() | |
| run: | | |
| { | |
| echo "## Latest HA Compatibility" | |
| echo "" | |
| echo "**Target:** Home Assistant ${{ steps.check.outputs.ha_version }}" | |
| echo "" | |
| if [ "${{ steps.check.outputs.compatible }}" = "true" ]; then | |
| echo "All dependencies are compatible" | |
| else | |
| echo "Compatibility issues found" | |
| echo "" | |
| echo "<details><summary>Details</summary>" | |
| echo "" | |
| echo '```' | |
| cat output.txt | |
| echo '```' | |
| echo "</details>" | |
| fi | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| check-declared-minimum: | |
| name: Verify Declared Minimum HA Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| valid: ${{ steps.check.outputs.valid }} | |
| declared_version: ${{ steps.check.outputs.declared_version }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: pip install packaging | |
| - name: Check declared minimum version | |
| id: check | |
| run: | | |
| set +e | |
| # Custom integrations use pytest-homeassistant-custom-component for testing, | |
| # not homeassistant directly. Check if we have a declared minimum anyway. | |
| DECLARED=$(grep -oP 'homeassistant["\s]*>=\s*\K[0-9]+\.[0-9]+\.[0-9]+' pyproject.toml | head -1 || echo "") | |
| echo "declared_version=$DECLARED" >> "$GITHUB_OUTPUT" | |
| python script/check_ha_compatibility.py --check-declared-minimum --verbose 2>&1 | tee output.txt | |
| EXIT_CODE=${PIPESTATUS[0]} | |
| # For custom components without declared HA minimum, this is informational only | |
| # The installation test is what actually validates compatibility | |
| if [ -z "$DECLARED" ]; then | |
| echo "valid=informational" >> "$GITHUB_OUTPUT" | |
| echo "::notice::Custom components typically use pytest-homeassistant-custom-component for HA compatibility" | |
| exit 0 | |
| else | |
| echo "valid=$( [ $EXIT_CODE -eq 0 ] && echo true || echo false )" >> "$GITHUB_OUTPUT" | |
| exit $EXIT_CODE | |
| fi | |
| - name: Write job summary | |
| if: always() | |
| run: | | |
| { | |
| echo "## Declared Minimum Validation" | |
| echo "" | |
| DECLARED="${{ steps.check.outputs.declared_version }}" | |
| VALID="${{ steps.check.outputs.valid }}" | |
| if [ -n "$DECLARED" ]; then | |
| echo "**Declared minimum:** \`$DECLARED\` (from pyproject.toml)" | |
| else | |
| echo "**Declared minimum:** Not specified (using pytest-homeassistant-custom-component)" | |
| fi | |
| echo "" | |
| if [ "$VALID" = "true" ]; then | |
| echo "✅ Declared minimum version satisfies all requirements" | |
| elif [ "$VALID" = "informational" ]; then | |
| echo "ℹ️ Custom components use pytest-homeassistant-custom-component for HA compatibility testing" | |
| echo "" | |
| echo "The installation test validates actual compatibility with Home Assistant." | |
| else | |
| echo "❌ Declared minimum is invalid" | |
| echo "" | |
| echo "<details><summary>Details</summary>" | |
| echo "" | |
| echo '```' | |
| cat output.txt | |
| echo '```' | |
| echo "</details>" | |
| fi | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| find-minimum-version: | |
| name: Find Minimum Compatible HA Version | |
| runs-on: ubuntu-latest | |
| if: github.event.inputs.find_minimum == 'true' | |
| outputs: | |
| minimum_version: ${{ steps.find.outputs.minimum_version }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: pip install packaging | |
| - name: Find minimum HA version | |
| id: find | |
| run: | | |
| python script/check_ha_compatibility.py --find-minimum --verbose 2>&1 | tee output.txt | |
| MIN_VERSION=$(grep -oP 'Minimum compatible HA version: \K[0-9.]+' output.txt || echo "") | |
| echo "minimum_version=$MIN_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Write job summary | |
| run: | | |
| { | |
| echo "## Minimum Version Search" | |
| echo "" | |
| MIN="${{ steps.find.outputs.minimum_version }}" | |
| if [ -n "$MIN" ]; then | |
| echo "**Minimum compatible version:** \`$MIN\`" | |
| else | |
| echo "Could not determine minimum version" | |
| fi | |
| echo "" | |
| echo "<details><summary>Full search output</summary>" | |
| echo "" | |
| echo '```' | |
| cat output.txt | |
| echo '```' | |
| echo "</details>" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| installation-test: | |
| name: Installation Test | |
| runs-on: ubuntu-latest | |
| outputs: | |
| success: ${{ steps.install.outputs.success }} | |
| ha_version: ${{ steps.ha_version.outputs.version }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Get HA version to test | |
| id: ha_version | |
| run: | | |
| if [ -n "${{ github.event.inputs.ha_version }}" ]; then | |
| echo "version=${{ github.event.inputs.ha_version }}" >> "$GITHUB_OUTPUT" | |
| else | |
| pip install --upgrade pip | |
| VERSION=$(pip index versions homeassistant 2>/dev/null | grep -oP 'homeassistant \(\K[^)]+' | head -1 || echo "dev") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Download HA constraints | |
| run: | | |
| HA_VERSION="${{ steps.ha_version.outputs.version }}" | |
| URL="https://raw.githubusercontent.com/home-assistant/core/${HA_VERSION}/homeassistant/package_constraints.txt" | |
| if ! curl -fsSL "$URL" -o ha_constraints.txt 2>/dev/null; then | |
| curl -fsSL "https://raw.githubusercontent.com/home-assistant/core/dev/homeassistant/package_constraints.txt" -o ha_constraints.txt | |
| fi | |
| - name: Create test environment and install | |
| id: install | |
| run: | | |
| set +e | |
| python -m venv test_env | |
| source test_env/bin/activate | |
| pip install --upgrade pip | |
| HA_VERSION="${{ steps.ha_version.outputs.version }}" | |
| if [ "$HA_VERSION" = "dev" ]; then | |
| pip install homeassistant --constraint ha_constraints.txt 2>&1 | tee install.log | |
| else | |
| pip install "homeassistant==$HA_VERSION" --constraint ha_constraints.txt 2>&1 | tee install.log | |
| fi | |
| REQUIREMENTS=$(python -c "import json; print(' '.join(json.load(open('custom_components/googlefindmy/manifest.json')).get('requirements', [])))") | |
| FAILED=0 | |
| for req in $REQUIREMENTS; do | |
| if ! pip install "$req" --constraint ha_constraints.txt 2>&1 | tee -a install.log; then | |
| FAILED=1 | |
| fi | |
| done | |
| pip check 2>&1 | tee -a install.log | |
| PIP_CHECK=$? | |
| if [ $FAILED -eq 0 ] && [ $PIP_CHECK -eq 0 ]; then | |
| echo "success=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "success=false" >> "$GITHUB_OUTPUT" | |
| exit 1 | |
| fi | |
| - name: Write job summary | |
| if: always() | |
| run: | | |
| { | |
| echo "## Installation Test" | |
| echo "" | |
| echo "**Target:** Home Assistant ${{ steps.ha_version.outputs.version }}" | |
| echo "" | |
| if [ "${{ steps.install.outputs.success }}" = "true" ]; then | |
| echo "All packages installed successfully with HA constraints" | |
| else | |
| echo "Installation failed" | |
| echo "" | |
| echo "<details><summary>Install log</summary>" | |
| echo "" | |
| echo '```' | |
| cat install.log 2>/dev/null || echo "No log available" | |
| echo '```' | |
| echo "</details>" | |
| fi | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| summary: | |
| name: Compatibility Summary | |
| runs-on: ubuntu-latest | |
| needs: [check-latest-ha, check-declared-minimum, installation-test] | |
| if: always() | |
| steps: | |
| - name: Generate summary | |
| run: | | |
| { | |
| echo "# Home Assistant Dependency Compatibility" | |
| echo "" | |
| echo "| Check | Status |" | |
| echo "|-------|--------|" | |
| if [ "${{ needs.check-latest-ha.outputs.compatible }}" = "true" ]; then | |
| echo "| Latest HA Compatibility | Pass |" | |
| else | |
| echo "| Latest HA Compatibility | Fail |" | |
| fi | |
| VALID="${{ needs.check-declared-minimum.outputs.valid }}" | |
| if [ "$VALID" = "true" ]; then | |
| echo "| Declared Minimum Valid | ✅ Pass |" | |
| elif [ "$VALID" = "informational" ]; then | |
| echo "| Declared Minimum Valid | ℹ️ N/A (custom component) |" | |
| else | |
| echo "| Declared Minimum Valid | ❌ Fail |" | |
| fi | |
| if [ "${{ needs.installation-test.outputs.success }}" = "true" ]; then | |
| echo "| Installation Test | Pass |" | |
| else | |
| echo "| Installation Test | Fail |" | |
| fi | |
| echo "" | |
| echo "---" | |
| echo "" | |
| echo "**Tested against:** Home Assistant ${{ needs.check-latest-ha.outputs.ha_version }}" | |
| DECLARED="${{ needs.check-declared-minimum.outputs.declared_version }}" | |
| if [ -n "$DECLARED" ]; then | |
| echo "**Declared minimum:** $DECLARED" | |
| fi | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Fail if any check failed | |
| # Note: check-declared-minimum.valid can be 'informational' for custom components | |
| # without a declared HA minimum - this is acceptable, only fail on explicit 'false' | |
| if: | | |
| needs.check-latest-ha.outputs.compatible != 'true' || | |
| needs.check-declared-minimum.outputs.valid == 'false' || | |
| needs.installation-test.outputs.success != 'true' | |
| run: exit 1 |