mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 04:09:53 +08:00
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
name: Linting and Formatting
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- develop
|
|
|
|
jobs:
|
|
python-lint:
|
|
name: Python Linting
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Cache pre-commit
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pre-commit
|
|
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
|
|
restore-keys: |
|
|
pre-commit-
|
|
|
|
- name: Install pre-commit
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install pre-commit tomli
|
|
|
|
- name: Run pre-commit on Python files
|
|
run: |
|
|
echo "Running pre-commit hooks on Python files..."
|
|
pre-commit run --all-files --verbose 2>&1 || {
|
|
echo "Pre-commit checks failed! Run 'pre-commit run --all-files' locally to fix."
|
|
exit 1
|
|
}
|