continuous-integration.yml 6.7 KB

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