Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions workflow-templates/aie-bauteil-ci.properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "AIE Bauteil CI",
"description": "Standard CI für AIE-Bauteile mit ruff/black/bandit/pytest (Python 3.11+3.12 Matrix, least-privilege)",
"iconName": "python",
"categories": ["Python", "AIE"],
"filePatterns": ["pyproject.toml$", "requirements.*\\.txt$", "setup\\.py$"]
}
113 changes: 113 additions & 0 deletions workflow-templates/aie-bauteil-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
# AIE-Bauteil CI - Org-weite Default-Vorlage
# Standard-CI für AIE-Bauteile (AI Engineering at)
# Tools: ruff (lint) + black (format) + bandit (security) + pytest (tests)
# Python 3.11 + 3.12 Matrix, least-privilege Permissions

name: AIE Bauteil CI

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:

# Least-privilege: read-only default; jobs erhalten nur was sie brauchen
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
name: Lint (ruff + black)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install lint tools
run: |
python -m pip install --upgrade pip
pip install ruff black

- name: Ruff check
run: ruff check .

- name: Black format check
run: black --check .

security:
name: Security (bandit)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install bandit
run: |
python -m pip install --upgrade pip
pip install bandit[toml]

- name: Bandit scan
run: bandit -r . -ll -x ./tests,./test

test:
name: Test (pytest, Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
if [ -f pyproject.toml ]; then pip install -e ".[dev]" || pip install -e . || true; fi
pip install pytest pytest-cov

- name: Run pytest
run: |
if [ -d tests ] || [ -d test ]; then
pytest --cov --cov-report=term-missing -q
else
echo "Keine tests/ oder test/ Verzeichnisse - skip"
fi