.gitlab-ci.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. stages:
  2. - test
  3. variables:
  4. APP_ENV: ci
  5. SSH_PRIVATE_KEY: $SSH_PRIVATE_KEY
  6. before_script:
  7. # /!\ Attention: la configuration du SSH est indispensable pour pouvoir cloner notre repo foselastica
  8. # Install packages
  9. - apt-get -yqq update
  10. - apt-get -yqq install zip unzip git openssh-client
  11. # Run ssh-agent and add private key
  12. - eval $(ssh-agent -s)
  13. - mkdir -p ~/.ssh
  14. - chmod 700 ~/.ssh
  15. - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
  16. - ssh-add <(echo "$SSH_PRIVATE_KEY")
  17. - git config --global user.email "exploitation@opentalent.fr"
  18. - git config --global user.name "git"
  19. # install composer
  20. - curl -sS https://composer.github.io/installer.sig > installer.sig
  21. - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
  22. - php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
  23. - php composer-setup.php
  24. - php -r "unlink('composer-setup.php'); unlink('installer.sig');"
  25. cache:
  26. paths:
  27. - ./vendor
  28. unit:
  29. stage: test
  30. script:
  31. - php composer.phar install --no-interaction --ignore-platform-reqs
  32. - php bin/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction
  33. artifacts:
  34. paths:
  35. - ./coverage/
  36. when: always
  37. reports:
  38. junit: ./coverage/junit-report.xml
  39. coverage: '/^\s*Lines:\s*\d+.\d+\%/'