# stages:
#   - test
#   - deploy

# unit_tests:
#   image: php:7.4-cli
#   stage: test
#   before_script:
#     - apt-get update -qy
#     - apt-get install -y unzip libonig-dev
#     - docker-php-ext-install mbstring pdo pdo_mysql
#     - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#     - composer install
#     - chmod +x ./vendor/bin/phpunit  # Add this line to ensure PHPUnit is executable
#   script:
#     - ./vendor/bin/phpunit

# deploy to OVH prod:
#   image: ubuntu:latest
#   stage: deploy
#   only:
#     - main
#   before_script:
#     - apt-get update -qy
#     - apt-get install -y sudo
#     - export DEBIAN_FRONTEND=noninteractive
#     - sudo apt-get install -y tzdata
#     - echo 'Etc/UTC' | sudo tee /etc/timezone
#     - sudo dpkg-reconfigure --frontend noninteractive tzdata
#     - sudo apt-get install -y openssh-client sshpass
#     - mkdir -p ~/.ssh
#     - echo "$ssh_private_key" | base64 -d > ~/.ssh/id_rsa
#     - chmod 600 ~/.ssh/id_rsa
#     - ssh-keyscan -H $ssh_host >> ~/.ssh/known_hosts
#   script:
#     - sshpass -p '$ssh_password' ssh $ssh_user@$ssh_host "cd $path_push/www/secure && git checkout main && git pull && php ../../composer.phar self-update && php ../../composer.phar update phpmailer/phpmailer --no-dev --optimize-autoloader && exit"
#   after_script:
#     - rm -rf ~/.ssh

stages:
  - build
  - test
  - build-prod
  - deploy

include:
  - local: 'dev-ci.yml'
  - local: 'prod-ci.yml'

# Si tu veux essayer le system sur la prod faut pas oublier 
# de decocher la case protected dans les variable étantdonné 
# que la branch prod n'est pas protected si non il lit pas les 
# variable ou bien tu ajoute la prod en protected