.gitlab-ci.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. - composer show api-platform/core
  52. - composer show phpstan/phpstan
  53. - composer show --locked | grep -E "(api-platform|phpstan)"
  54. - php vendor/bin/phpstan analyse -c phpstan.neon.dist --error-format gitlab > phpstan.json || true # Display code quality in MR
  55. - php vendor/bin/phpstan analyse -c phpstan.neon.dist
  56. artifacts:
  57. when: always
  58. reports:
  59. codequality: phpstan.json
  60. code_style:
  61. <<: *default_config
  62. stage: analysis
  63. before_script:
  64. - composer config -g cache-dir .composer-cache
  65. - HOST=ci composer install --prefer-dist --no-progress --no-interaction
  66. script:
  67. - php vendor/bin/php-cs-fixer check --config=.php-cs-fixer.dist.php