run-unit-tests.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Run Unit Tests
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. jobs:
  8. test-on-macos:
  9. name: Test on macOS
  10. runs-on: macos-13
  11. strategy:
  12. matrix:
  13. python-version: ["3.11"]
  14. steps:
  15. - uses: actions/checkout@v4
  16. - name: Install poetry via pipx
  17. run: pipx install poetry
  18. - name: Set up Python ${{ matrix.python-version }}
  19. uses: actions/setup-python@v5
  20. with:
  21. python-version: ${{ matrix.python-version }}
  22. cache: 'poetry'
  23. - name: Install Python dependencies using Poetry
  24. run: poetry install
  25. - name: Install & Start Docker
  26. run: |
  27. brew install colima docker
  28. colima start
  29. # For testcontainers to find the Colima socket
  30. # https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
  31. sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
  32. - name: Build Environment
  33. run: make build
  34. - name: Run Tests
  35. run: poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit
  36. - name: Upload coverage to Codecov
  37. uses: codecov/codecov-action@v4
  38. env:
  39. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  40. test-on-linux:
  41. name: Test on Linux
  42. runs-on: ubuntu-latest
  43. strategy:
  44. matrix:
  45. python-version: ["3.11"]
  46. steps:
  47. - uses: actions/checkout@v4
  48. - name: Install poetry via pipx
  49. run: pipx install poetry
  50. - name: Set up Python
  51. uses: actions/setup-python@v5
  52. with:
  53. python-version: ${{ matrix.python-version }}
  54. cache: 'poetry'
  55. - name: Install Python dependencies using Poetry
  56. run: poetry install --without evaluation
  57. - name: Build Environment
  58. run: make build
  59. - name: Run Tests
  60. run: poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit
  61. - name: Upload coverage to Codecov
  62. uses: codecov/codecov-action@v4
  63. env:
  64. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  65. test_matrix_success:
  66. name: All Mac/Linux Tests Passed
  67. runs-on: ubuntu-latest
  68. needs: [test-on-macos, test-on-linux]
  69. steps:
  70. - run: echo Done!