Files
adguard-control-hub/.gitea/workflows/integration-test.yml
Rafal Zielinski 1ca157def4
Some checks failed
Integration Testing / Integration Tests (2025.9.4, 3.13) (push) Failing after 30s
feat: added caching to the gitea workflow
Signed-off-by: Rafal Zielinski <sq4ind@gmail.com>
2025-10-02 12:53:33 +01:00

117 lines
4.0 KiB
YAML

name: Integration Testing
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
test-integration:
name: Integration Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
home-assistant-version: ["2025.9.4"]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # Built-in pip caching
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Cache pytest cache
uses: actions/cache@v4
with:
path: .pytest_cache
key: ${{ runner.os }}-pytest-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-pytest-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-
${{ runner.os }}-pytest-${{ matrix.python-version }}-
${{ runner.os }}-pytest-
- name: Cache Home Assistant installation
uses: actions/cache@v4
with:
path: |
/opt/hostedtoolcache/Python/${{ matrix.python-version }}*/x64/lib/python*/site-packages/homeassistant*
~/.local/lib/python*/site-packages/homeassistant*
key: ${{ runner.os }}-ha-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}
restore-keys: |
${{ runner.os }}-ha-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}
- name: Cache coverage data
uses: actions/cache@v4
with:
path: |
.coverage
.coverage.*
htmlcov/
key: ${{ runner.os }}-coverage-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-coverage-${{ matrix.python-version }}-${{ matrix.home-assistant-version }}-
${{ runner.os }}-coverage-${{ matrix.python-version }}-
${{ runner.os }}-coverage-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install homeassistant==${{ matrix.home-assistant-version }}
pip install -r requirements-dev.txt
- name: Ensure Package Structure
run: |
mkdir -p custom_components
touch custom_components/__init__.py
- name: Run Unit Tests
run: |
python -m pytest tests/ -v --tb=short --cov=custom_components/adguard_hub --cov-report=xml --cov-report=term-missing --asyncio-mode=auto --cov-fail-under=60
- name: Test Installation
run: |
python -c "
import sys
sys.path.insert(0, 'custom_components')
try:
from adguard_hub import DOMAIN
print(f'✅ Integration can be imported, domain: {DOMAIN}')
except Exception as e:
print(f'❌ Import failed: {e}')
sys.exit(1)
"
- name: Test Manifest Validation
run: |
python -c "
import json
import sys
try:
with open('custom_components/adguard_hub/manifest.json', 'r') as f:
manifest = json.load(f)
required_keys = ['domain', 'name', 'version', 'documentation', 'requirements']
missing = [k for k in required_keys if k not in manifest]
if missing:
print(f'❌ Missing manifest keys: {missing}')
sys.exit(1)
print('✅ Manifest is valid')
except Exception as e:
print(f'❌ Manifest validation failed: {e}')
sys.exit(1)
"