tests.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. name: CI
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. paths:
  8. - ".github/workflows/tests.yml"
  9. - "Makefile"
  10. - "pyproject.toml"
  11. - "uv.lock"
  12. - "src/**"
  13. - "tests/**"
  14. - "examples/**"
  15. env:
  16. UV_FROZEN: "1"
  17. jobs:
  18. lint:
  19. runs-on: ubuntu-latest
  20. steps:
  21. - name: Checkout
  22. uses: actions/checkout@v4
  23. - name: Set up uv (3.13)
  24. uses: astral-sh/setup-uv@v5
  25. with:
  26. enable-cache: true
  27. python-version: "3.13"
  28. - name: Install dependencies
  29. run: make sync
  30. - name: Run lint
  31. run: make lint
  32. typecheck:
  33. runs-on: ubuntu-latest
  34. steps:
  35. - name: Checkout
  36. uses: actions/checkout@v4
  37. - name: Set up uv (3.13)
  38. uses: astral-sh/setup-uv@v5
  39. with:
  40. enable-cache: true
  41. python-version: "3.13"
  42. - name: Install dependencies
  43. run: make sync
  44. - name: Run mypy
  45. run: make mypy
  46. tests:
  47. runs-on: ubuntu-latest
  48. steps:
  49. - name: Checkout
  50. uses: actions/checkout@v4
  51. - name: Set up uv (Python 3.13)
  52. uses: astral-sh/setup-uv@v5
  53. with:
  54. enable-cache: true
  55. python-version: "3.13"
  56. - name: Install dependencies
  57. run: make sync
  58. - name: Run tests with coverage
  59. if: github.event_name != 'pull_request' || (github.event.pull_request.user.login != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork)
  60. env:
  61. OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  62. ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  63. run: make coverage
  64. - name: Run unit tests for PRs without secrets
  65. if: github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.head.repo.fork)
  66. run: uv run pytest tests/test_*_modules
  67. tests_py312:
  68. if: github.event_name == 'push' && github.ref == 'refs/heads/main'
  69. runs-on: ubuntu-latest
  70. steps:
  71. - name: Checkout
  72. uses: actions/checkout@v4
  73. - name: Set up uv (Python 3.12)
  74. uses: astral-sh/setup-uv@v5
  75. with:
  76. enable-cache: true
  77. python-version: "3.12"
  78. - name: Install dependencies
  79. run: make sync
  80. - name: Run tests with coverage (3.12)
  81. env:
  82. OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
  83. ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
  84. run: make coverage