continuous-integration.yml 7.0 KB

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