Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

tests.yml 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. name: tests
  2. on:
  3. push:
  4. branches:
  5. - 'main'
  6. - '*.*.*'
  7. paths-ignore:
  8. - 'docs/**'
  9. - '*.md'
  10. - '*.mdx'
  11. pull_request:
  12. types: [ opened, synchronize, reopened, labeled ]
  13. paths-ignore:
  14. - 'docs/**'
  15. - '*.md'
  16. - '*.mdx'
  17. # https://docs.github.com/en/actions/using-jobs/using-concurrency
  18. concurrency:
  19. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  20. cancel-in-progress: true
  21. jobs:
  22. ragflow_tests:
  23. name: ragflow_tests
  24. # https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
  25. # https://github.com/orgs/community/discussions/26261
  26. if: ${{ github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'ci') }}
  27. runs-on: [ "self-hosted", "debug" ]
  28. steps:
  29. # https://github.com/hmarr/debug-action
  30. #- uses: hmarr/debug-action@v2
  31. - name: Show who triggered this workflow
  32. run: |
  33. echo "Workflow triggered by ${{ github.event_name }}"
  34. - name: Ensure workspace ownership
  35. run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
  36. # https://github.com/actions/checkout/issues/1781
  37. - name: Check out code
  38. uses: actions/checkout@v4
  39. with:
  40. fetch-depth: 0
  41. fetch-tags: true
  42. # https://github.com/astral-sh/ruff-action
  43. - name: Static check with Ruff
  44. uses: astral-sh/ruff-action@v2
  45. with:
  46. version: ">=0.8.2"
  47. args: "check"
  48. - name: Build ragflow:nightly-slim
  49. run: |
  50. RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
  51. sudo docker pull ubuntu:22.04
  52. sudo docker build --progress=plain --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim .
  53. - name: Build ragflow:nightly
  54. run: |
  55. sudo docker build --progress=plain --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly .
  56. - name: Start ragflow:nightly-slim
  57. run: |
  58. echo -e "\nRAGFLOW_IMAGE=infiniflow/ragflow:nightly-slim" >> docker/.env
  59. sudo docker compose -f docker/docker-compose.yml up -d
  60. - name: Stop ragflow:nightly-slim
  61. if: always() # always run this step even if previous steps failed
  62. run: |
  63. sudo docker compose -f docker/docker-compose.yml down -v
  64. - name: Start ragflow:nightly
  65. run: |
  66. echo -e "\nRAGFLOW_IMAGE=infiniflow/ragflow:nightly" >> docker/.env
  67. sudo docker compose -f docker/docker-compose.yml up -d
  68. - name: Run sdk tests against Elasticsearch
  69. run: |
  70. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  71. export HOST_ADDRESS=http://host.docker.internal:9380
  72. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  73. echo "Waiting for service to be available..."
  74. sleep 5
  75. done
  76. cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_sdk_api && pytest -s --tb=short get_email.py t_dataset.py t_chat.py t_session.py t_document.py t_chunk.py
  77. - name: Run frontend api tests against Elasticsearch
  78. run: |
  79. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  80. export HOST_ADDRESS=http://host.docker.internal:9380
  81. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  82. echo "Waiting for service to be available..."
  83. sleep 5
  84. done
  85. cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py
  86. - name: Run http api tests against Elasticsearch
  87. run: |
  88. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  89. export HOST_ADDRESS=http://host.docker.internal:9380
  90. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  91. echo "Waiting for service to be available..."
  92. sleep 5
  93. done
  94. cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_http_api && pytest -s --tb=short -m "not slow"
  95. - name: Stop ragflow:nightly
  96. if: always() # always run this step even if previous steps failed
  97. run: |
  98. sudo docker compose -f docker/docker-compose.yml down -v
  99. - name: Start ragflow:nightly
  100. run: |
  101. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml up -d
  102. - name: Run sdk tests against Infinity
  103. run: |
  104. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  105. export HOST_ADDRESS=http://host.docker.internal:9380
  106. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  107. echo "Waiting for service to be available..."
  108. sleep 5
  109. done
  110. cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_sdk_api && pytest -s --tb=short get_email.py t_dataset.py t_chat.py t_session.py t_document.py t_chunk.py
  111. - name: Run frontend api tests against Infinity
  112. run: |
  113. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  114. export HOST_ADDRESS=http://host.docker.internal:9380
  115. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  116. echo "Waiting for service to be available..."
  117. sleep 5
  118. done
  119. cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py
  120. - name: Run http api tests against Infinity
  121. run: |
  122. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  123. export HOST_ADDRESS=http://host.docker.internal:9380
  124. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  125. echo "Waiting for service to be available..."
  126. sleep 5
  127. done
  128. cd sdk/python && uv sync --python 3.10 --frozen && uv pip install . && source .venv/bin/activate && cd test/test_http_api && DOC_ENGINE=infinity pytest -s --tb=short -m "not slow"
  129. - name: Stop ragflow:nightly
  130. if: always() # always run this step even if previous steps failed
  131. run: |
  132. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml down -v