You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pull-db-tests.yml 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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:15
  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:2021.3.17
  31. env:
  32. MINIO_ACCESS_KEY: 123456
  33. MINIO_SECRET_KEY: 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. mysql:
  83. image: mysql:5.7
  84. env:
  85. MYSQL_ALLOW_EMPTY_PASSWORD: true
  86. MYSQL_DATABASE: test
  87. ports:
  88. - "3306:3306"
  89. elasticsearch:
  90. image: elasticsearch:7.5.0
  91. env:
  92. discovery.type: single-node
  93. ports:
  94. - "9200:9200"
  95. meilisearch:
  96. image: getmeili/meilisearch:v1.2.0
  97. env:
  98. MEILI_ENV: development # disable auth
  99. ports:
  100. - "7700:7700"
  101. smtpimap:
  102. image: tabascoterrier/docker-imap-devel:latest
  103. ports:
  104. - "25:25"
  105. - "143:143"
  106. - "587:587"
  107. - "993:993"
  108. redis:
  109. image: redis
  110. options: >- # wait until redis has started
  111. --health-cmd "redis-cli ping"
  112. --health-interval 5s
  113. --health-timeout 3s
  114. --health-retries 10
  115. ports:
  116. - 6379:6379
  117. minio:
  118. image: bitnami/minio:2021.3.17
  119. env:
  120. MINIO_ACCESS_KEY: 123456
  121. MINIO_SECRET_KEY: 12345678
  122. ports:
  123. - "9000:9000"
  124. steps:
  125. - uses: actions/checkout@v4
  126. - uses: actions/setup-go@v4
  127. with:
  128. go-version: "~1.21"
  129. check-latest: true
  130. - name: Add hosts to /etc/hosts
  131. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
  132. - run: make deps-backend
  133. - run: make backend
  134. env:
  135. TAGS: bindata
  136. - name: unit-tests
  137. run: make unit-test-coverage test-check
  138. env:
  139. TAGS: bindata
  140. RACE_ENABLED: true
  141. GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
  142. - name: unit-tests-gogit
  143. run: make unit-test-coverage test-check
  144. env:
  145. TAGS: bindata gogit
  146. RACE_ENABLED: true
  147. GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
  148. test-mysql5:
  149. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  150. needs: files-changed
  151. runs-on: ubuntu-latest
  152. services:
  153. mysql:
  154. image: mysql:5.7
  155. env:
  156. MYSQL_ALLOW_EMPTY_PASSWORD: true
  157. MYSQL_DATABASE: test
  158. ports:
  159. - "3306:3306"
  160. elasticsearch:
  161. image: elasticsearch:7.5.0
  162. env:
  163. discovery.type: single-node
  164. ports:
  165. - "9200:9200"
  166. smtpimap:
  167. image: tabascoterrier/docker-imap-devel:latest
  168. ports:
  169. - "25:25"
  170. - "143:143"
  171. - "587:587"
  172. - "993:993"
  173. steps:
  174. - uses: actions/checkout@v4
  175. - uses: actions/setup-go@v4
  176. with:
  177. go-version: "~1.21"
  178. check-latest: true
  179. - name: Add hosts to /etc/hosts
  180. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
  181. - run: make deps-backend
  182. - run: make backend
  183. env:
  184. TAGS: bindata
  185. - name: run tests
  186. run: make test-mysql-migration integration-test-coverage
  187. env:
  188. TAGS: bindata
  189. RACE_ENABLED: true
  190. USE_REPO_TEST_DIR: 1
  191. TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
  192. test-mysql8:
  193. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  194. needs: files-changed
  195. runs-on: ubuntu-latest
  196. services:
  197. mysql8:
  198. image: mysql:8
  199. env:
  200. MYSQL_ALLOW_EMPTY_PASSWORD: true
  201. MYSQL_DATABASE: testgitea
  202. ports:
  203. - "3306:3306"
  204. steps:
  205. - uses: actions/checkout@v4
  206. - uses: actions/setup-go@v4
  207. with:
  208. go-version: "~1.21"
  209. check-latest: true
  210. - name: Add hosts to /etc/hosts
  211. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts'
  212. - run: make deps-backend
  213. - run: make backend
  214. env:
  215. TAGS: bindata
  216. - run: make test-mysql8-migration test-mysql8
  217. timeout-minutes: 50
  218. env:
  219. TAGS: bindata
  220. USE_REPO_TEST_DIR: 1
  221. test-mssql:
  222. if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
  223. needs: files-changed
  224. runs-on: ubuntu-latest
  225. services:
  226. mssql:
  227. image: mcr.microsoft.com/mssql/server:latest
  228. env:
  229. ACCEPT_EULA: Y
  230. MSSQL_PID: Standard
  231. SA_PASSWORD: MwantsaSecurePassword1
  232. ports:
  233. - "1433:1433"
  234. steps:
  235. - uses: actions/checkout@v4
  236. - uses: actions/setup-go@v4
  237. with:
  238. go-version: "~1.21"
  239. check-latest: true
  240. - name: Add hosts to /etc/hosts
  241. run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'
  242. - run: make deps-backend
  243. - run: make backend
  244. env:
  245. TAGS: bindata
  246. - run: make test-mssql-migration test-mssql
  247. timeout-minutes: 50
  248. env:
  249. TAGS: bindata
  250. USE_REPO_TEST_DIR: 1