Skip to content

Commit 2d16ed6

Browse files
authored
Update pylint workflow for Python 3.12 and caching
1 parent 431c49d commit 2d16ed6

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/pylint.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Python 3.12
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v4
23+
with:
24+
version: "latest"
25+
enable-cache: true
26+
27+
- name: Install dependencies
28+
run: uv sync
29+
30+
- name: Check Python files exist
31+
id: check_files
32+
run: |
33+
if [ -z "$(git ls-files '*.py')" ]; then
34+
echo "No Python files found"
35+
echo "has_python_files=false" >> $GITHUB_OUTPUT
36+
else
37+
echo "has_python_files=true" >> $GITHUB_OUTPUT
38+
fi
39+
40+
- name: Run pylint
41+
if: steps.check_files.outputs.has_python_files == 'true'
42+
run: |
43+
uv run pylint $(git ls-files '*.py') \
44+
--output-format=colorized \
45+
--score=yes
46+
continue-on-error: false
47+
48+
- name: Run pylint with report
49+
if: steps.check_files.outputs.has_python_files == 'true' && failure()
50+
run: |
51+
uv run pylint $(git ls-files '*.py') \
52+
--output-format=text \
53+
--reports=yes > pylint-report.txt || true
54+
55+
- name: Upload pylint report
56+
if: failure()
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: pylint-report
60+
path: pylint-report.txt

0 commit comments

Comments
 (0)