push.yml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. on:
  2. push:
  3. branches:
  4. - 2.x
  5. pull_request:
  6. name: Qa workflow
  7. jobs:
  8. setup:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v2
  12. - name: Restore/cache vendor folder
  13. uses: actions/cache@v1
  14. with:
  15. path: vendor
  16. key: all-build-${{ hashFiles('**/composer.lock') }}
  17. restore-keys: |
  18. all-build-${{ hashFiles('**/composer.lock') }}
  19. all-build-
  20. - name: Restore/cache tools folder
  21. uses: actions/cache@v1
  22. with:
  23. path: tools
  24. key: all-tools-${{ github.sha }}
  25. restore-keys: |
  26. all-tools-${{ github.sha }}-
  27. all-tools-
  28. - name: composer
  29. uses: docker://composer
  30. env:
  31. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  32. with:
  33. args: install --no-interaction --prefer-dist --optimize-autoloader
  34. - name: Install phive
  35. run: make install-phive
  36. - name: Install PHAR dependencies
  37. run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,8A03EA3B385DBAA1 --force-accept-unsigned
  38. phpunit-with-coverage:
  39. runs-on: ubuntu-latest
  40. name: Unit tests
  41. needs: setup
  42. steps:
  43. - uses: actions/checkout@v2
  44. - name: Setup PHP
  45. uses: shivammathur/setup-php@v2
  46. with:
  47. php-version: 7.2
  48. ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
  49. coverage: pcov
  50. - name: Restore/cache tools folder
  51. uses: actions/cache@v1
  52. with:
  53. path: tools
  54. key: all-tools-${{ github.sha }}
  55. restore-keys: |
  56. all-tools-${{ github.sha }}-
  57. all-tools-
  58. - name: Get composer cache directory
  59. id: composer-cache
  60. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  61. - name: Cache composer dependencies
  62. uses: actions/cache@v1
  63. with:
  64. path: ${{ steps.composer-cache.outputs.dir }}
  65. key: ubuntu-latest-composer-${{ hashFiles('**/composer.lock') }}
  66. restore-keys: ubuntu-latest-composer-
  67. - name: Install Composer dependencies
  68. run: |
  69. composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
  70. - name: Run PHPUnit
  71. run: php tools/phpunit
  72. phpunit:
  73. runs-on: ${{ matrix.operating-system }}
  74. strategy:
  75. matrix:
  76. operating-system:
  77. - ubuntu-latest
  78. - windows-latest
  79. - macOS-latest
  80. php-versions: ['7.2', '7.3', '7.4', '8.0']
  81. name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
  82. needs:
  83. - setup
  84. - phpunit-with-coverage
  85. steps:
  86. - uses: actions/checkout@v2
  87. - name: Restore/cache tools folder
  88. uses: actions/cache@v1
  89. with:
  90. path: tools
  91. key: all-tools-${{ github.sha }}
  92. restore-keys: |
  93. all-tools-${{ github.sha }}-
  94. all-tools-
  95. - name: Setup PHP
  96. uses: shivammathur/setup-php@v2
  97. with:
  98. php-version: ${{ matrix.php-versions }}
  99. ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
  100. coverage: none
  101. - name: Get composer cache directory
  102. id: composer-cache
  103. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  104. - name: Cache composer dependencies
  105. uses: actions/cache@v1
  106. with:
  107. path: ${{ steps.composer-cache.outputs.dir }}
  108. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  109. restore-keys: ${{ runner.os }}-composer-
  110. - name: Install Composer dependencies
  111. run: |
  112. composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
  113. - name: Run PHPUnit
  114. continue-on-error: true
  115. run: php tools/phpunit
  116. codestyle:
  117. runs-on: ubuntu-latest
  118. needs: [setup, phpunit]
  119. steps:
  120. - uses: actions/checkout@v2
  121. - name: Restore/cache vendor folder
  122. uses: actions/cache@v1
  123. with:
  124. path: vendor
  125. key: all-build-${{ hashFiles('**/composer.lock') }}
  126. restore-keys: |
  127. all-build-${{ hashFiles('**/composer.lock') }}
  128. all-build-
  129. - name: Code style check
  130. uses: phpDocumentor/coding-standard@latest
  131. with:
  132. args: -s
  133. phpstan:
  134. runs-on: ubuntu-latest
  135. needs: [setup, phpunit]
  136. steps:
  137. - uses: actions/checkout@v2
  138. - name: Restore/cache vendor folder
  139. uses: actions/cache@v1
  140. with:
  141. path: vendor
  142. key: all-build-${{ hashFiles('**/composer.lock') }}
  143. restore-keys: |
  144. all-build-${{ hashFiles('**/composer.lock') }}
  145. all-build-
  146. - name: PHPStan
  147. uses: phpDocumentor/phpstan-ga@latest
  148. env:
  149. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  150. with:
  151. args: analyse src --configuration phpstan.neon
  152. psalm:
  153. runs-on: ubuntu-latest
  154. needs: [setup, phpunit]
  155. steps:
  156. - uses: actions/checkout@v2
  157. - name: Setup PHP
  158. uses: shivammathur/setup-php@v2
  159. with:
  160. php-version: 7.2
  161. ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
  162. tools: psalm
  163. coverage: none
  164. - name: Get composer cache directory
  165. id: composer-cache
  166. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  167. - name: Cache composer dependencies
  168. uses: actions/cache@v1
  169. with:
  170. path: ${{ steps.composer-cache.outputs.dir }}
  171. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  172. restore-keys: ${{ runner.os }}-composer-
  173. - name: Install Composer dependencies
  174. run: |
  175. composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
  176. - name: Psalm
  177. run: psalm --output-format=github
  178. bc_check:
  179. name: BC Check
  180. runs-on: ubuntu-latest
  181. needs: [setup, phpunit]
  182. steps:
  183. - uses: actions/checkout@v2
  184. - name: fetch tags
  185. run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
  186. - name: Restore/cache vendor folder
  187. uses: actions/cache@v1
  188. with:
  189. path: vendor
  190. key: all-build-${{ hashFiles('**/composer.lock') }}
  191. restore-keys: |
  192. all-build-${{ hashFiles('**/composer.lock') }}
  193. all-build-
  194. - name: Roave BC Check
  195. uses: docker://nyholm/roave-bc-check-ga