Skip to content

feat: Add templates and user management functionality #50

feat: Add templates and user management functionality

feat: Add templates and user management functionality #50

Workflow file for this run

name: 🐍 CI/CD Pipeline - Validation Python
on:
push:
branches: ['**']
pull_request:
branches: ['main']
workflow_dispatch:
env:
PYTHON_VERSION: '3.12'
NODE_VERSION: '18'
TESTING: 'true'
FLASK_ENV: 'testing'
jobs:
test-unit:
name: Tests Unitaires
runs-on: ubuntu-latest
steps:
- name: Checkout du code
uses: actions/checkout@v4
- name: Configuration Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache des dépendances Python
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Copier le fichier .env.ci
run: cp .env.ci .env
- name: Installation des dépendances
run: |
python -m pip install --upgrade pip
pip install -r requirements-test.txt
pip install -r requirements-app.txt
pip install -r requirements-api.txt
# Installation du package en mode développement pour résoudre les imports
pip install -e .
- name: Vérification de la syntaxe Python
run: |
python -m py_compile app_acfc/**/*.py
python -m py_compile app_acfc/**/*.py
python -m py_compile api_acfc/*.py
python -m py_compile tests/**/*.py
- name: Tests unitaires avec pytest
run: |
# Utilisation de PYTHONPATH en backup
PYTHONPATH=. pytest tests/unit/ -v --tb=short --cov=app_acfc --cov=api_acfc --cov-report=xml --cov-report=html
env:
TESTING: 'true'
FLASK_ENV: testing
- name: Upload des rapports de couverture
uses: actions/upload-artifact@v4
with:
name: coverage-reports-unit
path: |
coverage.xml
htmlcov/
security-scan:
name: Analyse de Sécurité
runs-on: ubuntu-latest
needs: test-unit
steps:
- name: Checkout du code
uses: actions/checkout@v4
- name: Configuration Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Installation de bandit
run: |
python -m pip install bandit[toml]
- name: Scan de sécurité avec Bandit
continue-on-error: true
run: |
echo "🔍 Analyse de sécurité avec Bandit..."
# Générer le rapport JSON
bandit -r app_acfc/ api_acfc/ -f json -o bandit-report.json || true
# Afficher le rapport texte directement dans les logs
echo "📋 Rapport de sécurité Bandit :"
echo "=================================="
bandit -r app_acfc/ api_acfc/ -f txt || true
echo "=================================="
# Compter les problèmes détectés
if [ -f bandit-report.json ]; then
echo "📊 Analyse du rapport JSON :"
ISSUES_COUNT=$(python3 -c "import json; data=json.load(open('bandit-report.json')); print(len(data.get('results', [])))")
echo "Nombre de problèmes détectés: $ISSUES_COUNT"
if [ "$ISSUES_COUNT" -gt "0" ]; then
echo "⚠️ Des problèmes de sécurité ont été détectés!"
echo "📄 Consultez l'artefact 'security-report' pour les détails complets."
else
echo "✅ Aucun problème de sécurité détecté!"
fi
fi
- name: Upload du rapport Bandit
uses: actions/upload-artifact@v4
if: always()
with:
name: security-report
path: bandit-report.json
code-quality:
name: Qualité du Code
runs-on: ubuntu-latest
steps:
- name: Checkout du code
uses: actions/checkout@v4
- name: Configuration Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Installation des outils de qualité
run: |
python -m pip install --upgrade pip
pip install flake8 black isort mypy pylint
- name: Vérification du formatage avec Black
continue-on-error: true
run: |
black --check --diff app_acfc/ api_acfc/ tests/
- name: Vérification des imports avec isort
continue-on-error: true
run: |
isort --check-only --diff app_acfc/ api_acfc/ tests/
- name: Analyse avec Flake8
continue-on-error: true
run: |
flake8 app_acfc/ api_acfc/ tests/ --max-line-length=100 --extend-ignore=E203,W503
- name: Analyse avec Pylint
continue-on-error: true
run: |
pylint app_acfc/ api_acfc/ --output-format=json > pylint-report.json || true
pylint app_acfc/ api_acfc/ --output-format=text
- name: Upload du rapport Pylint
uses: actions/upload-artifact@v4
if: always()
with:
name: pylint-report
path: pylint-report.json