60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
name: Code Style Checks
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
style-checks:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.11"] # Removed 3.12+ as minimal sets the standard. Adjust Python version matrix if needed
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.head_ref }} # Checkout the PR branch
|
|
fetch-depth: 0 # Fetch all history for all branches and tags
|
|
|
|
- name: Set up python
|
|
id: setup-python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
with:
|
|
enable-cache: true
|
|
activate-environment: true
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
uv sync --extra dev --extra postgres --extra external-tools
|
|
|
|
- name: Validate PR Title
|
|
if: github.event_name == 'pull_request'
|
|
uses: amannn/action-semantic-pull-request@v5
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Run Pyright
|
|
uses: jakebailey/pyright-action@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
level: "error"
|
|
continue-on-error: true
|
|
|
|
- name: Run isort
|
|
run: uv run isort --profile black --check-only --diff .
|
|
|
|
- name: Run Black
|
|
run: uv run black --check .
|
|
|
|
- name: Run Autoflake
|
|
run: uv run autoflake --remove-all-unused-imports --remove-unused-variables --in-place --recursive --ignore-init-module-imports .
|