Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 159 additions & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,153 @@ jobs:
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master

ruff:
runs-on: ubuntu-latest
name: Ruff check and force
steps:
- name: Check out committed code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Prepare python
run: |
pip install uv
uv venv --seed venv
. venv/bin/activate
uv pip install ruff -r requirements.txt -r requirements-test.txt
- name: Ruff (with fix)
run: |
. venv/bin/activate
ruff check airos/ tests/
- name: If needed, commit ruff changes to the pull request
if: failure()
run: |
. venv/bin/activate
ruff format airos/ tests/
git config --global user.name 'autoruff'
git config --global user.email 'airos@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.PAT_CT }}@github.com/$GITHUB_REPOSITORY
git checkout $GITHUB_HEAD_REF
git commit -am "fixup: ${GITHUB_REF##*/} Python code fixed using ruff"
git push origin ${GITHUB_REF##*/}

commitcheck:
runs-on: ubuntu-latest
name: Check commit
needs:
- ruff
steps:
- name: Check out committed code
uses: actions/checkout@v4
- name: Prepare python
run: |
pip install uv
uv venv --seed venv
. venv/bin/activate
uv pip install pre-commit -r requirements.txt -r requirements-test.txt
pre-commit install
pre-commit install-hooks
- name: Full pre-commit
run: |
. venv/bin/activate
pre-commit run --show-diff-on-failure --color=always --all-files

pytest:
runs-on: ubuntu-latest
name: Run pytest using Python ${{ matrix.python-version }}
needs:
- ruff
- commitcheck
strategy:
matrix:
python-version: ["3.13"]
steps:
- name: Check out committed code
uses: actions/checkout@v4
- name: Prepare python
run: |
pip install uv
uv venv --seed venv
. venv/bin/activate
uv pip install -r requirements.txt -r requirements-test.txt
- name: Run all tests
run: |
. venv/bin/activate
pytest --log-level info tests/*.py --cov='.'
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: .coverage
if-no-files-found: error
include-hidden-files: true

mypy:
if: false # disables the job --> "Code is not up to par for mypy, skipping"
runs-on: ubuntu-latest
name: Run mypy
needs:
- ruff
- pytest
steps:
- name: Check out committed code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Prepare python
run: |
pip install uv
uv venv --seed venv
. venv/bin/activate
uv pip install -r requirements.txt -r requirements-test.txt
- name: Run mypy
run: |
. venv/bin/activate
pip list | grep -i mypy
mypy airos/

coverage:
name: Process test coverage
runs-on: ubuntu-latest
needs:
- ruff
- pytest
# - mypy
steps:
- name: Check out committed code
uses: actions/checkout@v4
- name: Prepare python
run: |
pip install uv
uv venv --seed venv
. venv/bin/activate
uv pip install -r requirements.txt -r requirements-test.txt
- name: Download all coverage artifacts
uses: actions/download-artifact@v4
- name: Combine coverage results
run: |
. venv/bin/activate
coverage combine coverage*/.coverage*
coverage report --fail-under=85
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test-publishing:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write
needs:
- coverage
# - mypy
steps:
- name: Check out committed code
uses: actions/checkout@v4
- name: Prepare uv
- name: Prepare python
run: |
pip install uv
uv venv --seed venv
Expand Down Expand Up @@ -68,3 +205,24 @@ jobs:
run: |
. venv/bin/activate
uv publish --publish-url https://test.pypi.org/legacy/


complexity:
name: Process test complexity
runs-on: ubuntu-latest
needs:
- coverage
steps:
- name: Check out committed code
uses: actions/checkout@v4
- name: Prepare python
run: |
pip install uv
uv venv --seed venv
. venv/bin/activate
uv pip install -r requirements.txt -r requirements-test.txt
- name: Run complexity report (click to view details)
run: |
. venv/bin/activate
echo "Showing complexity higher or equal to 'C'"
radon cc airos/ tests/ -s -nc --no-assert
11 changes: 8 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
pytest
pytest-asyncio
aiohttp
ruff==0.12.3
pytest==8.4.1
pytest-asyncio==1.0.0
pytest-cov==6.2.1
coverage==7.9.2
aioresponses
aioresponses==0.7.8
aiofiles==24.1.0
radon==6.0.1
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
asyncio
aiohttp
aiohttp==3.12.14
asyncio==3.4.3
Loading