Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

tests.yml 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 PR labels
  32. run: |
  33. echo "Workflow triggered by ${{ github.event_name }}"
  34. if [[ ${{ github.event_name }} == 'pull_request' ]]; then
  35. echo "PR labels: ${{ join(github.event.pull_request.labels.*.name, ', ') }}"
  36. fi
  37. - name: Ensure workspace ownership
  38. run: echo "chown -R $USER $GITHUB_WORKSPACE" && sudo chown -R $USER $GITHUB_WORKSPACE
  39. # https://github.com/actions/checkout/issues/1781
  40. - name: Check out code
  41. uses: actions/checkout@v4
  42. with:
  43. fetch-depth: 0
  44. fetch-tags: true
  45. # https://github.com/astral-sh/ruff-action
  46. - name: Static check with Ruff
  47. uses: astral-sh/ruff-action@v2
  48. with:
  49. version: ">=0.8.2"
  50. args: "check --ignore E402"
  51. - name: Build ragflow:nightly-slim
  52. run: |
  53. RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
  54. sudo docker pull ubuntu:22.04
  55. sudo docker build --progress=plain --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly-slim .
  56. - name: Build ragflow:nightly
  57. run: |
  58. sudo docker build --progress=plain --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:nightly .
  59. - name: Start ragflow:nightly-slim
  60. run: |
  61. echo "RAGFLOW_IMAGE=infiniflow/ragflow:nightly-slim" >> docker/.env
  62. sudo docker compose -f docker/docker-compose.yml up -d
  63. - name: Stop ragflow:nightly-slim
  64. if: always() # always run this step even if previous steps failed
  65. run: |
  66. sudo docker compose -f docker/docker-compose.yml down -v
  67. - name: Start ragflow:nightly
  68. run: |
  69. echo "RAGFLOW_IMAGE=infiniflow/ragflow:nightly" >> docker/.env
  70. sudo docker compose -f docker/docker-compose.yml up -d
  71. - name: Run sdk tests against Elasticsearch
  72. run: |
  73. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  74. export HOST_ADDRESS=http://host.docker.internal:9380
  75. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  76. echo "Waiting for service to be available..."
  77. sleep 5
  78. done
  79. cd sdk/python && poetry 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
  80. - name: Run frontend api tests against Elasticsearch
  81. run: |
  82. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  83. export HOST_ADDRESS=http://host.docker.internal:9380
  84. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  85. echo "Waiting for service to be available..."
  86. sleep 5
  87. done
  88. cd sdk/python && poetry install && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py
  89. - name: Stop ragflow:nightly
  90. if: always() # always run this step even if previous steps failed
  91. run: |
  92. sudo docker compose -f docker/docker-compose.yml down -v
  93. - name: Start ragflow:nightly
  94. run: |
  95. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml up -d
  96. - name: Run sdk tests against Infinity
  97. run: |
  98. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  99. export HOST_ADDRESS=http://host.docker.internal:9380
  100. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  101. echo "Waiting for service to be available..."
  102. sleep 5
  103. done
  104. cd sdk/python && poetry 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
  105. - name: Run frontend api tests against Infinity
  106. run: |
  107. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  108. export HOST_ADDRESS=http://host.docker.internal:9380
  109. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  110. echo "Waiting for service to be available..."
  111. sleep 5
  112. done
  113. cd sdk/python && poetry install && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py
  114. - name: Stop ragflow:nightly
  115. if: always() # always run this step even if previous steps failed
  116. run: |
  117. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml down -v