integration-test.yml 5.2 KB

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