integration-test.disabled 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. name: Integration Test
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - dev
  7. - azure-storage
  8. pull_request:
  9. branches:
  10. - main
  11. - dev
  12. jobs:
  13. cypress-run:
  14. name: Run Cypress Integration Tests
  15. runs-on: ubuntu-latest
  16. steps:
  17. - name: Maximize build space
  18. uses: AdityaGarg8/remove-unwanted-software@v4.1
  19. with:
  20. remove-android: 'true'
  21. remove-haskell: 'true'
  22. remove-codeql: 'true'
  23. - name: Checkout Repository
  24. uses: actions/checkout@v4
  25. - name: Build and run Compose Stack
  26. run: |
  27. docker compose \
  28. --file docker-compose.yaml \
  29. --file docker-compose.api.yaml \
  30. --file docker-compose.a1111-test.yaml \
  31. up --detach --build
  32. - name: Delete Docker build cache
  33. run: |
  34. docker builder prune --all --force
  35. - name: Wait for Ollama to be up
  36. timeout-minutes: 5
  37. run: |
  38. until curl --output /dev/null --silent --fail http://localhost:11434; do
  39. printf '.'
  40. sleep 1
  41. done
  42. echo "Service is up!"
  43. - name: Preload Ollama model
  44. run: |
  45. docker exec ollama ollama pull qwen:0.5b-chat-v1.5-q2_K
  46. - name: Cypress run
  47. uses: cypress-io/github-action@v6
  48. env:
  49. LIBGL_ALWAYS_SOFTWARE: 1
  50. with:
  51. browser: chrome
  52. wait-on: 'http://localhost:3000'
  53. config: baseUrl=http://localhost:3000
  54. - uses: actions/upload-artifact@v4
  55. if: always()
  56. name: Upload Cypress videos
  57. with:
  58. name: cypress-videos
  59. path: cypress/videos
  60. if-no-files-found: ignore
  61. - name: Extract Compose logs
  62. if: always()
  63. run: |
  64. docker compose logs > compose-logs.txt
  65. - uses: actions/upload-artifact@v4
  66. if: always()
  67. name: Upload Compose logs
  68. with:
  69. name: compose-logs
  70. path: compose-logs.txt
  71. if-no-files-found: ignore
  72. # pytest:
  73. # name: Run Backend Tests
  74. # runs-on: ubuntu-latest
  75. # steps:
  76. # - uses: actions/checkout@v4
  77. # - name: Set up Python
  78. # uses: actions/setup-python@v5
  79. # with:
  80. # python-version: ${{ matrix.python-version }}
  81. # - name: Install dependencies
  82. # run: |
  83. # python -m pip install --upgrade pip
  84. # pip install -r backend/requirements.txt
  85. # - name: pytest run
  86. # run: |
  87. # ls -al
  88. # cd backend
  89. # PYTHONPATH=. pytest . -o log_cli=true -o log_cli_level=INFO
  90. migration_test:
  91. name: Run Migration Tests
  92. runs-on: ubuntu-latest
  93. services:
  94. postgres:
  95. image: postgres
  96. env:
  97. POSTGRES_PASSWORD: postgres
  98. options: >-
  99. --health-cmd pg_isready
  100. --health-interval 10s
  101. --health-timeout 5s
  102. --health-retries 5
  103. ports:
  104. - 5432:5432
  105. # mysql:
  106. # image: mysql
  107. # env:
  108. # MYSQL_ROOT_PASSWORD: mysql
  109. # MYSQL_DATABASE: mysql
  110. # options: >-
  111. # --health-cmd "mysqladmin ping -h localhost"
  112. # --health-interval 10s
  113. # --health-timeout 5s
  114. # --health-retries 5
  115. # ports:
  116. # - 3306:3306
  117. steps:
  118. - name: Checkout Repository
  119. uses: actions/checkout@v4
  120. - name: Set up Python
  121. uses: actions/setup-python@v5
  122. with:
  123. python-version: ${{ matrix.python-version }}
  124. - name: Set up uv
  125. uses: yezz123/setup-uv@v4
  126. with:
  127. uv-venv: venv
  128. - name: Activate virtualenv
  129. run: |
  130. . venv/bin/activate
  131. echo PATH=$PATH >> $GITHUB_ENV
  132. - name: Install dependencies
  133. run: |
  134. uv pip install -r backend/requirements.txt
  135. - name: Test backend with SQLite
  136. id: sqlite
  137. env:
  138. WEBUI_SECRET_KEY: secret-key
  139. GLOBAL_LOG_LEVEL: debug
  140. run: |
  141. cd backend
  142. uvicorn open_webui.main:app --port "8080" --forwarded-allow-ips '*' &
  143. UVICORN_PID=$!
  144. # Wait up to 40 seconds for the server to start
  145. for i in {1..40}; do
  146. curl -s http://localhost:8080/api/config > /dev/null && break
  147. sleep 1
  148. if [ $i -eq 40 ]; then
  149. echo "Server failed to start"
  150. kill -9 $UVICORN_PID
  151. exit 1
  152. fi
  153. done
  154. # Check that the server is still running after 5 seconds
  155. sleep 5
  156. if ! kill -0 $UVICORN_PID; then
  157. echo "Server has stopped"
  158. exit 1
  159. fi
  160. - name: Test backend with Postgres
  161. if: success() || steps.sqlite.conclusion == 'failure'
  162. env:
  163. WEBUI_SECRET_KEY: secret-key
  164. GLOBAL_LOG_LEVEL: debug
  165. DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
  166. DATABASE_POOL_SIZE: 10
  167. DATABASE_POOL_MAX_OVERFLOW: 10
  168. DATABASE_POOL_TIMEOUT: 30
  169. run: |
  170. cd backend
  171. uvicorn open_webui.main:app --port "8081" --forwarded-allow-ips '*' &
  172. UVICORN_PID=$!
  173. # Wait up to 20 seconds for the server to start
  174. for i in {1..20}; do
  175. curl -s http://localhost:8081/api/config > /dev/null && break
  176. sleep 1
  177. if [ $i -eq 20 ]; then
  178. echo "Server failed to start"
  179. kill -9 $UVICORN_PID
  180. exit 1
  181. fi
  182. done
  183. # Check that the server is still running after 5 seconds
  184. sleep 5
  185. if ! kill -0 $UVICORN_PID; then
  186. echo "Server has stopped"
  187. exit 1
  188. fi
  189. # Check that service will reconnect to postgres when connection will be closed
  190. status_code=$(curl --write-out %{http_code} -s --output /dev/null http://localhost:8081/health/db)
  191. if [[ "$status_code" -ne 200 ]] ; then
  192. echo "Server has failed before postgres reconnect check"
  193. exit 1
  194. fi
  195. echo "Terminating all connections to postgres..."
  196. python -c "import os, psycopg2 as pg2; \
  197. conn = pg2.connect(dsn=os.environ['DATABASE_URL'].replace('+pool', '')); \
  198. cur = conn.cursor(); \
  199. cur.execute('SELECT pg_terminate_backend(psa.pid) FROM pg_stat_activity psa WHERE datname = current_database() AND pid <> pg_backend_pid();')"
  200. status_code=$(curl --write-out %{http_code} -s --output /dev/null http://localhost:8081/health/db)
  201. if [[ "$status_code" -ne 200 ]] ; then
  202. echo "Server has not reconnected to postgres after connection was closed: returned status $status_code"
  203. exit 1
  204. fi
  205. # - name: Test backend with MySQL
  206. # if: success() || steps.sqlite.conclusion == 'failure' || steps.postgres.conclusion == 'failure'
  207. # env:
  208. # WEBUI_SECRET_KEY: secret-key
  209. # GLOBAL_LOG_LEVEL: debug
  210. # DATABASE_URL: mysql://root:mysql@localhost:3306/mysql
  211. # run: |
  212. # cd backend
  213. # uvicorn open_webui.main:app --port "8083" --forwarded-allow-ips '*' &
  214. # UVICORN_PID=$!
  215. # # Wait up to 20 seconds for the server to start
  216. # for i in {1..20}; do
  217. # curl -s http://localhost:8083/api/config > /dev/null && break
  218. # sleep 1
  219. # if [ $i -eq 20 ]; then
  220. # echo "Server failed to start"
  221. # kill -9 $UVICORN_PID
  222. # exit 1
  223. # fi
  224. # done
  225. # # Check that the server is still running after 5 seconds
  226. # sleep 5
  227. # if ! kill -0 $UVICORN_PID; then
  228. # echo "Server has stopped"
  229. # exit 1
  230. # fi