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_test.yml 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. name: "Pull: Database Tests"
  2. on: [pull_request]
  3. concurrency:
  4. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  5. cancel-in-progress: true
  6. jobs:
  7. # PostgreSQL Tests
  8. db_pgsql_test:
  9. runs-on: ubuntu-latest
  10. services:
  11. pgsql:
  12. image: postgres:15
  13. env:
  14. POSTGRES_DB: test
  15. POSTGRES_PASSWORD: postgres
  16. ports:
  17. - "5432:5432"
  18. ldap:
  19. image: gitea/test-openldap:latest
  20. ports:
  21. - "389:389"
  22. - "636:636"
  23. minio:
  24. # as github actions doesn't support "entrypoint", we need to use a non-official image
  25. # that has a custom entrypoint set to "minio server /data"
  26. image: bitnami/minio:2021.3.17
  27. env:
  28. MINIO_ACCESS_KEY: 123456
  29. MINIO_SECRET_KEY: 12345678
  30. ports:
  31. - "9000:9000"
  32. steps:
  33. - name: checkout
  34. uses: actions/checkout@v3
  35. - name: setup go
  36. uses: actions/setup-go@v4
  37. with:
  38. go-version: '>=1.20.0'
  39. - name: Add hosts to /etc/hosts
  40. run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts
  41. - name: install dependencies
  42. run: make deps-backend
  43. - name: build
  44. run: make backend
  45. env:
  46. GOPROXY: https://goproxy.io
  47. GOSUMDB: sum.golang.org
  48. TAGS: bindata
  49. - name: run tests
  50. run: timeout -s ABRT 50m make test-pgsql-migration test-pgsql
  51. env:
  52. GOPROXY: https://goproxy.io
  53. TAGS: bindata gogit
  54. RACE_ENABLED: true
  55. TEST_TAGS: gogit
  56. TEST_LDAP: 1
  57. USE_REPO_TEST_DIR: 1
  58. # SQLite Tests
  59. db_sqlite_test:
  60. runs-on: ubuntu-latest
  61. steps:
  62. - name: checkout
  63. uses: actions/checkout@v3
  64. - name: setup go
  65. uses: actions/setup-go@v4
  66. with:
  67. go-version: '>=1.20.0'
  68. - name: install dependencies
  69. run: make deps-backend
  70. - name: build
  71. run: make backend
  72. env:
  73. GOPROXY: https://goproxy.io
  74. GOSUMDB: sum.golang.org
  75. TAGS: bindata gogit sqlite sqlite_unlock_notify
  76. - name: run tests
  77. run: timeout -s ABRT 50m make test-sqlite-migration test-sqlite
  78. env:
  79. GOPROXY: https://goproxy.io
  80. TAGS: bindata gogit sqlite sqlite_unlock_notify
  81. RACE_ENABLED: true
  82. TEST_TAGS: gogit sqlite sqlite_unlock_notify
  83. USE_REPO_TEST_DIR: 1
  84. # Unit Tests
  85. db_unit_tests:
  86. runs-on: ubuntu-latest
  87. services:
  88. mysql:
  89. image: mysql:5.7
  90. env:
  91. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  92. MYSQL_DATABASE: test
  93. ports:
  94. - "3306:3306"
  95. elasticsearch:
  96. image: elasticsearch:7.5.0
  97. env:
  98. discovery.type: single-node
  99. ports:
  100. - "9200:9200"
  101. smtpimap:
  102. image: tabascoterrier/docker-imap-devel:latest
  103. ports:
  104. - "25:25"
  105. - "143:143"
  106. - "587:587"
  107. - "993:993"
  108. steps:
  109. - name: checkout
  110. uses: actions/checkout@v3
  111. - name: setup go
  112. uses: actions/setup-go@v4
  113. with:
  114. go-version: '>=1.20.0'
  115. - name: Add hosts to /etc/hosts
  116. run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
  117. - name: install dependencies
  118. run: make deps-backend
  119. - name: build
  120. run: make backend
  121. env:
  122. GOPROXY: https://goproxy.io
  123. GOSUMDB: sum.golang.org
  124. TAGS: bindata
  125. - name: unit tests
  126. run: make unit-test-coverage test-check
  127. env:
  128. GOPROXY: https://goproxy.io
  129. TAGS: bindata
  130. RACE_ENABLED: true
  131. GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
  132. - name: unit tests (gogit)
  133. run: make unit-test-coverage test-check
  134. env:
  135. GOPROXY: https://goproxy.io
  136. TAGS: bindata gogit
  137. RACE_ENABLED: true
  138. GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }}
  139. # MySQL Tests
  140. db_mysql_test:
  141. runs-on: ubuntu-latest
  142. services:
  143. mysql:
  144. image: mysql:5.7
  145. env:
  146. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  147. MYSQL_DATABASE: test
  148. ports:
  149. - "3306:3306"
  150. elasticsearch:
  151. image: elasticsearch:7.5.0
  152. env:
  153. discovery.type: single-node
  154. ports:
  155. - "9200:9200"
  156. smtpimap:
  157. image: tabascoterrier/docker-imap-devel:latest
  158. ports:
  159. - "25:25"
  160. - "143:143"
  161. - "587:587"
  162. - "993:993"
  163. steps:
  164. - name: checkout
  165. uses: actions/checkout@v3
  166. - name: setup go
  167. uses: actions/setup-go@v4
  168. with:
  169. go-version: '>=1.20.0'
  170. - name: Add hosts to /etc/hosts
  171. run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts
  172. - name: install dependencies
  173. run: make deps-backend
  174. - name: build
  175. run: make backend
  176. env:
  177. GOPROXY: https://goproxy.io
  178. GOSUMDB: sum.golang.org
  179. TAGS: bindata
  180. - name: run tests
  181. run: make test-mysql-migration integration-test-coverage
  182. env:
  183. GOPROXY: https://goproxy.io
  184. TAGS: bindata
  185. RACE_ENABLED: true
  186. USE_REPO_TEST_DIR: 1
  187. TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200"
  188. # MySQL8 Tests
  189. db_mysql8_test:
  190. runs-on: ubuntu-latest
  191. services:
  192. mysql8:
  193. image: mysql:8
  194. env:
  195. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  196. MYSQL_DATABASE: testgitea
  197. ports:
  198. - "3306:3306"
  199. steps:
  200. - name: checkout
  201. uses: actions/checkout@v3
  202. - name: setup go
  203. uses: actions/setup-go@v4
  204. with:
  205. go-version: '>=1.20.0'
  206. - name: Add hosts to /etc/hosts
  207. run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts
  208. - name: install dependencies
  209. run: make deps-backend
  210. - name: build
  211. run: make backend
  212. env:
  213. GOPROXY: https://goproxy.io
  214. GOSUMDB: sum.golang.org
  215. TAGS: bindata
  216. - name: run tests
  217. run: timeout -s ABRT 50m make test-mysql8-migration test-mysql8
  218. env:
  219. GOPROXY: https://goproxy.io
  220. TAGS: bindata
  221. USE_REPO_TEST_DIR: 1
  222. # MSSQL Tests
  223. db_mssql_test:
  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. - name: checkout
  236. uses: actions/checkout@v3
  237. - name: setup go
  238. uses: actions/setup-go@v4
  239. with:
  240. go-version: '>=1.20.0'
  241. - name: Add hosts to /etc/hosts
  242. run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts
  243. - name: install dependencies
  244. run: make deps-backend
  245. - name: build
  246. run: make backend
  247. env:
  248. GOPROXY: https://goproxy.io
  249. GOSUMDB: sum.golang.org
  250. TAGS: bindata
  251. - name: run tests
  252. run: timeout -s ABRT 50m make test-mssql-migration test-mssql
  253. env:
  254. GOPROXY: https://goproxy.io
  255. TAGS: bindata
  256. USE_REPO_TEST_DIR: 1