.gitlab-ci.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.lock
  13. - ~/.composer/cache
  14. build_image:
  15. stage: build
  16. image: docker:20.10
  17. before_script:
  18. - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  19. script:
  20. - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
  21. - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
  22. - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  23. - docker push $CI_REGISTRY_IMAGE:latest
  24. .default_config: &default_config
  25. image: $CI_REGISTRY_IMAGE:latest
  26. before_script:
  27. - composer config -g cache-dir .composer-cache
  28. - HOST=ci composer install --prefer-dist --no-progress --no-interaction
  29. unit:
  30. <<: *default_config
  31. stage: test
  32. script:
  33. - php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --testsuite=unit
  34. #- php vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist --colors=never --no-interaction --no-coverage --testsuite=application
  35. artifacts:
  36. paths:
  37. - ./coverage/
  38. when: always
  39. reports:
  40. junit: ./coverage/junit-report.xml
  41. coverage: '/^\s*Lines:\s*\d+.\d+\%/'
  42. #doctrine:
  43. # <<: *default_config
  44. # stage: test
  45. # script:
  46. # - php bin/console d:s:v
  47. code_quality:
  48. <<: *default_config
  49. stage: analysis
  50. script:
  51. - php vendor/bin/phpstan analyse -c phpstan.neon.dist --error-format gitlab > phpstan.json || true # Display code quality in MR
  52. - php vendor/bin/phpstan analyse -c phpstan.neon.dist
  53. artifacts:
  54. when: always
  55. reports:
  56. codequality: phpstan.json
  57. code_style:
  58. <<: *default_config
  59. stage: analysis
  60. before_script:
  61. - composer config -g cache-dir .composer-cache
  62. - HOST=ci composer install --prefer-dist --no-progress --no-interaction
  63. script:
  64. - php vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php