mirror of
https://github.com/samerfarida/mcp-ssh-orchestrator.git
synced 2026-11-19 02:14:04 +00:00
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Sammy Farida <samer.farida@yahoo.com>
124 lines
3.3 KiB
YAML
124 lines
3.3 KiB
YAML
name: Lint Code
|
|
|
|
# Top-level permissions set to read-only for OSSF Scorecard Token-Permissions check
|
|
# See: https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
branches: [main, develop]
|
|
paths:
|
|
- 'src/**/*.py'
|
|
- 'tests/**/*.py'
|
|
- 'pyproject.toml'
|
|
- 'setup.py'
|
|
- '.github/workflows/*.yml'
|
|
pull_request:
|
|
branches: [main]
|
|
# Paths filter removed - workflows run on all PRs but skip jobs when only docs change
|
|
|
|
jobs:
|
|
check-changes:
|
|
name: Check for code changes
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
has-code-changes: ${{ steps.filter.outputs.src == 'true' || steps.filter.outputs.tests == 'true' || steps.filter.outputs.config == 'true' }}
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Check for code changes
|
|
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
src:
|
|
- 'src/**/*.py'
|
|
tests:
|
|
- 'tests/**/*.py'
|
|
config:
|
|
- 'pyproject.toml'
|
|
- 'setup.py'
|
|
- '.github/workflows/*.yml'
|
|
|
|
|
|
ruff:
|
|
name: Ruff Linting
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.has-code-changes == 'true'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -e ".[dev]"
|
|
|
|
- name: Run ruff check
|
|
run: ruff check src/ tests/ --output-format=github
|
|
|
|
black:
|
|
name: Black Formatting
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.has-code-changes == 'true'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -e ".[dev]"
|
|
|
|
- name: Run black
|
|
run: black --check --diff src/ tests/
|
|
|
|
mypy:
|
|
name: Type Checking
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.has-code-changes == 'true'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -e ".[dev]"
|
|
|
|
- name: Run mypy
|
|
run: mypy src/ --ignore-missing-imports
|
|
continue-on-error: true
|
|
|
|
skip-docs-only:
|
|
name: Skip (docs only)
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.has-code-changes != 'true'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
steps:
|
|
- name: Skip workflow
|
|
run: echo "Documentation-only PR - lint checks skipped"
|