chore(ci): harden workflow defaults and append chantier audit block
Add workflow permissions/concurrency/timeouts and persist current chantier audit section in README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+204
-194
@@ -1,194 +1,204 @@
|
|||||||
name: CI/CD Pipeline
|
name: CI/CD Pipeline
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, develop ]
|
branches: [ main, develop ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, develop ]
|
branches: [ main, develop ]
|
||||||
|
|
||||||
jobs:
|
permissions:
|
||||||
# TypeScript/Node.js tests
|
contents: read
|
||||||
typescript-tests:
|
|
||||||
name: TypeScript Build & Test
|
concurrency:
|
||||||
runs-on: ${{ matrix.os }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
strategy:
|
cancel-in-progress: true
|
||||||
matrix:
|
|
||||||
os: [ubuntu-24.04, ubuntu-22.04, windows-latest, macos-latest]
|
jobs:
|
||||||
node-version: [18.x, 20.x, 22.x]
|
# TypeScript/Node.js tests
|
||||||
|
typescript-tests:
|
||||||
steps:
|
name: TypeScript Build & Test
|
||||||
- name: Checkout code
|
runs-on: ${{ matrix.os }}
|
||||||
uses: actions/checkout@v4
|
strategy:
|
||||||
|
matrix:
|
||||||
- name: Setup Node.js ${{ matrix.node-version }}
|
os: [ubuntu-24.04, ubuntu-22.04, windows-latest, macos-latest]
|
||||||
uses: actions/setup-node@v4
|
node-version: [18.x, 20.x, 22.x]
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node-version }}
|
steps:
|
||||||
cache: 'npm'
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
- name: Setup Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
- name: Run TypeScript compiler
|
with:
|
||||||
run: npm run build
|
node-version: ${{ matrix.node-version }}
|
||||||
|
cache: 'npm'
|
||||||
- name: Run linter
|
|
||||||
run: npm run lint || echo "Linter not configured yet"
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
- name: Run tests
|
|
||||||
run: npm test || echo "Tests not configured yet"
|
- name: Run TypeScript compiler
|
||||||
|
run: npm run build
|
||||||
# Python tests
|
|
||||||
python-tests:
|
- name: Run linter
|
||||||
name: Python Tests
|
run: npm run lint || echo "Linter not configured yet"
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
- name: Run tests
|
||||||
matrix:
|
run: npm test || echo "Tests not configured yet"
|
||||||
os: [ubuntu-24.04, ubuntu-22.04]
|
|
||||||
python-version: ['3.10', '3.11', '3.12']
|
# Python tests
|
||||||
|
python-tests:
|
||||||
steps:
|
name: Python Tests
|
||||||
- name: Checkout code
|
runs-on: ${{ matrix.os }}
|
||||||
uses: actions/checkout@v4
|
strategy:
|
||||||
|
matrix:
|
||||||
- name: Setup Python ${{ matrix.python-version }}
|
os: [ubuntu-24.04, ubuntu-22.04]
|
||||||
uses: actions/setup-python@v5
|
python-version: ['3.10', '3.11', '3.12']
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
steps:
|
||||||
cache: 'pip'
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Install Python dependencies
|
|
||||||
run: |
|
- name: Setup Python ${{ matrix.python-version }}
|
||||||
python -m pip install --upgrade pip
|
uses: actions/setup-python@v5
|
||||||
pip install pytest pytest-cov black mypy pylint
|
with:
|
||||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
python-version: ${{ matrix.python-version }}
|
||||||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
cache: 'pip'
|
||||||
|
|
||||||
- name: Run Black formatter check
|
- name: Install Python dependencies
|
||||||
run: black --check python/ || echo "Black not configured yet"
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
- name: Run MyPy type checker
|
pip install pytest pytest-cov black mypy pylint
|
||||||
run: mypy python/ || echo "MyPy not configured yet"
|
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 Pylint
|
|
||||||
run: pylint python/ || echo "Pylint not configured yet"
|
- name: Run Black formatter check
|
||||||
|
run: black --check python/ || echo "Black not configured yet"
|
||||||
- name: Run pytest
|
|
||||||
run: pytest python/ --cov=python --cov-report=xml || echo "Tests not configured yet"
|
- name: Run MyPy type checker
|
||||||
|
run: mypy python/ || echo "MyPy not configured yet"
|
||||||
- name: Upload coverage to Codecov
|
|
||||||
uses: codecov/codecov-action@v4
|
- name: Run Pylint
|
||||||
with:
|
run: pylint python/ || echo "Pylint not configured yet"
|
||||||
file: ./coverage.xml
|
|
||||||
flags: python
|
- name: Run pytest
|
||||||
name: python-${{ matrix.python-version }}
|
run: pytest python/ --cov=python --cov-report=xml || echo "Tests not configured yet"
|
||||||
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04'
|
|
||||||
|
- name: Upload coverage to Codecov
|
||||||
# Integration tests (requires KiCAD)
|
uses: codecov/codecov-action@v4
|
||||||
integration-tests:
|
with:
|
||||||
name: Integration Tests (Linux + KiCAD)
|
file: ./coverage.xml
|
||||||
runs-on: ubuntu-24.04
|
flags: python
|
||||||
|
name: python-${{ matrix.python-version }}
|
||||||
steps:
|
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-24.04'
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
# Integration tests (requires KiCAD)
|
||||||
|
integration-tests:
|
||||||
- name: Setup Node.js
|
name: Integration Tests (Linux + KiCAD)
|
||||||
uses: actions/setup-node@v4
|
runs-on: ubuntu-24.04
|
||||||
with:
|
|
||||||
node-version: '20.x'
|
steps:
|
||||||
cache: 'npm'
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Setup Python
|
|
||||||
uses: actions/setup-python@v5
|
- name: Setup Node.js
|
||||||
with:
|
uses: actions/setup-node@v4
|
||||||
python-version: '3.12'
|
with:
|
||||||
cache: 'pip'
|
node-version: '20.x'
|
||||||
|
cache: 'npm'
|
||||||
- name: Add KiCAD PPA and Install KiCAD 9.0
|
|
||||||
run: |
|
- name: Setup Python
|
||||||
sudo add-apt-repository --yes ppa:kicad/kicad-9.0-releases
|
uses: actions/setup-python@v5
|
||||||
sudo apt-get update
|
with:
|
||||||
sudo apt-get install -y kicad kicad-libraries
|
python-version: '3.12'
|
||||||
|
cache: 'pip'
|
||||||
- name: Verify KiCAD installation
|
|
||||||
run: |
|
- name: Add KiCAD PPA and Install KiCAD 9.0
|
||||||
kicad-cli version || echo "kicad-cli not found"
|
run: |
|
||||||
python3 -c "import pcbnew; print(f'pcbnew version: {pcbnew.GetBuildVersion()}')" || echo "pcbnew module not found"
|
sudo add-apt-repository --yes ppa:kicad/kicad-9.0-releases
|
||||||
|
sudo apt-get update
|
||||||
- name: Install dependencies
|
sudo apt-get install -y kicad kicad-libraries
|
||||||
run: |
|
|
||||||
npm ci
|
- name: Verify KiCAD installation
|
||||||
pip install -r requirements.txt
|
run: |
|
||||||
|
kicad-cli version || echo "kicad-cli not found"
|
||||||
- name: Build TypeScript
|
python3 -c "import pcbnew; print(f'pcbnew version: {pcbnew.GetBuildVersion()}')" || echo "pcbnew module not found"
|
||||||
run: npm run build
|
|
||||||
|
- name: Install dependencies
|
||||||
- name: Run integration tests
|
run: |
|
||||||
run: |
|
npm ci
|
||||||
echo "Integration tests not yet configured"
|
pip install -r requirements.txt
|
||||||
# pytest tests/integration/
|
|
||||||
|
- name: Build TypeScript
|
||||||
# Docker build test
|
run: npm run build
|
||||||
docker-build:
|
|
||||||
name: Docker Build Test
|
- name: Run integration tests
|
||||||
runs-on: ubuntu-latest
|
run: |
|
||||||
|
echo "Integration tests not yet configured"
|
||||||
steps:
|
# pytest tests/integration/
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
# Docker build test
|
||||||
|
docker-build:
|
||||||
- name: Set up Docker Buildx
|
name: Docker Build Test
|
||||||
uses: docker/setup-buildx-action@v3
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
- name: Build Docker image
|
|
||||||
run: |
|
steps:
|
||||||
echo "Docker build not yet configured"
|
- name: Checkout code
|
||||||
# docker build -t kicad-mcp-server:test .
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Code quality checks
|
- name: Set up Docker Buildx
|
||||||
code-quality:
|
uses: docker/setup-buildx-action@v3
|
||||||
name: Code Quality
|
|
||||||
runs-on: ubuntu-latest
|
- name: Build Docker image
|
||||||
|
run: |
|
||||||
steps:
|
echo "Docker build not yet configured"
|
||||||
- name: Checkout code
|
# docker build -t kicad-mcp-server:test .
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
# Code quality checks
|
||||||
- name: Setup Node.js
|
code-quality:
|
||||||
uses: actions/setup-node@v4
|
name: Code Quality
|
||||||
with:
|
runs-on: ubuntu-latest
|
||||||
node-version: '20.x'
|
timeout-minutes: 20
|
||||||
|
|
||||||
- name: Install dependencies
|
steps:
|
||||||
run: npm ci
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
- name: Run ESLint
|
|
||||||
run: npx eslint src/ || echo "ESLint not configured yet"
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
- name: Run Prettier check
|
with:
|
||||||
run: npx prettier --check "src/**/*.ts" || echo "Prettier not configured yet"
|
node-version: '20.x'
|
||||||
|
|
||||||
- name: Check for security vulnerabilities
|
- name: Install dependencies
|
||||||
run: npm audit --audit-level=moderate || echo "No critical vulnerabilities"
|
run: npm ci
|
||||||
|
|
||||||
# Documentation check
|
- name: Run ESLint
|
||||||
docs-check:
|
run: npx eslint src/ || echo "ESLint not configured yet"
|
||||||
name: Documentation Check
|
|
||||||
runs-on: ubuntu-latest
|
- name: Run Prettier check
|
||||||
|
run: npx prettier --check "src/**/*.ts" || echo "Prettier not configured yet"
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
- name: Check for security vulnerabilities
|
||||||
uses: actions/checkout@v4
|
run: npm audit --audit-level=moderate || echo "No critical vulnerabilities"
|
||||||
|
|
||||||
- name: Check README exists
|
# Documentation check
|
||||||
run: test -f README.md
|
docs-check:
|
||||||
|
name: Documentation Check
|
||||||
- name: Check for broken links in docs
|
runs-on: ubuntu-latest
|
||||||
run: |
|
timeout-minutes: 20
|
||||||
sudo apt-get install -y linkchecker || true
|
|
||||||
# linkchecker docs/ || echo "Link checker not configured"
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
- name: Validate JSON files
|
uses: actions/checkout@v4
|
||||||
run: |
|
|
||||||
find . -name "*.json" -not -path "./node_modules/*" -not -path "./dist/*" | xargs -I {} sh -c 'python3 -m json.tool {} > /dev/null && echo "✓ {}" || echo "✗ {}"'
|
- 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 "✗ {}"'
|
||||||
|
|||||||
@@ -858,3 +858,51 @@ If you use this project in your research or publication, please cite:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- CHANTIER:AUDIT START -->
|
||||||
|
## Audit & Execution Plan (2026-03-10)
|
||||||
|
|
||||||
|
### Snapshot
|
||||||
|
- Priority: `P2`
|
||||||
|
- Tech profile: `node+python`
|
||||||
|
- Workflows: `yes`
|
||||||
|
- Tests: `yes`
|
||||||
|
- Debt markers: `0`
|
||||||
|
- Source files: `80`
|
||||||
|
|
||||||
|
### Corrections Prioritaires
|
||||||
|
- [ ] Normaliser scripts npm lint/test/build
|
||||||
|
- [ ] Ajouter/fiabiliser les commandes de vérification automatiques.
|
||||||
|
- [ ] Clore les points bloquants avant optimisation avancée.
|
||||||
|
|
||||||
|
### Optimisation
|
||||||
|
- [ ] Identifier le hotspot principal et mesurer avant/après.
|
||||||
|
- [ ] Réduire la complexité des modules les plus touchés.
|
||||||
|
|
||||||
|
### Mémoire chantier
|
||||||
|
- Control plane: `/Users/electron/.codex/memories/electron_rare_chantier`
|
||||||
|
- Repo card: `/Users/electron/.codex/memories/electron_rare_chantier/REPOS/KiCAD-MCP-Server.md`
|
||||||
|
|
||||||
|
<!-- CHANTIER:AUDIT END -->
|
||||||
|
|||||||
Reference in New Issue
Block a user