run-unit-tests.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. env:
  15. INSTALL_DOCKER: '0' # Set to '0' to skip Docker installation
  16. strategy:
  17. matrix:
  18. python-version: ["3.11"]
  19. steps:
  20. - uses: actions/checkout@v4
  21. - name: Install poetry via pipx
  22. run: pipx install poetry
  23. - name: Set up Python ${{ matrix.python-version }}
  24. uses: actions/setup-python@v5
  25. with:
  26. python-version: ${{ matrix.python-version }}
  27. cache: 'poetry'
  28. - name: Install Python dependencies using Poetry
  29. run: poetry install
  30. - name: Install & Start Docker
  31. if: env.INSTALL_DOCKER == '1'
  32. run: |
  33. brew install colima docker
  34. colima start
  35. # For testcontainers to find the Colima socket
  36. # https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
  37. sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
  38. - name: Build Environment
  39. run: make build
  40. - name: Run Tests
  41. run: poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit -k "not test_sandbox"
  42. - name: Upload coverage to Codecov
  43. uses: codecov/codecov-action@v4
  44. env:
  45. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  46. test-on-linux:
  47. name: Test on Linux
  48. runs-on: ubuntu-latest
  49. env:
  50. INSTALL_DOCKER: '0' # Set to '0' to skip Docker installation
  51. strategy:
  52. matrix:
  53. python-version: ["3.11"]
  54. steps:
  55. - uses: actions/checkout@v4
  56. - name: Install poetry via pipx
  57. run: pipx install poetry
  58. - name: Set up Python
  59. uses: actions/setup-python@v5
  60. with:
  61. python-version: ${{ matrix.python-version }}
  62. cache: 'poetry'
  63. - name: Install Python dependencies using Poetry
  64. run: poetry install --without evaluation
  65. - name: Build Environment
  66. run: make build
  67. - name: Run Tests
  68. run: poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml ./tests/unit -k "not test_sandbox"
  69. - name: Upload coverage to Codecov
  70. uses: codecov/codecov-action@v4
  71. env:
  72. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  73. test-for-sandbox:
  74. name: Test for Sandbox
  75. runs-on: ubuntu-latest
  76. steps:
  77. - uses: actions/checkout@v4
  78. - name: Install poetry via pipx
  79. run: pipx install poetry
  80. - name: Set up Python
  81. uses: actions/setup-python@v5
  82. with:
  83. python-version: '3.11'
  84. cache: 'poetry'
  85. - name: Install Python dependencies using Poetry
  86. run: poetry install
  87. - name: Build Environment
  88. run: make build
  89. - name: Run Integration Test for Sandbox
  90. run: |
  91. poetry run pytest --cov=agenthub --cov=opendevin --cov-report=xml -s ./tests/unit/test_sandbox.py
  92. - name: Upload coverage to Codecov
  93. uses: codecov/codecov-action@v4
  94. env:
  95. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
  96. test_matrix_success:
  97. name: All Mac/Linux Tests Passed
  98. runs-on: ubuntu-latest
  99. needs: [test-on-macos, test-on-linux, test-for-sandbox]
  100. steps:
  101. - run: echo Done!