.gitlab-ci.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. stages:
  2. - build
  3. - test
  4. - analysis
  5. variables:
  6. APP_ENV: staging
  7. SSH_PRIVATE_KEY: $SSH_PRIVATE_KEY
  8. XDEBUG_MODE: coverage
  9. cache:
  10. paths:
  11. - ./vendor
  12. - ~/.composer/cache
  13. build_image:
  14. stage: build
  15. image: docker:20.10
  16. before_script:
  17. - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  18. script:
  19. - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
  20. - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
  21. - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  22. - docker push $CI_REGISTRY_IMAGE:latest
  23. unit:
  24. image: $CI_REGISTRY_IMAGE:latest
  25. stage: test
  26. script:
  27. - php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --testsuite=unit
  28. #- php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --no-coverage --testsuite=application
  29. artifacts:
  30. paths:
  31. - ./coverage/
  32. when: always
  33. reports:
  34. junit: ./coverage/junit-report.xml
  35. coverage: '/^\s*Lines:\s*\d+.\d+\%/'
  36. #doctrine:
  37. # script:
  38. # - php bin/console d:s:v
  39. static_analysis:
  40. image: $CI_REGISTRY_IMAGE:latest
  41. stage: analysis
  42. script:
  43. - php vendor/bin/phpstan analyse -c phpstan.neon.dist --error-format gitlab > phpstan.json # Display code quality in MR
  44. - php vendor/bin/phpstan analyse -c phpstan.neon.dist
  45. artifacts:
  46. when: always
  47. reports:
  48. codequality: phpstan.json
  49. code_style:
  50. image: $CI_REGISTRY_IMAGE:latest
  51. stage: analysis
  52. script:
  53. - php vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php