name: CI # nom affiché dans l’onglet Actions de GitHub sinon le workflow n'exécute rien on: # quand le pipeline doit s'exécuter, dans le projet: push: branches: - develop # le pipeline se lance quand on pousses sur develop - feature/* # ou sur une branche feature pull_request: branches: - develop # le pipeline se lance quand une pull request cible develop jobs: unit-tests: name: Tests unitaires runs-on: ubuntu-latest steps: - uses: actions/setup-python@v5 with: python-version: "3.11.9" - uses: actions/checkout@v4 - name: Install Poetry run: pip install poetry - name: Install dependencies with Poetry run: poetry install --no-interaction --no-root - name: Add project root to PYTHONPATH run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV - name: Run unit tests with coverage run: poetry run pytest tests/units --cov=App --cov-report=xml --cov-report=term-missing - name: Test FastAPI app import run: | python - << 'EOF' from App.main import app assert app is not None print("FastAPI app loaded successfully") EOF functional-tests: name: Tests fonctionnels API runs-on: ubuntu-latest needs: unit-tests steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11.9" - name: Install Poetry run: pip install poetry - name: Install dependencies run: poetry install --no-interaction --no-root - name: Add project root to PYTHONPATH run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV - name: Run functional tests (DB disabled) env: SPACE_ID: "ci" # désactive la DB dans ton code run: poetry run pytest tests/fonctionnel --cov=App --cov-append --cov-report=xml --cov-report=term-missing