add Python syntax check and linting workflow
Some checks failed
Python syntax & lint / syntax-lint (push) Failing after 9s
Some checks failed
Python syntax & lint / syntax-lint (push) Failing after 9s
This commit is contained in:
38
.gitea/workflows/python-syntax.yml
Normal file
38
.gitea/workflows/python-syntax.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Python syntax & lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
pull_request:
|
||||
branches: ["**"]
|
||||
|
||||
jobs:
|
||||
syntax-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
pip install flake8
|
||||
|
||||
- name: Run Python syntax check
|
||||
run: |
|
||||
set -e
|
||||
files=$(git ls-files '*.py')
|
||||
if [ -z "$files" ]; then echo "No Python files to check"; exit 0; fi
|
||||
python -m py_compile $files
|
||||
|
||||
- name: Run flake8 lint
|
||||
run: |
|
||||
files=$(git ls-files '*.py')
|
||||
if [ -z "$files" ]; then echo "No Python files to lint"; exit 0; fi
|
||||
flake8 $files
|
||||
Reference in New Issue
Block a user