integration-test.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. name: Integration Test
  2. on:
  3. push:
  4. branches:
  5. - main
  6. - dev
  7. pull_request:
  8. branches:
  9. - main
  10. - dev
  11. jobs:
  12. cypress-run:
  13. name: Run Cypress Integration Tests
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Checkout Repository
  17. uses: actions/checkout@v4
  18. - name: Build and run Compose Stack
  19. run: |
  20. docker compose \
  21. --file docker-compose.yaml \
  22. --file docker-compose.api.yaml \
  23. --file docker-compose.a1111-test.yaml \
  24. up --detach --build
  25. - name: Wait for Ollama to be up
  26. timeout-minutes: 5
  27. run: |
  28. until curl --output /dev/null --silent --fail http://localhost:11434; do
  29. printf '.'
  30. sleep 1
  31. done
  32. echo "Service is up!"
  33. - name: Preload Ollama model
  34. run: |
  35. docker exec ollama ollama pull qwen:0.5b-chat-v1.5-q2_K
  36. - name: Cypress run
  37. uses: cypress-io/github-action@v6
  38. with:
  39. browser: chrome
  40. wait-on: 'http://localhost:3000'
  41. config: baseUrl=http://localhost:3000
  42. - uses: actions/upload-artifact@v4
  43. if: always()
  44. name: Upload Cypress videos
  45. with:
  46. name: cypress-videos
  47. path: cypress/videos
  48. if-no-files-found: ignore
  49. - name: Extract Compose logs
  50. if: always()
  51. run: |
  52. docker compose logs > compose-logs.txt
  53. - uses: actions/upload-artifact@v4
  54. if: always()
  55. name: Upload Compose logs
  56. with:
  57. name: compose-logs
  58. path: compose-logs.txt
  59. if-no-files-found: ignore
  60. migration_test:
  61. name: Run Migration Tests
  62. runs-on: ubuntu-latest
  63. services:
  64. postgres:
  65. image: postgres
  66. env:
  67. POSTGRES_PASSWORD: postgres
  68. options: >-
  69. --health-cmd pg_isready
  70. --health-interval 10s
  71. --health-timeout 5s
  72. --health-retries 5
  73. ports:
  74. - 5432:5432
  75. # mysql:
  76. # image: mysql
  77. # env:
  78. # MYSQL_ROOT_PASSWORD: mysql
  79. # MYSQL_DATABASE: mysql
  80. # options: >-
  81. # --health-cmd "mysqladmin ping -h localhost"
  82. # --health-interval 10s
  83. # --health-timeout 5s
  84. # --health-retries 5
  85. # ports:
  86. # - 3306:3306
  87. steps:
  88. - name: Checkout Repository
  89. uses: actions/checkout@v4
  90. - name: Set up Python
  91. uses: actions/setup-python@v2
  92. with:
  93. python-version: ${{ matrix.python-version }}
  94. - name: Set up uv
  95. uses: yezz123/setup-uv@v4
  96. with:
  97. uv-venv: venv
  98. - name: Activate virtualenv
  99. run: |
  100. . venv/bin/activate
  101. echo PATH=$PATH >> $GITHUB_ENV
  102. - name: Install dependencies
  103. run: |
  104. uv pip install -r backend/requirements.txt
  105. - name: Test backend with SQLite
  106. id: sqlite
  107. env:
  108. WEBUI_SECRET_KEY: secret-key
  109. GLOBAL_LOG_LEVEL: debug
  110. run: |
  111. cd backend
  112. uvicorn main:app --port "8080" --forwarded-allow-ips '*' &
  113. UVICORN_PID=$!
  114. # Wait up to 20 seconds for the server to start
  115. for i in {1..20}; do
  116. curl -s http://localhost:8080/api/config > /dev/null && break
  117. sleep 1
  118. if [ $i -eq 20 ]; then
  119. echo "Server failed to start"
  120. kill -9 $UVICORN_PID
  121. exit 1
  122. fi
  123. done
  124. # Check that the server is still running after 5 seconds
  125. sleep 5
  126. if ! kill -0 $UVICORN_PID; then
  127. echo "Server has stopped"
  128. exit 1
  129. fi
  130. - name: Test backend with Postgres
  131. if: success() || steps.sqlite.conclusion == 'failure'
  132. env:
  133. WEBUI_SECRET_KEY: secret-key
  134. GLOBAL_LOG_LEVEL: debug
  135. DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
  136. run: |
  137. cd backend
  138. uvicorn main:app --port "8081" --forwarded-allow-ips '*' &
  139. UVICORN_PID=$!
  140. # Wait up to 20 seconds for the server to start
  141. for i in {1..20}; do
  142. curl -s http://localhost:8081/api/config > /dev/null && break
  143. sleep 1
  144. if [ $i -eq 20 ]; then
  145. echo "Server failed to start"
  146. kill -9 $UVICORN_PID
  147. exit 1
  148. fi
  149. done
  150. # Check that the server is still running after 5 seconds
  151. sleep 5
  152. if ! kill -0 $UVICORN_PID; then
  153. echo "Server has stopped"
  154. exit 1
  155. fi
  156. # - name: Test backend with MySQL
  157. # if: success() || steps.sqlite.conclusion == 'failure' || steps.postgres.conclusion == 'failure'
  158. # env:
  159. # WEBUI_SECRET_KEY: secret-key
  160. # GLOBAL_LOG_LEVEL: debug
  161. # DATABASE_URL: mysql://root:mysql@localhost:3306/mysql
  162. # run: |
  163. # cd backend
  164. # uvicorn main:app --port "8083" --forwarded-allow-ips '*' &
  165. # UVICORN_PID=$!
  166. # # Wait up to 20 seconds for the server to start
  167. # for i in {1..20}; do
  168. # curl -s http://localhost:8083/api/config > /dev/null && break
  169. # sleep 1
  170. # if [ $i -eq 20 ]; then
  171. # echo "Server failed to start"
  172. # kill -9 $UVICORN_PID
  173. # exit 1
  174. # fi
  175. # done
  176. # # Check that the server is still running after 5 seconds
  177. # sleep 5
  178. # if ! kill -0 $UVICORN_PID; then
  179. # echo "Server has stopped"
  180. # exit 1
  181. # fi