initial commit
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
name: Python Code Quality Pipeline
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-version:
|
||||
description: 'Python version to use (e.g., "3.12")'
|
||||
required: false
|
||||
type: string
|
||||
default: "3.12"
|
||||
working-directory:
|
||||
description: 'Working directory for the project'
|
||||
required: false
|
||||
type: string
|
||||
default: "."
|
||||
skip-mypy:
|
||||
description: 'Skip mypy type checking'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
skip-pyupgrade:
|
||||
description: 'Skip pyupgrade check'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
uv-extras:
|
||||
description: 'UV extras to install (e.g., "dev,test")'
|
||||
required: false
|
||||
type: string
|
||||
default: "all-extras"
|
||||
|
||||
jobs:
|
||||
code-quality:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ inputs.working-directory }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install uv
|
||||
run: pip install uv
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
UV_LINK_MODE: copy
|
||||
run: |
|
||||
if [ "${{ inputs.uv-extras }}" = "all-extras" ]; then
|
||||
uv sync --all-extras
|
||||
else
|
||||
uv sync --extra ${{ inputs.uv-extras }}
|
||||
fi
|
||||
|
||||
- name: Type check with mypy
|
||||
if: ${{ !inputs.skip-mypy }}
|
||||
run: uv run mypy .
|
||||
|
||||
- name: Ruff lint
|
||||
run: uv run ruff check .
|
||||
|
||||
- name: Ruff format
|
||||
run: uv run ruff format --check .
|
||||
|
||||
- name: Pyupgrade check
|
||||
if: ${{ !inputs.skip-pyupgrade }}
|
||||
run: uv run pyupgrade --py312-plus $(git ls-files '*.py') && git diff --exit-code
|
||||
Reference in New Issue
Block a user