-
Notifications
You must be signed in to change notification settings - Fork 4
54 lines (47 loc) · 2.27 KB
/
python-sanity-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "edge" ]
pull_request:
branches: [ "edge" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# NOTE: python-2 is no longer supported here - try with apt
#- name: Set up Python 3.10
# uses: actions/setup-python@v3
# with:
# python-version: "3.10"
- name: Set up Python 2.7 with APT and link to default
run: |
sudo apt install -y python2 python-pip
#ln -s python2 /usr/bin/python
- name: Install dependencies
run: |
python2 -m pip install --upgrade pip
pip2 install flake8 pytest
if [ -f requirements.txt ]; then pip2 install -r requirements.txt; fi
- name: Lint with flake8
run: |
# TODO: fix unittest dir and remove from excludes
# TODO: fix or migrate legacy grsfs-fuse dir and remove from excludes
# stop the build if there are Python syntax errors or undefined names
flake8 mig --exclude=unittest,grsfs-fuse,irclib.py,seafile-seahub_settings-template.py --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 mig --exclude=unittest,grsfs-fuse,vm-proxy,irclib.py,seafile-seahub_settings-template.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# NOTE: for interactive clean up one can use current ignores
# E501 Ignore long lines, E402 imports below top, E722 bare except,
# F401 unused imports, F502 explicit list in str expand, F841 unused var,
# E721 compare type instead of isinstance, W293 blank line with space,
# C901 too complex get
#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
# TODO: prepare and enable pytest
#- name: Test with pytest
# run: |
# pytest