Fix site-only setup and ensure site energy sensors appear #379
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: Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - 'custom_components/**' | |
| - 'tests_enphase_ev/**' | |
| - 'scripts/validate_quality_scale.py' | |
| - 'pyproject.toml' | |
| - '.ruff.toml' | |
| - '.github/workflows/tests.yml' | |
| workflow_dispatch: | |
| workflow_call: | |
| secrets: | |
| CODECOV_TOKEN: | |
| required: false | |
| concurrency: | |
| group: ${{ format('{0}-{1}', github.workflow_ref || github.workflow, github.ref) }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| pyproject.toml | |
| .github/workflows/tests.yml | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff | |
| - name: Run ruff | |
| run: ruff check . | |
| hassfest: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run hassfest | |
| uses: home-assistant/actions/hassfest@master | |
| quality-scale: | |
| runs-on: ubuntu-latest | |
| needs: hassfest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyyaml | |
| - name: Validate quality scale | |
| run: python scripts/validate_quality_scale.py | |
| pytest: | |
| runs-on: ubuntu-latest | |
| needs: quality-scale | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'pip' | |
| cache-dependency-path: | | |
| pyproject.toml | |
| .github/workflows/tests.yml | |
| - name: Install deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --upgrade pytest pytest-asyncio pytest-cov pytest-homeassistant-custom-component homeassistant aiohttp async-timeout voluptuous | |
| - name: Run tests | |
| id: pytest | |
| continue-on-error: true | |
| run: pytest --cov=custom_components.enphase_ev --cov-report=term-missing --cov-report=xml --junitxml=junit.xml -o junit_family=legacy | |
| - name: Upload coverage to Codecov | |
| if: ${{ always() && (github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork) }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage.xml | |
| fail_ci_if_error: true | |
| - name: Upload test results to Codecov | |
| if: ${{ always() && (github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork) }} | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./junit.xml | |
| - name: Fail if tests failed | |
| if: ${{ steps.pytest.outcome == 'failure' }} | |
| run: exit 1 |