api-tests.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. name: Run Pytest
  2. on:
  3. pull_request:
  4. branches:
  5. - main
  6. jobs:
  7. test:
  8. runs-on: ubuntu-latest
  9. env:
  10. OPENAI_API_KEY: sk-IamNotARealKeyJustForMockTestKawaiiiiiiiiii
  11. AZURE_OPENAI_API_BASE: https://difyai-openai.openai.azure.com
  12. AZURE_OPENAI_API_KEY: xxxxb1707exxxxxxxxxxaaxxxxxf94
  13. ANTHROPIC_API_KEY: sk-ant-api11-IamNotARealKeyJustForMockTestKawaiiiiiiiiii-NotBaka-ASkksz
  14. CHATGLM_API_BASE: http://a.abc.com:11451
  15. XINFERENCE_SERVER_URL: http://a.abc.com:11451
  16. XINFERENCE_GENERATION_MODEL_UID: generate
  17. XINFERENCE_CHAT_MODEL_UID: chat
  18. XINFERENCE_EMBEDDINGS_MODEL_UID: embedding
  19. XINFERENCE_RERANK_MODEL_UID: rerank
  20. GOOGLE_API_KEY: abcdefghijklmnopqrstuvwxyz
  21. HUGGINGFACE_API_KEY: hf-awuwuwuwuwuwuwuwuwuwuwuwuwuwuwuwuwu
  22. HUGGINGFACE_TEXT_GEN_ENDPOINT_URL: a
  23. HUGGINGFACE_TEXT2TEXT_GEN_ENDPOINT_URL: b
  24. HUGGINGFACE_EMBEDDINGS_ENDPOINT_URL: c
  25. MOCK_SWITCH: true
  26. CODE_MAX_STRING_LENGTH: 80000
  27. steps:
  28. - name: Checkout code
  29. uses: actions/checkout@v4
  30. - name: Set up Python
  31. uses: actions/setup-python@v5
  32. with:
  33. python-version: '3.10'
  34. cache: 'pip'
  35. cache-dependency-path: |
  36. ./api/requirements.txt
  37. ./api/requirements-dev.txt
  38. - name: Install dependencies
  39. run: pip install -r ./api/requirements.txt -r ./api/requirements-dev.txt
  40. - name: Run ModelRuntime
  41. run: pytest api/tests/integration_tests/model_runtime/anthropic api/tests/integration_tests/model_runtime/azure_openai api/tests/integration_tests/model_runtime/openai api/tests/integration_tests/model_runtime/chatglm api/tests/integration_tests/model_runtime/google api/tests/integration_tests/model_runtime/xinference api/tests/integration_tests/model_runtime/huggingface_hub/test_llm.py
  42. - name: Run Tool
  43. run: pytest api/tests/integration_tests/tools/test_all_provider.py
  44. - name: Run Workflow
  45. run: pytest api/tests/integration_tests/workflow