Skip to content

Commit dd2f420

Browse files
committed
Add a lint runner using a rocky8 container for realistic env as explained on
https://www.claudiokuenzler.com/blog/1381/how-to-run-github-ci-cd-workflows-actions-rocky-linux
1 parent 002261a commit dd2f420

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/python-sanity-check.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,36 @@ jobs:
4646
# run: |
4747
# pytest
4848

49+
lint-python2-rocky8:
50+
runs-on: ubuntu-22.04
51+
container:
52+
image: rockylinux/rockylinux:8
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: Set up Python 2.7 with DNF and link to default
56+
run: |
57+
sudo dnf install -y python2 python2-pip
58+
- name: Install dependencies
59+
run: |
60+
python2 -m pip install --upgrade pip
61+
pip2 install flake8 pytest
62+
if [ -f requirements.txt ]; then pip2 install -r requirements.txt; fi
63+
- name: Lint with flake8
64+
run: |
65+
# TODO: fix unittest dir and remove from excludes
66+
# TODO: fix or migrate legacy grsfs-fuse dir and remove from excludes
67+
# TODO: should tests be included here - currently fail on py3-only FileNotFoundError, etc.
68+
# stop the build if there are Python syntax errors or undefined names
69+
flake8 . --exclude=tests,state,envhelp,fixture,output,unittest,grsfs-fuse,irclib.py,seafile-seahub_settings-template.py --count --select=E9,F63,F7,F82 --show-source --statistics
70+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
71+
flake8 . --exclude=tests,state,envhelp,fixture,output,unittest,grsfs-fuse,vm-proxy,irclib.py,seafile-seahub_settings-template.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
72+
# NOTE: for interactive clean up one can use current ignores
73+
# E501 Ignore long lines, E402 imports below top, E722 bare except,
74+
# F401 unused imports, F502 explicit list in str expand, F841 unused var,
75+
# E721 compare type instead of isinstance, W293 blank line with space,
76+
# C901 too complex get
77+
#flake8 mig --exclude=unittest,grsfs-fuse,vm-proxy,irclib.py,seafile-seahub_settings-template.py --ignore=E501,E402,E722,F401,F502,E713,F841,C901 --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
78+
# TODO: prepare and enable pytest
79+
#- name: Test with pytest
80+
# run: |
81+
# pytest

0 commit comments

Comments
 (0)