continuous-integration.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. name: "Continuous Integration"
  2. on:
  3. pull_request:
  4. branches:
  5. - "*.x"
  6. - "master"
  7. push:
  8. branches:
  9. - "*.x"
  10. - "master"
  11. env:
  12. fail-fast: true
  13. SYMFONY_DEPRECATIONS_HELPER: "max[self]=0&max[direct]=0"
  14. jobs:
  15. phpunit:
  16. name: "PHPUnit"
  17. runs-on: "ubuntu-20.04"
  18. strategy:
  19. matrix:
  20. php-version:
  21. - "7.1"
  22. - "7.2"
  23. - "7.3"
  24. - "7.4"
  25. - "8.0"
  26. deps:
  27. - "normal"
  28. include:
  29. - deps: "low"
  30. php-version: "7.1"
  31. - deps: "symfony/lts:v3"
  32. php-version: "7.3"
  33. - deps: "dev"
  34. php-version: "7.3"
  35. steps:
  36. - name: "Checkout"
  37. uses: "actions/checkout@v2"
  38. with:
  39. fetch-depth: 2
  40. - name: "Install PHP with PCOV"
  41. uses: "shivammathur/setup-php@v2"
  42. if: "${{ matrix.php-version != '7.1' }}"
  43. with:
  44. php-version: "${{ matrix.php-version }}"
  45. coverage: "pcov"
  46. ini-values: "zend.assertions=1"
  47. - name: "Install PHP with XDebug"
  48. uses: "shivammathur/setup-php@v2"
  49. if: "${{ matrix.php-version == '7.1' }}"
  50. with:
  51. php-version: "${{ matrix.php-version }}"
  52. coverage: "xdebug"
  53. ini-values: "zend.assertions=1"
  54. - name: "Cache dependencies installed with composer"
  55. uses: "actions/cache@v2"
  56. with:
  57. path: "~/.composer/cache"
  58. key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
  59. restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
  60. # to be removed when doctrine/orm adds support for PHP 8
  61. - name: "Pretend this is PHP 7.4"
  62. run: "composer config platform.php 7.4.99"
  63. if: "${{ matrix.php-version == '8.0' }}"
  64. - name: "Install dependencies with composer"
  65. run: "composer update --no-interaction --prefer-dist"
  66. if: "${{ matrix.deps == 'normal' }}"
  67. - name: "Install lowest possible dependencies with composer"
  68. run: "composer update --no-interaction --prefer-dist --prefer-lowest"
  69. if: "${{ matrix.deps == 'low' }}"
  70. - name: "Install dependencies at dev stability with composer"
  71. run: "composer config minimum-stability dev; composer update --no-interaction --prefer-dist --prefer-lowest"
  72. if: "${{ matrix.deps == 'dev' }}"
  73. - name: "Install dependencies with composer with extra constraint"
  74. run: "composer require --no-update ${{matrix.deps}};composer update --no-interaction --prefer-dist"
  75. if: "${{ contains(matrix.deps, '/') }}"
  76. - name: "Run PHPUnit"
  77. run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
  78. - name: "Upload coverage file"
  79. uses: "actions/upload-artifact@v2"
  80. if: "${{ ! contains(matrix.deps, '/') }}"
  81. with:
  82. name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage"
  83. path: "coverage.xml"
  84. - name: "Upload coverage file, sanitize the name"
  85. uses: "actions/upload-artifact@v2"
  86. if: "${{ contains(matrix.deps, '/') }}"
  87. with:
  88. name: "phpunit-symfony-lts-${{ matrix.php-version }}.coverage"
  89. path: "coverage.xml"
  90. upload_coverage:
  91. name: "Upload coverage to Codecov"
  92. runs-on: "ubuntu-20.04"
  93. needs:
  94. - "phpunit"
  95. steps:
  96. - name: "Checkout"
  97. uses: "actions/checkout@v2"
  98. with:
  99. fetch-depth: 2
  100. - name: "Download coverage files"
  101. uses: "actions/download-artifact@v2"
  102. with:
  103. path: "reports"
  104. - name: "Upload to Codecov"
  105. uses: "codecov/codecov-action@v1"
  106. with:
  107. directory: reports