@@ -24,16 +24,153 @@ jobs:
2424 - name : Run ShellCheck
2525 uses : ludeeus/action-shellcheck@master
2626
27+ ruff :
28+ runs-on : ubuntu-latest
29+ name : Ruff check and force
30+ steps :
31+ - name : Check out committed code
32+ uses : actions/checkout@v4
33+ with :
34+ persist-credentials : false
35+ - name : Prepare python
36+ run : |
37+ pip install uv
38+ uv venv --seed venv
39+ . venv/bin/activate
40+ uv pip install ruff -r requirements.txt -r requirements-test.txt
41+ - name : Ruff (with fix)
42+ run : |
43+ . venv/bin/activate
44+ ruff check airos/ tests/
45+ - name : If needed, commit ruff changes to the pull request
46+ if : failure()
47+ run : |
48+ . venv/bin/activate
49+ ruff format airos/ tests/
50+ git config --global user.name 'autoruff'
51+ git config --global user.email '[email protected] ' 52+ git remote set-url origin https://x-access-token:${{ secrets.PAT_CT }}@github.com/$GITHUB_REPOSITORY
53+ git checkout $GITHUB_HEAD_REF
54+ git commit -am "fixup: ${GITHUB_REF##*/} Python code fixed using ruff"
55+ git push origin ${GITHUB_REF##*/}
56+
57+ commitcheck :
58+ runs-on : ubuntu-latest
59+ name : Check commit
60+ needs :
61+ - ruff
62+ steps :
63+ - name : Check out committed code
64+ uses : actions/checkout@v4
65+ - name : Prepare python
66+ run : |
67+ pip install uv
68+ uv venv --seed venv
69+ . venv/bin/activate
70+ uv pip install pre-commit -r requirements.txt -r requirements-test.txt
71+ pre-commit install
72+ pre-commit install-hooks
73+ - name : Full pre-commit
74+ run : |
75+ . venv/bin/activate
76+ pre-commit run --show-diff-on-failure --color=always --all-files
77+
78+ pytest :
79+ runs-on : ubuntu-latest
80+ name : Run pytest using Python ${{ matrix.python-version }}
81+ needs :
82+ - ruff
83+ - commitcheck
84+ strategy :
85+ matrix :
86+ python-version : ["3.13"]
87+ steps :
88+ - name : Check out committed code
89+ uses : actions/checkout@v4
90+ - name : Prepare python
91+ run : |
92+ pip install uv
93+ uv venv --seed venv
94+ . venv/bin/activate
95+ uv pip install -r requirements.txt -r requirements-test.txt
96+ - name : Run all tests
97+ run : |
98+ . venv/bin/activate
99+ pytest --log-level info tests/*.py --cov='.'
100+ - name : Upload coverage artifact
101+ uses : actions/upload-artifact@v4
102+ with :
103+ name : coverage-${{ matrix.python-version }}
104+ path : .coverage
105+ if-no-files-found : error
106+ include-hidden-files : true
107+
108+ mypy :
109+ if : false # disables the job --> "Code is not up to par for mypy, skipping"
110+ runs-on : ubuntu-latest
111+ name : Run mypy
112+ needs :
113+ - ruff
114+ - pytest
115+ steps :
116+ - name : Check out committed code
117+ uses : actions/checkout@v4
118+ with :
119+ persist-credentials : false
120+ - name : Prepare python
121+ run : |
122+ pip install uv
123+ uv venv --seed venv
124+ . venv/bin/activate
125+ uv pip install -r requirements.txt -r requirements-test.txt
126+ - name : Run mypy
127+ run : |
128+ . venv/bin/activate
129+ pip list | grep -i mypy
130+ mypy airos/
131+
132+ coverage :
133+ name : Process test coverage
134+ runs-on : ubuntu-latest
135+ needs :
136+ - ruff
137+ - pytest
138+ # - mypy
139+ steps :
140+ - name : Check out committed code
141+ uses : actions/checkout@v4
142+ - name : Prepare python
143+ run : |
144+ pip install uv
145+ uv venv --seed venv
146+ . venv/bin/activate
147+ uv pip install -r requirements.txt -r requirements-test.txt
148+ - name : Download all coverage artifacts
149+ uses : actions/download-artifact@v4
150+ - name : Combine coverage results
151+ run : |
152+ . venv/bin/activate
153+ coverage combine coverage*/.coverage*
154+ coverage report --fail-under=85
155+ coverage xml
156+ - name : Upload coverage to Codecov
157+ uses : codecov/codecov-action@v5
158+ env :
159+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
160+
27161 test-publishing :
28162 name : Build and publish Python 🐍 distributions 📦 to TestPyPI
29163 runs-on : ubuntu-latest
30164 environment : testpypi
31165 permissions :
32166 id-token : write
167+ needs :
168+ - coverage
169+ # - mypy
33170 steps :
34171 - name : Check out committed code
35172 uses : actions/checkout@v4
36- - name : Prepare uv
173+ - name : Prepare python
37174 run : |
38175 pip install uv
39176 uv venv --seed venv
@@ -68,3 +205,24 @@ jobs:
68205 run : |
69206 . venv/bin/activate
70207 uv publish --publish-url https://test.pypi.org/legacy/
208+
209+
210+ complexity :
211+ name : Process test complexity
212+ runs-on : ubuntu-latest
213+ needs :
214+ - coverage
215+ steps :
216+ - name : Check out committed code
217+ uses : actions/checkout@v4
218+ - name : Prepare python
219+ run : |
220+ pip install uv
221+ uv venv --seed venv
222+ . venv/bin/activate
223+ uv pip install -r requirements.txt -r requirements-test.txt
224+ - name : Run complexity report (click to view details)
225+ run : |
226+ . venv/bin/activate
227+ echo "Showing complexity higher or equal to 'C'"
228+ radon cc airos/ tests/ -s -nc --no-assert
0 commit comments