Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

api-tests.yml 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. name: Run Pytest
  2. on:
  3. pull_request:
  4. branches:
  5. - main
  6. paths:
  7. - api/**
  8. - docker/**
  9. - .github/workflows/api-tests.yml
  10. concurrency:
  11. group: api-tests-${{ github.head_ref || github.run_id }}
  12. cancel-in-progress: true
  13. jobs:
  14. test:
  15. name: API Tests
  16. runs-on: ubuntu-latest
  17. defaults:
  18. run:
  19. shell: bash
  20. strategy:
  21. matrix:
  22. python-version:
  23. - "3.11"
  24. - "3.12"
  25. steps:
  26. - name: Checkout code
  27. uses: actions/checkout@v4
  28. with:
  29. persist-credentials: false
  30. - name: Setup UV and Python
  31. uses: ./.github/actions/setup-uv
  32. with:
  33. python-version: ${{ matrix.python-version }}
  34. uv-lockfile: api/uv.lock
  35. - name: Check UV lockfile
  36. run: uv lock --project api --check
  37. - name: Install dependencies
  38. run: uv sync --project api --dev
  39. - name: Run Unit tests
  40. run: uv run --project api bash dev/pytest/pytest_unit_tests.sh
  41. - name: Run dify config tests
  42. run: uv run --project api dev/pytest/pytest_config_tests.py
  43. - name: MyPy Cache
  44. uses: actions/cache@v4
  45. with:
  46. path: api/.mypy_cache
  47. key: mypy-${{ matrix.python-version }}-${{ runner.os }}-${{ hashFiles('api/uv.lock') }}
  48. - name: Run MyPy Checks
  49. run: dev/mypy-check
  50. - name: Set up dotenvs
  51. run: |
  52. cp docker/.env.example docker/.env
  53. cp docker/middleware.env.example docker/middleware.env
  54. - name: Expose Service Ports
  55. run: sh .github/workflows/expose_service_ports.sh
  56. - name: Set up Sandbox
  57. uses: hoverkraft-tech/compose-action@v2.0.2
  58. with:
  59. compose-file: |
  60. docker/docker-compose.middleware.yaml
  61. services: |
  62. sandbox
  63. ssrf_proxy
  64. - name: Run Workflow
  65. run: uv run --project api bash dev/pytest/pytest_workflow.sh