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

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