Skip to content

Commit aedb6e6

Browse files
committed
Enhance static check workflow with file existence checks
Added checks for requirements.txt and pyproject.toml existence before installing dependencies and analyzing code.
1 parent 14cacbc commit aedb6e6

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

.github/workflows/static-check.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,42 @@ jobs:
1515
uses: actions/setup-python@v3
1616
with:
1717
python-version: ${{ matrix.python-version }}
18-
- name: Install dependencies
18+
- name: Check requirements.txt exists
19+
id: check_req
20+
run: |
21+
if [ -f requirements.txt ]; then
22+
echo "requirements_exists=true" >> $GITHUB_OUTPUT
23+
else
24+
echo "requirements_exists=false" >> $GITHUB_OUTPUT
25+
fi
26+
if [ -f pyproject.toml ]; then
27+
echo "pyproject_exists=true" >> $GITHUB_OUTPUT
28+
else
29+
echo "pyproject_exists=false" >> $GITHUB_OUTPUT
30+
fi
31+
- name: Install dependencies by requirements.txt
32+
id: install_deps_req
33+
if: ${{ steps.check_req.outputs.requirements_exists == 'true' }}
1934
run: |
2035
python -m pip install --upgrade pylint
2136
python -m pip install --upgrade isort
2237
python -m pip install -r requirements.txt
38+
echo "dependencies_installed=true" >> $GITHUB_OUTPUT
2339
- name: Analysing the code with pylint
40+
if: ${{ steps.check_req.outputs.requirements_exists == 'true' }}
2441
run: |
2542
isort $(git ls-files '*.py') --check-only --diff
2643
pylint $(git ls-files '*.py')
44+
- name: Install dependencies by uv
45+
id: install_deps_uv
46+
if: ${{ steps.check_req.outputs.pyproject_exists == 'true' }}
47+
run: |
48+
python -m pip install uv
49+
uv sync
50+
uv pip install pylint
51+
uv pip install isort
52+
- name: Analysing the code with pylint
53+
if: ${{ steps.check_req.outputs.pyproject_exists == 'true' }}
54+
run: |
55+
uv run isort $(git ls-files '*.py') --check-only --diff
56+
uv run pylint $(git ls-files '*.py')

0 commit comments

Comments
 (0)