style: apply Prettier formatting to TS/JS/JSON/MD files
Add Prettier as a dev dependency with .prettierrc.json config and .prettierignore. Hook added via mirrors-prettier in pre-commit config. All TypeScript, JSON, Markdown, and YAML files auto-formatted. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
388
.github/workflows/ci.yml
vendored
388
.github/workflows/ci.yml
vendored
@@ -1,194 +1,194 @@
|
||||
name: CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
|
||||
jobs:
|
||||
# TypeScript/Node.js tests
|
||||
typescript-tests:
|
||||
name: TypeScript Build & Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-24.04, ubuntu-22.04, windows-latest, macos-latest]
|
||||
node-version: [18.x, 20.x, 22.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run TypeScript compiler
|
||||
run: npm run build
|
||||
|
||||
- name: Run linter
|
||||
run: npm run lint || echo "Linter not configured yet"
|
||||
|
||||
- name: Run tests
|
||||
run: npm test || echo "Tests not configured yet"
|
||||
|
||||
# Python tests
|
||||
python-tests:
|
||||
name: Python Tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-24.04, ubuntu-22.04]
|
||||
python-version: ['3.10', '3.11', '3.12']
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'pip'
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest pytest-cov black mypy pylint
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||||
|
||||
- name: Run Black formatter check
|
||||
run: black --check python/ || echo "Black not configured yet"
|
||||
|
||||
- name: Run MyPy type checker
|
||||
run: mypy python/ || echo "MyPy not configured yet"
|
||||
|
||||
- name: Run Pylint
|
||||
run: pylint python/ || echo "Pylint not configured yet"
|
||||
|
||||
- name: Run pytest
|
||||
run: pytest python/ --cov=python --cov-report=xml || echo "Tests not configured yet"
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
flags: python
|
||||
name: python-${{ matrix.python-version }}
|
||||
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04'
|
||||
|
||||
# Integration tests (requires KiCAD)
|
||||
integration-tests:
|
||||
name: Integration Tests (Linux + KiCAD)
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
cache: 'pip'
|
||||
|
||||
- name: Add KiCAD PPA and Install KiCAD 9.0
|
||||
run: |
|
||||
sudo add-apt-repository --yes ppa:kicad/kicad-9.0-releases
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y kicad kicad-libraries
|
||||
|
||||
- name: Verify KiCAD installation
|
||||
run: |
|
||||
kicad-cli version || echo "kicad-cli not found"
|
||||
python3 -c "import pcbnew; print(f'pcbnew version: {pcbnew.GetBuildVersion()}')" || echo "pcbnew module not found"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Build TypeScript
|
||||
run: npm run build
|
||||
|
||||
- name: Run integration tests
|
||||
run: |
|
||||
echo "Integration tests not yet configured"
|
||||
# pytest tests/integration/
|
||||
|
||||
# Docker build test
|
||||
docker-build:
|
||||
name: Docker Build Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
echo "Docker build not yet configured"
|
||||
# docker build -t kicad-mcp-server:test .
|
||||
|
||||
# Code quality checks
|
||||
code-quality:
|
||||
name: Code Quality
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run ESLint
|
||||
run: npx eslint src/ || echo "ESLint not configured yet"
|
||||
|
||||
- name: Run Prettier check
|
||||
run: npx prettier --check "src/**/*.ts" || echo "Prettier not configured yet"
|
||||
|
||||
- name: Check for security vulnerabilities
|
||||
run: npm audit --audit-level=moderate || echo "No critical vulnerabilities"
|
||||
|
||||
# Documentation check
|
||||
docs-check:
|
||||
name: Documentation Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check README exists
|
||||
run: test -f README.md
|
||||
|
||||
- name: Check for broken links in docs
|
||||
run: |
|
||||
sudo apt-get install -y linkchecker || true
|
||||
# linkchecker docs/ || echo "Link checker not configured"
|
||||
|
||||
- name: Validate JSON files
|
||||
run: |
|
||||
find . -name "*.json" -not -path "./node_modules/*" -not -path "./dist/*" | xargs -I {} sh -c 'python3 -m json.tool {} > /dev/null && echo "✓ {}" || echo "✗ {}"'
|
||||
name: CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
|
||||
jobs:
|
||||
# TypeScript/Node.js tests
|
||||
typescript-tests:
|
||||
name: TypeScript Build & Test
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-24.04, ubuntu-22.04, windows-latest, macos-latest]
|
||||
node-version: [18.x, 20.x, 22.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run TypeScript compiler
|
||||
run: npm run build
|
||||
|
||||
- name: Run linter
|
||||
run: npm run lint || echo "Linter not configured yet"
|
||||
|
||||
- name: Run tests
|
||||
run: npm test || echo "Tests not configured yet"
|
||||
|
||||
# Python tests
|
||||
python-tests:
|
||||
name: Python Tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-24.04, ubuntu-22.04]
|
||||
python-version: ["3.10", "3.11", "3.12"]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: "pip"
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest pytest-cov black mypy pylint
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||||
|
||||
- name: Run Black formatter check
|
||||
run: black --check python/ || echo "Black not configured yet"
|
||||
|
||||
- name: Run MyPy type checker
|
||||
run: mypy python/ || echo "MyPy not configured yet"
|
||||
|
||||
- name: Run Pylint
|
||||
run: pylint python/ || echo "Pylint not configured yet"
|
||||
|
||||
- name: Run pytest
|
||||
run: pytest python/ --cov=python --cov-report=xml || echo "Tests not configured yet"
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
file: ./coverage.xml
|
||||
flags: python
|
||||
name: python-${{ matrix.python-version }}
|
||||
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04'
|
||||
|
||||
# Integration tests (requires KiCAD)
|
||||
integration-tests:
|
||||
name: Integration Tests (Linux + KiCAD)
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.x"
|
||||
cache: "npm"
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
cache: "pip"
|
||||
|
||||
- name: Add KiCAD PPA and Install KiCAD 9.0
|
||||
run: |
|
||||
sudo add-apt-repository --yes ppa:kicad/kicad-9.0-releases
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y kicad kicad-libraries
|
||||
|
||||
- name: Verify KiCAD installation
|
||||
run: |
|
||||
kicad-cli version || echo "kicad-cli not found"
|
||||
python3 -c "import pcbnew; print(f'pcbnew version: {pcbnew.GetBuildVersion()}')" || echo "pcbnew module not found"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Build TypeScript
|
||||
run: npm run build
|
||||
|
||||
- name: Run integration tests
|
||||
run: |
|
||||
echo "Integration tests not yet configured"
|
||||
# pytest tests/integration/
|
||||
|
||||
# Docker build test
|
||||
docker-build:
|
||||
name: Docker Build Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
echo "Docker build not yet configured"
|
||||
# docker build -t kicad-mcp-server:test .
|
||||
|
||||
# Code quality checks
|
||||
code-quality:
|
||||
name: Code Quality
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.x"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run ESLint
|
||||
run: npx eslint src/ || echo "ESLint not configured yet"
|
||||
|
||||
- name: Run Prettier check
|
||||
run: npx prettier --check "src/**/*.ts" || echo "Prettier not configured yet"
|
||||
|
||||
- name: Check for security vulnerabilities
|
||||
run: npm audit --audit-level=moderate || echo "No critical vulnerabilities"
|
||||
|
||||
# Documentation check
|
||||
docs-check:
|
||||
name: Documentation Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check README exists
|
||||
run: test -f README.md
|
||||
|
||||
- name: Check for broken links in docs
|
||||
run: |
|
||||
sudo apt-get install -y linkchecker || true
|
||||
# linkchecker docs/ || echo "Link checker not configured"
|
||||
|
||||
- name: Validate JSON files
|
||||
run: |
|
||||
find . -name "*.json" -not -path "./node_modules/*" -not -path "./dist/*" | xargs -I {} sh -c 'python3 -m json.tool {} > /dev/null && echo "✓ {}" || echo "✗ {}"'
|
||||
|
||||
Reference in New Issue
Block a user