From e65592db44cee4fc3a379e0f7ab5f228ed8a09a3 Mon Sep 17 00:00:00 2001
From: Mohamed Menacer <mohamed.menacer@etu.univ-amu.fr>
Date: Mon, 10 Mar 2025 01:02:28 +0100
Subject: [PATCH] test5

---
 .gitlab-ci.yml | 47 ++++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0e756fd..b82f4aa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,41 +1,42 @@
-stages:
-  - install
-  - test
-  - deploy  # Optionnel, à activer si nécessaire
+image: docker:latest
+
+services:
+  - docker:dind
 
 variables:
+  DOCKER_DRIVER: overlay2
   PHP_VERSION: "8.2"
   COMPOSER_CACHE_DIR: "$CI_PROJECT_DIR/var/cache/composer"
 
+stages:
+  - build
+  - test
+
 cache:
   key: composer
   paths:
     - vendor/
     - var/cache/composer/
 
-install_dependencies:
-  stage: install
-  image: php:$PHP_VERSION
+before_script:
+  - apk add --no-cache bash git unzip curl docker-compose
+  - docker --version
+  - docker-compose --version
+
+build:
+  stage: build
   script:
-    - apt-get update && apt-get install -y unzip git
-    - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
-    - composer install --no-interaction --prefer-dist
+    - docker-compose up -d
+    - docker-compose exec php composer install --no-interaction --prefer-dist
   artifacts:
     paths:
       - vendor/
 
-run_tests:
+test:
   stage: test
-  image: php:$PHP_VERSION
   script:
-    - chmod +x bin/phpunit  # Ajoute cette ligne
-    - ./bin/phpunit
-
-# Déploiement (à adapter selon ton serveur)
-deploy:
-  stage: deploy
-  only:
-    - main  # Modifier selon la branche utilisée
-  script:
-    - echo "Déploiement en cours..."
-    # Ajouter ici les commandes pour le déploiement
+    - docker-compose exec php chmod +x bin/phpunit
+    - docker-compose exec php ./bin/phpunit
+  dependencies:
+    - build
+
-- 
GitLab