Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

tests.yml 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. - name: Build ragflow:dev-slim
  51. run: |
  52. RUNNER_WORKSPACE_PREFIX=${RUNNER_WORKSPACE_PREFIX:-$HOME}
  53. sudo docker pull ubuntu:22.04
  54. sudo docker build --progress=plain --build-arg LIGHTEN=1 --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:dev-slim .
  55. - name: Build ragflow:dev
  56. run: |
  57. sudo docker build --progress=plain --build-arg NEED_MIRROR=1 -f Dockerfile -t infiniflow/ragflow:dev .
  58. - name: Start ragflow:dev-slim
  59. run: |
  60. sudo docker compose -f docker/docker-compose.yml up -d
  61. - name: Stop ragflow:dev-slim
  62. if: always() # always run this step even if previous steps failed
  63. run: |
  64. sudo docker compose -f docker/docker-compose.yml down -v
  65. - name: Start ragflow:dev
  66. run: |
  67. echo "RAGFLOW_IMAGE=infiniflow/ragflow:dev" >> docker/.env
  68. sudo docker compose -f docker/docker-compose.yml up -d
  69. - name: Run sdk tests against Elasticsearch
  70. run: |
  71. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  72. export HOST_ADDRESS=http://host.docker.internal:9380
  73. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  74. echo "Waiting for service to be available..."
  75. sleep 5
  76. done
  77. 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
  78. - name: Run frontend api tests against Elasticsearch
  79. run: |
  80. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  81. export HOST_ADDRESS=http://host.docker.internal:9380
  82. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  83. echo "Waiting for service to be available..."
  84. sleep 5
  85. done
  86. cd sdk/python && poetry install && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py
  87. - name: Stop ragflow:dev
  88. if: always() # always run this step even if previous steps failed
  89. run: |
  90. sudo docker compose -f docker/docker-compose.yml down -v
  91. - name: Start ragflow:dev
  92. run: |
  93. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml up -d
  94. - name: Run sdk tests against Infinity
  95. run: |
  96. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  97. export HOST_ADDRESS=http://host.docker.internal:9380
  98. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  99. echo "Waiting for service to be available..."
  100. sleep 5
  101. done
  102. 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
  103. - name: Run frontend api tests against Infinity
  104. run: |
  105. export http_proxy=""; export https_proxy=""; export no_proxy=""; export HTTP_PROXY=""; export HTTPS_PROXY=""; export NO_PROXY=""
  106. export HOST_ADDRESS=http://host.docker.internal:9380
  107. until sudo docker exec ragflow-server curl -s --connect-timeout 5 ${HOST_ADDRESS} > /dev/null; do
  108. echo "Waiting for service to be available..."
  109. sleep 5
  110. done
  111. cd sdk/python && poetry install && source .venv/bin/activate && cd test/test_frontend_api && pytest -s --tb=short get_email.py test_dataset.py
  112. - name: Stop ragflow:dev
  113. if: always() # always run this step even if previous steps failed
  114. run: |
  115. sudo DOC_ENGINE=infinity docker compose -f docker/docker-compose.yml down -v