mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-05 20:51:25 -07:00
This main point is to normalize the sorting of imports in Python scripts. Currently the default setting from isort is used: https://pycqa.github.io/isort/docs/configuration/custom_sections_and_ordering.html PR #22793.
99 lines
2.6 KiB
YAML
99 lines
2.6 KiB
YAML
name: CI - Python
|
|
|
|
on: [pull_request, push]
|
|
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: ${{ github.head_ref != '' }}
|
|
|
|
jobs:
|
|
ci:
|
|
name: Check
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup python (auxiliary scripts)
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3' # use default version
|
|
|
|
- name: Install tools (auxiliary scripts)
|
|
run: pip install bandit isort pycodestyle pyflakes
|
|
|
|
- name: Gather files (auxiliary scripts)
|
|
run: |
|
|
export "PY_FILES=$(find . -type f -name '*.py' ! -path '*searchengine*' -printf '%p ')"
|
|
echo $PY_FILES
|
|
echo "PY_FILES=$PY_FILES" >> "$GITHUB_ENV"
|
|
|
|
- name: Lint code (auxiliary scripts)
|
|
run: |
|
|
pyflakes $PY_FILES
|
|
bandit --skip B101,B314,B405 $PY_FILES
|
|
|
|
- name: Format code (auxiliary scripts)
|
|
run: |
|
|
pycodestyle \
|
|
--max-line-length=1000 \
|
|
--statistics \
|
|
$PY_FILES
|
|
isort \
|
|
--check \
|
|
--diff \
|
|
$PY_FILES
|
|
|
|
- name: Build code (auxiliary scripts)
|
|
run: |
|
|
python -m compileall $PY_FILES
|
|
|
|
- name: Setup python (search engine)
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.9'
|
|
|
|
- name: Install tools (search engine)
|
|
run: pip install bandit isort mypy pycodestyle pyflakes pyright
|
|
|
|
- name: Gather files (search engine)
|
|
run: |
|
|
export "PY_FILES=$(find . -type f -name '*.py' -path '*searchengine*' ! -name 'socks.py' -printf '%p ')"
|
|
echo $PY_FILES
|
|
echo "PY_FILES=$PY_FILES" >> "$GITHUB_ENV"
|
|
|
|
- name: Check typings (search engine)
|
|
run: |
|
|
MYPYPATH="src/searchengine/nova3" \
|
|
mypy \
|
|
--follow-imports skip \
|
|
--strict \
|
|
$PY_FILES
|
|
pyright \
|
|
$PY_FILES
|
|
|
|
- name: Lint code (search engine)
|
|
run: |
|
|
pyflakes $PY_FILES
|
|
bandit --skip B110,B310,B314,B405 $PY_FILES
|
|
|
|
- name: Format code (search engine)
|
|
run: |
|
|
pycodestyle \
|
|
--ignore=E265,E402 \
|
|
--max-line-length=1000 \
|
|
--statistics \
|
|
$PY_FILES
|
|
isort \
|
|
--check \
|
|
--diff \
|
|
$PY_FILES
|
|
|
|
- name: Build code (search engine)
|
|
run: |
|
|
python -m compileall $PY_FILES
|