continuous-integration.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. name: "Continuous Integration"
  2. on:
  3. - push
  4. - pull_request
  5. permissions:
  6. contents: read # to fetch code (actions/checkout)
  7. jobs:
  8. tests:
  9. name: "CI (PHP ${{ matrix.php-version }}, ${{ matrix.dependencies }} deps)"
  10. runs-on: "${{ matrix.operating-system }}"
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. php-version:
  15. - "8.1"
  16. - "8.2"
  17. - "8.3"
  18. dependencies: [highest]
  19. composer-options: [""]
  20. operating-system:
  21. - "ubuntu-latest"
  22. include:
  23. - php-version: "8.1"
  24. dependencies: lowest
  25. operating-system: ubuntu-latest
  26. - php-version: "8.4"
  27. dependencies: highest
  28. operating-system: ubuntu-latest
  29. composer-options: "--ignore-platform-req=php+"
  30. steps:
  31. - name: "Checkout"
  32. uses: "actions/checkout@v4"
  33. - name: Run CouchDB
  34. timeout-minutes: 3
  35. continue-on-error: true
  36. uses: "cobot/couchdb-action@master"
  37. with:
  38. couchdb version: '2.3.1'
  39. - name: Run MongoDB
  40. uses: supercharge/mongodb-github-action@1.10.0
  41. with:
  42. mongodb-version: 5.0
  43. - name: "Install PHP"
  44. uses: "shivammathur/setup-php@v2"
  45. with:
  46. coverage: "none"
  47. php-version: "${{ matrix.php-version }}"
  48. extensions: mongodb, redis, amqp
  49. tools: "composer:v2"
  50. ini-values: "memory_limit=-1"
  51. - name: Add require for mongodb/mongodb to make tests runnable
  52. run: 'composer require mongodb/mongodb --dev --no-update'
  53. - name: "Change dependencies"
  54. run: |
  55. composer require --no-update --no-interaction --dev elasticsearch/elasticsearch:^7
  56. composer config --no-plugins allow-plugins.ocramius/package-versions true
  57. - name: "Update dependencies with composer"
  58. uses: "ramsey/composer-install@v2"
  59. with:
  60. dependency-versions: "${{ matrix.dependencies }}"
  61. composer-options: "${{ matrix.composer-options }}"
  62. - name: "Run tests"
  63. run: "composer exec phpunit -- --exclude-group Elasticsearch,Elastica"
  64. - name: "Run tests with psr/log 3"
  65. if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'"
  66. run: |
  67. composer remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar
  68. composer require --no-update psr/log:^3
  69. composer update ${{ matrix.composer-options }}
  70. composer exec phpunit -- --exclude-group Elasticsearch,Elastica
  71. tests-es-7:
  72. name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}"
  73. needs: "tests"
  74. runs-on: "${{ matrix.operating-system }}"
  75. strategy:
  76. fail-fast: false
  77. matrix:
  78. operating-system:
  79. - "ubuntu-latest"
  80. php-version:
  81. - "8.1"
  82. dependencies:
  83. - "highest"
  84. - "lowest"
  85. es-version:
  86. - "7.0.0"
  87. - "7.17.0"
  88. steps:
  89. - name: "Checkout"
  90. uses: "actions/checkout@v4"
  91. # required for elasticsearch
  92. - name: Configure sysctl limits
  93. run: |
  94. sudo swapoff -a
  95. sudo sysctl -w vm.swappiness=1
  96. sudo sysctl -w fs.file-max=262144
  97. sudo sysctl -w vm.max_map_count=262144
  98. - name: Run Elasticsearch
  99. timeout-minutes: 3
  100. uses: elastic/elastic-github-actions/elasticsearch@master
  101. with:
  102. stack-version: "${{ matrix.es-version }}"
  103. - name: "Install PHP"
  104. uses: "shivammathur/setup-php@v2"
  105. with:
  106. coverage: "none"
  107. php-version: "${{ matrix.php-version }}"
  108. extensions: mongodb, redis, amqp
  109. tools: "composer:v2"
  110. ini-values: "memory_limit=-1"
  111. - name: "Change dependencies"
  112. run: "composer require --no-update --no-interaction --dev elasticsearch/elasticsearch:^${{ matrix.es-version }}"
  113. - name: "Allow composer plugin to run"
  114. if: "matrix.php-version == '7.4' && matrix.dependencies == 'lowest'"
  115. run: "composer config allow-plugins.ocramius/package-versions true"
  116. - name: "Update dependencies with composer"
  117. uses: "ramsey/composer-install@v2"
  118. with:
  119. dependency-versions: "${{ matrix.dependencies }}"
  120. - name: "Run tests"
  121. run: "composer exec phpunit -- --group Elasticsearch,Elastica"
  122. - name: "Run tests with psr/log 3"
  123. if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'"
  124. run: |
  125. composer remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar
  126. composer require --no-update --no-interaction --dev ruflin/elastica elasticsearch/elasticsearch:^7
  127. composer require --no-update psr/log:^3
  128. composer update -W
  129. composer exec phpunit -- --group Elasticsearch,Elastica
  130. tests-es-8:
  131. name: "CI with ES ${{ matrix.es-version }} on PHP ${{ matrix.php-version }}"
  132. needs: "tests"
  133. runs-on: "${{ matrix.operating-system }}"
  134. strategy:
  135. fail-fast: false
  136. matrix:
  137. operating-system:
  138. - "ubuntu-latest"
  139. php-version:
  140. - "8.1"
  141. dependencies:
  142. - "highest"
  143. - "lowest"
  144. es-version:
  145. - "8.0.0"
  146. - "8.2.0"
  147. steps:
  148. - name: "Checkout"
  149. uses: "actions/checkout@v4"
  150. # required for elasticsearch
  151. - name: Configure sysctl limits
  152. run: |
  153. sudo swapoff -a
  154. sudo sysctl -w vm.swappiness=1
  155. sudo sysctl -w fs.file-max=262144
  156. sudo sysctl -w vm.max_map_count=262144
  157. - name: Run Elasticsearch
  158. timeout-minutes: 3
  159. uses: elastic/elastic-github-actions/elasticsearch@master
  160. with:
  161. stack-version: "${{ matrix.es-version }}"
  162. - name: "Install PHP"
  163. uses: "shivammathur/setup-php@v2"
  164. with:
  165. coverage: "none"
  166. php-version: "${{ matrix.php-version }}"
  167. extensions: mongodb, redis, amqp
  168. tools: "composer:v2"
  169. ini-values: "memory_limit=-1"
  170. - name: "Change dependencies"
  171. run: |
  172. composer remove --no-update --dev graylog2/gelf-php ruflin/elastica elasticsearch/elasticsearch rollbar/rollbar
  173. composer require --no-update --no-interaction --dev elasticsearch/elasticsearch:^8
  174. - name: "Allow composer plugin to run"
  175. if: "matrix.php-version == '7.4' && matrix.dependencies == 'lowest'"
  176. run: "composer config allow-plugins.ocramius/package-versions true"
  177. - name: "Update dependencies with composer"
  178. uses: "ramsey/composer-install@v2"
  179. with:
  180. dependency-versions: "${{ matrix.dependencies }}"
  181. - name: "Run tests"
  182. run: "composer exec phpunit -- --group Elasticsearch,Elastica"
  183. - name: "Run tests with psr/log 3"
  184. if: "contains(matrix.dependencies, 'highest') && matrix.php-version >= '8.0'"
  185. run: |
  186. composer require --no-update psr/log:^3
  187. composer update -W
  188. composer exec phpunit -- --group Elasticsearch,Elastica