run-unit-tests.yml 2.4 KB

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