diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e756fdae1ad5db1a0d2b3fe90c51e9ddd484e0e..b82f4aad86569be73c27c9e037d173c76b97c92a 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 +