51 lines
1.7 KiB
YAML
51 lines
1.7 KiB
YAML
name: CI-CD NDF Complet
|
|
run-name: Pipeline exécuté par ${{ github.actor }}
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
test-and-quality:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Récupération du code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# 1. ÉTAPE DES TESTS (On cible spécifiquement le dossier backend du mono-repo)
|
|
- name: Installation et Tests Node.js (Backend)
|
|
run: |
|
|
cd ndf/public/backend
|
|
npm install
|
|
npm test -- --coverage --watchAll=false
|
|
|
|
# 2. ÉTAPE SONARQUBE (Analyse du code backend)
|
|
- name: Analyse SonarQube
|
|
uses: sonarsource/sonarqube-scan-action@master
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
with:
|
|
args: >
|
|
-Dsonar.projectKey=ndf-gitea
|
|
-Dsonar.sources=ndf/public/backend
|
|
-Dsonar.javascript.lcov.reportPaths=ndf/public/backend/coverage/lcov.info
|
|
|
|
deploy:
|
|
needs: test-and-quality
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Récupération du code pour le déploiement
|
|
uses: actions/checkout@v3
|
|
|
|
# 3. DÉPLOIEMENT FULLSTACK DE TOUT LE MONO-REPO
|
|
- name: Déploiement de la nouvelle Stack Gitea
|
|
run: |
|
|
# On lance le docker-compose global de la racine.
|
|
# L'option '-p gitea-action-dev' crée une stack Portainer dédiée et isolée de Jenkins.
|
|
# Le '--build' force la recompilation du Front ET du Back en même temps.
|
|
# On décale les ports pour Gitea (81 et 3001) pour éviter de toucher à Jenkins
|
|
PORT_FRONT=81 PORT_BACK=3001 docker compose -p gitea-action-dev up -d --build |