Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip packages
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install black flake8 mypy pytest pytest-cov pytest-asyncio
pip install -e .
- name: Check code formatting with black
run: |
black --check --diff .
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. Max line length 100 (black default is 88, but we allow some flexibility)
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=100 --statistics --exclude=venv,build,dist,.git
- name: Type check with mypy
run: |
# Run mypy, allowing some flexibility for the initial setup
mypy --ignore-missing-imports --no-strict-optional src/mcp_kicad || true
continue-on-error: true # Don't fail build on type errors initially
- name: Run tests with pytest
run: |
# Run tests in mock mode (no KiCad required)
pytest -v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Display coverage summary
run: |
echo "Coverage report generated. See detailed report in artifacts."
security-check:
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.11'
- name: Install safety
run: |
pip install safety
- name: Check for security vulnerabilities
run: |
pip install -r requirements.txt
safety check --json || true
continue-on-error: true
wheel-smoke:
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.11'
- name: Build wheel
run: |
python -m pip install --upgrade pip build
python -m build --wheel
- name: Install wheel in a clean environment
run: |
python -m venv .wheel-venv
.wheel-venv/bin/python -m pip install --upgrade pip
.wheel-venv/bin/python -m pip install dist/*.whl
- name: Load installed console entry points
run: |
.wheel-venv/bin/python scripts/smoke_test_entry_points.py
723dc76daThis file is pinned to the selected release. Download the original to open it in your design tool.