Skip to content

uv

uv #333

Workflow file for this run

name: CI
on:
release:
types:
- published
push:
paths:
- "setup.*"
- "src/**"
- "hass-addon-sunsynk-multi/**"
- ".github/workflows/deploy-multi.yml"
- ".github/workflows/ci.yml"
pull_request:
paths:
- "setup.*"
- "src/**"
- "hass-addon-sunsynk-multi/**"
- ".github/workflows/deploy-multi.yml"
- ".github/workflows/ci.yml"
env:
RUFF_VERSION: 0.9.7
UV_VERSION: 0.6.2
PIP_INSTALL: aiohttp .[umodbus,solarman,tests]
TEST_TARGET: "src"
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
version: ${{ env.RUFF_VERSION }}
- uses: chartboost/ruff-action@v1
with:
args: "format --check"
version: ${{ env.RUFF_VERSION }}
pylint:
name: Check pylint
needs: [ruff]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install Requirements
run: uv pip install --system ${{ env.PIP_INSTALL }}
- name: Run Pylint
run: pylint ${{ env.TEST_TARGET }}
mypy:
name: Check mypy
needs: [ruff]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install Requirements
run: uv pip install --system ${{ env.PIP_INSTALL }}
- name: Run mypy
run: mypy --install-types --non-interactive ${{ env.TEST_TARGET }}/
pytest:
name: Run tests Python ${{ matrix.python-version }}
needs: [ruff]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
env:
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: ${{ env.UV_VERSION }}
- name: Install Requirements
run: uv pip install --system ${{ env.PIP_INSTALL }}
- name: Run tests and generate coverage report
run: pytest
- 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@v4
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v5
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