api-tests.yml 1.9 KB

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. strategy:
  18. matrix:
  19. python-version:
  20. - "3.10"
  21. - "3.11"
  22. - "3.12"
  23. steps:
  24. - name: Checkout code
  25. uses: actions/checkout@v4
  26. - name: Install Poetry
  27. uses: abatilo/actions-poetry@v3
  28. - name: Set up Python ${{ matrix.python-version }}
  29. uses: actions/setup-python@v5
  30. with:
  31. python-version: ${{ matrix.python-version }}
  32. cache: poetry
  33. cache-dependency-path: api/poetry.lock
  34. - name: Check Poetry lockfile
  35. run: |
  36. poetry check -C api --lock
  37. poetry show -C api
  38. - name: Install dependencies
  39. run: poetry install -C api --with dev
  40. - name: Check dependencies in pyproject.toml
  41. run: poetry run -C api bash dev/pytest/pytest_artifacts.sh
  42. - name: Run Unit tests
  43. run: poetry run -C api bash dev/pytest/pytest_unit_tests.sh
  44. - name: Run ModelRuntime
  45. run: poetry run -C api bash dev/pytest/pytest_model_runtime.sh
  46. - name: Run Tool
  47. run: poetry run -C api bash dev/pytest/pytest_tools.sh
  48. - name: Set up dotenvs
  49. run: |
  50. cp docker/.env.example docker/.env
  51. cp docker/middleware.env.example docker/middleware.env
  52. - name: Expose Service Ports
  53. run: sh .github/workflows/expose_service_ports.sh
  54. - name: Set up Sandbox
  55. uses: hoverkraft-tech/compose-action@v2.0.2
  56. with:
  57. compose-file: |
  58. docker/docker-compose.middleware.yaml
  59. services: |
  60. sandbox
  61. ssrf_proxy
  62. - name: Run Workflow
  63. run: poetry run -C api bash dev/pytest/pytest_workflow.sh