Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 --ignore E402"
  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: Stop ragflow:nightly
  87. if: always() # always run this step even if previous steps failed
  88. run: |
  89. sudo docker compose -f docker/docker-compose.yml down -v
  90. - name: Start ragflow:nightly
  91. run: |
  92. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml up -d
  93. - name: Run sdk tests against Infinity
  94. run: |
  95. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  96. export HOST_ADDRESS=http://host.docker.internal:9380
  97. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  98. echo "Waiting for service to be available..."
  99. sleep 5
  100. done
  101. 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
  102. - name: Run frontend api 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_frontend_api && pytest -s --tb=short get_email.py test_dataset.py
  111. - name: Stop ragflow:nightly
  112. if: always() # always run this step even if previous steps failed
  113. run: |
  114. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml down -v