name: Code Quality Check on: push: branches: [ main, develop ] pull_request: branches: [ main ] jobs: code-formatting: name: Code Formatting runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Cache pip dependencies uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-formatting-${{ hashFiles('**/requirements-dev.txt') }} restore-keys: | ${{ runner.os }}-formatting- - name: Install Dependencies run: | python -m pip install --upgrade pip pip install black isort flake8 - name: Code Formatting Check (Black) run: | echo "🔍 Checking code formatting with Black..." black --check --diff --color custom_components/ tests/ - name: Import Sorting Check (isort) run: | echo "📦 Checking import sorting with isort..." isort --check-only --diff --color custom_components/ tests/ - name: Linting (flake8) run: | echo "🔍 Linting code with flake8..." flake8 custom_components/ tests/ --statistics --show-source security-scan: name: Security Analysis runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.13' - name: Install Security Tools run: | python -m pip install --upgrade pip pip install bandit safety - name: Security Check (Bandit) run: | echo "🔒 Running security analysis with Bandit..." bandit -r custom_components/ -ll - name: Dependency Security Check (Safety) run: | echo "🔒 Checking dependencies with Safety..." pip install -r requirements-dev.txt safety check