Skip to content

Commit bfe37ee

Browse files
committed
Switch from coverage and pylint to pytest-cov and ruff
1 parent 10f4742 commit bfe37ee

2 files changed

Lines changed: 18 additions & 30 deletions

File tree

.github/workflows/main.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,18 @@ jobs:
5656
restore-keys: |
5757
pip-${{ runner.os }}-
5858
pip-
59-
- name: Install apt requirements
60-
run: |
61-
sudo apt-get update
62-
sudo apt-get install gcc libssl-dev python3-dev swig
6359
- name: Install requirements
6460
run: |
6561
pip --cache-dir=.pip install --upgrade pip
66-
pip --cache-dir=.pip install pylint -r requirements.txt
67-
- name: Run Pylint
68-
run: pylint startup tests ./*.py 2>&1 | tee pylint.txt
69-
working-directory: ${{ github.workspace }}
62+
pip --cache-dir=.pip install -r requirements.txt
63+
- name: Lint with ruff
64+
uses: astral-sh/ruff-action@v4.1.0
65+
args: check --exit-zero
7066
- name: Upload results
7167
uses: actions/upload-artifact@v7
7268
with:
7369
name: Lint
74-
path: |
75-
${{ github.workspace }}/pylint.txt
70+
path: ruff.txt
7671
if-no-files-found: error
7772
sast:
7873
# The SAST scanner action is based on Docker, and therefore does not work on ubuntu-slim.
@@ -114,27 +109,21 @@ jobs:
114109
sudo apt-get update
115110
sudo apt-get install -y bleachbit chkrootkit fwupd rkhunter modemmanager
116111
pip --cache-dir=.pip install --upgrade pip
117-
pip --cache-dir=.pip install coverage
118112
pip --cache-dir=.pip install -r requirements.txt
119-
- name: Run tests with coverage
120-
run: coverage run
121-
working-directory: ${{ github.workspace }}
122-
- name: Create coverage reports
113+
- name: Run tests
123114
run: |
124-
coverage report | tee coverage.txt
125-
coverage html
126-
coverage xml
127-
coverage json
128-
working-directory: ${{ github.workspace }}
115+
set -o pipefail
116+
pytest | tee test-output.txt
129117
- name: Upload results
130118
uses: actions/upload-artifact@v7
131119
with:
132120
name: Coverage
133121
path: |
134-
${{ github.workspace }}/coverage.txt
135-
${{ github.workspace }}/coverage.xml
136-
${{ github.workspace }}/coverage.json
137-
${{ github.workspace }}/htmlcov
122+
.test_durations
123+
coverage.xml
124+
coverage.json
125+
htmlcov
126+
test-output.txt
138127
if-no-files-found: error
139128
- name: Upload results to Codecov
140129
uses: codecov/codecov-action@v7

requirements.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# adb >= 1.3.0
55

66
# chkcrontab >= 1.7
7-
87
exif >= 1.6.0
98

109
# gplaycli >= 3.29
@@ -14,17 +13,17 @@ exif >= 1.6.0
1413
# TODO: Try this instead.
1514
# https://github.com/89z/googleplay
1615

16+
pytest >= 9.1.1
17+
pytest-cov >= 7.1.0
18+
1719
# For Wacom script
1820
# Despite the warning from FOSSA, python-xlib is licensed with LGPLv2+
1921
# https://github.com/python-xlib/python-xlib
2022
# https://pypi.org/project/python-xlib/
2123
python-xlib >= 0.33
2224

2325
# qmk >= 1.0.0
24-
2526
requests >= 2.32.3
26-
27-
# For LibreNMS log spam cleaner
28-
slack-cleaner2 >= 3.2.7
29-
27+
ruff >= 0.16.6
28+
slack-cleaner2 >= 3.2.7 # For LibreNMS log spam cleaner
3029
# tasmotizer >= 1.2.1

0 commit comments

Comments
 (0)