continuous-integration.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. name: "Continuous Integration"
  2. on:
  3. push:
  4. paths-ignore:
  5. - 'doc/**'
  6. pull_request:
  7. paths-ignore:
  8. - 'doc/**'
  9. env:
  10. COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
  11. COMPOSER_UPDATE_FLAGS: ""
  12. SYMFONY_PHPUNIT_VERSION: "8.3"
  13. SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT: "1"
  14. jobs:
  15. tests:
  16. name: "CI"
  17. runs-on: ${{ matrix.os }}
  18. continue-on-error: ${{ matrix.experimental }}
  19. strategy:
  20. matrix:
  21. php-version:
  22. - "5.3"
  23. - "5.4"
  24. - "5.5"
  25. - "5.6"
  26. - "7.0"
  27. - "7.1"
  28. - "7.2"
  29. - "7.3"
  30. - "7.4"
  31. dependencies: [locked]
  32. os: [ubuntu-latest]
  33. experimental: [false]
  34. include:
  35. - php-version: 5.3
  36. dependencies: highest
  37. os: ubuntu-latest
  38. experimental: false
  39. - php-version: 5.3
  40. dependencies: lowest
  41. os: ubuntu-latest
  42. experimental: false
  43. - php-version: 7.4
  44. dependencies: highest
  45. os: ubuntu-latest
  46. experimental: false
  47. - php-version: 7.4
  48. os: windows-latest
  49. dependencies: locked
  50. experimental: false
  51. - php-version: 7.4
  52. os: macos-latest
  53. dependencies: locked
  54. experimental: false
  55. - php-version: 8.0
  56. dependencies: lowest-ignore
  57. os: ubuntu-latest
  58. experimental: true
  59. - php-version: 8.0
  60. dependencies: highest-ignore
  61. os: ubuntu-latest
  62. experimental: true
  63. steps:
  64. - name: "Checkout"
  65. uses: "actions/checkout@v2"
  66. - name: "Install PHP 7.4 to prepare nightly builds"
  67. if: "matrix.php-version == '8.0'"
  68. uses: "shivammathur/setup-php@v2"
  69. with:
  70. coverage: "none"
  71. extensions: "intl"
  72. ini-values: "memory_limit=-1, phar.readonly=0"
  73. php-version: "7.4"
  74. - name: "Choose PHPUnit version"
  75. if: "!startsWith(matrix.os, 'windows')"
  76. run: |
  77. if [ "${{ matrix.php-version }}" = "5.3" ] || [ "${{ matrix.php-version }}" = "5.4" ] || [ "${{ matrix.php-version }}" = "5.5" ]; then
  78. echo "::set-env name=SYMFONY_PHPUNIT_VERSION::4.8";
  79. elif [ "${{ matrix.php-version }}" = "5.6" ]; then
  80. echo "::set-env name=SYMFONY_PHPUNIT_VERSION::5.7";
  81. elif [ "${{ matrix.php-version }}" = "7.0" ]; then
  82. echo "::set-env name=SYMFONY_PHPUNIT_VERSION::6.5";
  83. elif [ "${{ matrix.php-version }}" = "7.1" ]; then
  84. echo "::set-env name=SYMFONY_PHPUNIT_VERSION::7.5";
  85. else
  86. echo "::set-env name=SYMFONY_PHPUNIT_VERSION::8.3";
  87. fi
  88. - name: "Install PHP"
  89. uses: "shivammathur/setup-php@v2"
  90. with:
  91. coverage: "none"
  92. extensions: "intl"
  93. ini-values: "memory_limit=-1, phar.readonly=0"
  94. php-version: "${{ matrix.php-version }}"
  95. - name: "Determine composer cache directory"
  96. id: "determine-composer-cache-directory"
  97. run: "echo \"::set-output name=directory::$(composer config cache-dir)\""
  98. - name: "Cache dependencies installed with composer"
  99. uses: "actions/cache@v1"
  100. with:
  101. path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
  102. key: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}-${{ hashFiles('**/composer.lock') }}"
  103. restore-keys: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}"
  104. - name: "Handle lowest dependencies update"
  105. if: "contains(matrix.dependencies, 'lowest')"
  106. run: "echo \"::set-env name=COMPOSER_UPDATE_FLAGS::$COMPOSER_UPDATE_FLAGS --prefer-lowest\""
  107. - name: "Handle ignore-platform-reqs dependencies update"
  108. if: "contains(matrix.dependencies, 'ignore')"
  109. run: "echo \"::set-env name=COMPOSER_FLAGS::$COMPOSER_FLAGS --ignore-platform-reqs\""
  110. - name: "Remove platform config to get latest dependencies for current PHP version when build is not locked"
  111. run: "composer config platform --unset"
  112. - name: "Update dependencies from composer.json using composer binary provided by system"
  113. if: "contains(matrix.dependencies, 'highest') || contains(matrix.dependencies, 'lowest')"
  114. run: "composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}"
  115. - name: "Install dependencies from composer.lock using composer binary provided by system"
  116. if: "matrix.dependencies == 'locked'"
  117. run: "composer install ${{ env.COMPOSER_FLAGS }}"
  118. - name: "Update Symfony's PHPUnitBridge to latest available for the current PHP always as it is not really a dependency of the project"
  119. run: "composer update ${{ env.COMPOSER_FLAGS }} symfony/phpunit-bridge"
  120. - name: "Run install again using composer binary from source"
  121. run: "bin/composer install ${{ env.COMPOSER_FLAGS }}"
  122. - name: "Validate composer.json"
  123. run: "bin/composer validate"
  124. - name: "Prepare git environment"
  125. run: "git config --global user.name composer && git config --global user.email composer@example.com"
  126. - name: "Pre-install PHPUnit using PHP 7.4 for PHP 8"
  127. if: "matrix.php-version == '8.0'"
  128. run: |
  129. php7.4 vendor/bin/simple-phpunit install
  130. - name: "Run tests"
  131. if: "matrix.php-version != '7.3'"
  132. run: "vendor/bin/simple-phpunit"
  133. - name: "Run complete test suite on 7.3"
  134. if: "matrix.php-version == '7.3'"
  135. run: "vendor/bin/simple-phpunit --configuration tests/complete.phpunit.xml"