run-unit-tests.yml 3.4 KB

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