lint #582
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: CI | |
| on: | |
| release: | |
| types: | |
| - published | |
| push: | |
| paths: | |
| - "uv.lock" | |
| - "pyproject.toml" | |
| - "src/**" | |
| - "hass-addon-sunsynk-multi/**" | |
| - "hass-addon-sunsynk-edge/**" | |
| - ".github/workflows/deploy-sunsynk.yml" | |
| - ".github/workflows/ci.yml" | |
| pull_request: | |
| paths: | |
| - "uv.lock" | |
| - "pyproject.toml" | |
| - "src/**" | |
| - "hass-addon-sunsynk-multi/**" | |
| - "hass-addon-sunsynk-edge/**" | |
| - ".github/workflows/deploy-sunsynk.yml" | |
| - ".github/workflows/ci.yml" | |
| env: | |
| RUFF_VERSION: 0.15.4 | |
| UV_VERSION: 0.10.2 | |
| jobs: | |
| ruff: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: chartboost/ruff-action@v1 | |
| with: | |
| version: ${{ env.RUFF_VERSION }} | |
| - uses: chartboost/ruff-action@v1 | |
| with: | |
| args: "format --check" | |
| version: ${{ env.RUFF_VERSION }} | |
| zuban: | |
| name: Check zuban | |
| needs: [ruff] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - name: Install Requirements | |
| run: uv sync --frozen --all-extras | |
| - name: Run zuban | |
| run: uv run zuban check src | |
| pytest: | |
| name: Run tests Python ${{ matrix.python-version }} | |
| needs: [ruff] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.12", "3.13", "3.14"] | |
| env: | |
| PYTHON: ${{ matrix.python-version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - name: Install Requirements | |
| run: uv sync --frozen --all-extras | |
| - name: Run tests and generate coverage report | |
| run: uv run pytest -vv | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| env_vars: PYTHON | |
| verbose: true | |
| build-n-publish: | |
| name: Build and publish Python 🐍 distributions 📦 to PyPI | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: | |
| - pytest | |
| permissions: | |
| id-token: write # used for trusted publishing | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: ${{ env.UV_VERSION }} | |
| - name: Build a binary wheel and a source tarball | |
| run: uv build | |
| - name: Publish distribution 📦 to PyPI | |
| run: uv publish | |