選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

pull-db-tests.yml 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. name: db-tests
  2. on:
  3. pull_request:
  4. concurrency:
  5. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  6. cancel-in-progress: true
  7. jobs:
  8. files-changed:
  9. uses: ./.github/workflows/files-changed.yml
  10. test-pgsql:
  11. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  12. needs: files-changed
  13. runs-on: ubuntu-latest
  14. services:
  15. pgsql:
  16. image: postgres:12
  17. env:
  18. POSTGRES_DB: test
  19. POSTGRES_PASSWORD: postgres
  20. ports:
  21. - "5432:5432"
  22. ldap:
  23. image: gitea/test-openldap:latest
  24. ports:
  25. - "389:389"
  26. - "636:636"
  27. minio:
  28. # as github actions doesn't support "entrypoint", we need to use a non-official image
  29. # that has a custom entrypoint set to "minio server /data"
  30. image: bitnami/minio:2023.8.31
  31. env:
  32. MINIO_ROOT_USER: 123456
  33. MINIO_ROOT_PASSWORD: 12345678
  34. ports:
  35. - "9000:9000"
  36. steps:
  37. - uses: actions/checkout@v4
  38. - uses: actions/setup-go@v4
  39. with:
  40. go-version: "~1.21"
  41. check-latest: true
  42. - name: Add hosts to /etc/hosts
  43. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
  44. - run: make deps-backend
  45. - run: make backend
  46. env:
  47. TAGS: bindata
  48. - run: make test-pgsql-migration test-pgsql
  49. timeout-minutes: 50
  50. env:
  51. TAGS: bindata gogit
  52. RACE_ENABLED: true
  53. TEST_TAGS: gogit
  54. TEST_LDAP: 1
  55. USE_REPO_TEST_DIR: 1
  56. test-sqlite:
  57. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  58. needs: files-changed
  59. runs-on: ubuntu-latest
  60. steps:
  61. - uses: actions/checkout@v4
  62. - uses: actions/setup-go@v4
  63. with:
  64. go-version: "~1.21"
  65. check-latest: true
  66. - run: make deps-backend
  67. - run: make backend
  68. env:
  69. TAGS: bindata gogit sqlite sqlite_unlock_notify
  70. - run: make test-sqlite-migration test-sqlite
  71. timeout-minutes: 50
  72. env:
  73. TAGS: bindata gogit sqlite sqlite_unlock_notify
  74. RACE_ENABLED: true
  75. TEST_TAGS: gogit sqlite sqlite_unlock_notify
  76. USE_REPO_TEST_DIR: 1
  77. test-unit:
  78. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  79. needs: files-changed
  80. runs-on: ubuntu-latest
  81. services:
  82. elasticsearch:
  83. image: elasticsearch:7.5.0
  84. env:
  85. discovery.type: single-node
  86. ports:
  87. - "9200:9200"
  88. meilisearch:
  89. image: getmeili/meilisearch:v1.2.0
  90. env:
  91. MEILI_ENV: development # disable auth
  92. ports:
  93. - "7700:7700"
  94. redis:
  95. image: redis
  96. options: >- # wait until redis has started
  97. --health-cmd "redis-cli ping"
  98. --health-interval 5s
  99. --health-timeout 3s
  100. --health-retries 10
  101. ports:
  102. - 6379:6379
  103. minio:
  104. image: bitnami/minio:2021.3.17
  105. env:
  106. MINIO_ACCESS_KEY: 123456
  107. MINIO_SECRET_KEY: 12345678
  108. ports:
  109. - "9000:9000"
  110. steps:
  111. - uses: actions/checkout@v4
  112. - uses: actions/setup-go@v4
  113. with:
  114. go-version: "~1.21"
  115. check-latest: true
  116. - name: Add hosts to /etc/hosts
  117. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
  118. - run: make deps-backend
  119. - run: make backend
  120. env:
  121. TAGS: bindata
  122. - name: unit-tests
  123. run: make unit-test-coverage test-check
  124. env:
  125. TAGS: bindata
  126. RACE_ENABLED: true
  127. GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
  128. - name: unit-tests-gogit
  129. run: make unit-test-coverage test-check
  130. env:
  131. TAGS: bindata gogit
  132. RACE_ENABLED: true
  133. GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
  134. test-mysql:
  135. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  136. needs: files-changed
  137. runs-on: ubuntu-latest
  138. services:
  139. mysql:
  140. image: mysql:8.0
  141. env:
  142. MYSQL_ALLOW_EMPTY_PASSWORD: true
  143. MYSQL_DATABASE: testgitea
  144. ports:
  145. - "3306:3306"
  146. elasticsearch:
  147. image: elasticsearch:7.5.0
  148. env:
  149. discovery.type: single-node
  150. ports:
  151. - "9200:9200"
  152. smtpimap:
  153. image: tabascoterrier/docker-imap-devel:latest
  154. ports:
  155. - "25:25"
  156. - "143:143"
  157. - "587:587"
  158. - "993:993"
  159. steps:
  160. - uses: actions/checkout@v4
  161. - uses: actions/setup-go@v4
  162. with:
  163. go-version: "~1.21"
  164. check-latest: true
  165. - name: Add hosts to /etc/hosts
  166. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
  167. - run: make deps-backend
  168. - run: make backend
  169. env:
  170. TAGS: bindata
  171. - name: run tests
  172. run: make test-mysql-migration integration-test-coverage
  173. env:
  174. TAGS: bindata
  175. RACE_ENABLED: true
  176. USE_REPO_TEST_DIR: 1
  177. TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
  178. test-mssql:
  179. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  180. needs: files-changed
  181. runs-on: ubuntu-latest
  182. services:
  183. mssql:
  184. image: mcr.microsoft.com/mssql/server:2017-latest
  185. env:
  186. ACCEPT_EULA: Y
  187. MSSQL_PID: Standard
  188. SA_PASSWORD: MwantsaSecurePassword1
  189. ports:
  190. - "1433:1433"
  191. steps:
  192. - uses: actions/checkout@v4
  193. - uses: actions/setup-go@v4
  194. with:
  195. go-version: "~1.21"
  196. check-latest: true
  197. - name: Add hosts to /etc/hosts
  198. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'
  199. - run: make deps-backend
  200. - run: make backend
  201. env:
  202. TAGS: bindata
  203. - run: make test-mssql-migration test-mssql
  204. timeout-minutes: 50
  205. env:
  206. TAGS: bindata
  207. USE_REPO_TEST_DIR: 1