py-unit-tests.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Workflow that runs python unit tests
  2. name: Run Python Unit Tests
  3. # The jobs in this workflow are required, so they must run at all times
  4. # * Always run on "main"
  5. # * Always run on PRs
  6. on:
  7. push:
  8. branches:
  9. - main
  10. pull_request:
  11. # If triggered by a PR, it will be in the same group. However, each commit on main will be in its own unique group
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ (github.head_ref && github.ref) || github.run_id }}
  14. cancel-in-progress: true
  15. jobs:
  16. # Run python unit tests on Linux
  17. test-on-linux:
  18. name: Python Unit Tests on Linux
  19. runs-on: ubuntu-latest
  20. env:
  21. INSTALL_DOCKER: '0' # Set to '0' to skip Docker installation
  22. strategy:
  23. matrix:
  24. python-version: ['3.12']
  25. steps:
  26. - uses: actions/checkout@v4
  27. - name: Set up Docker Buildx
  28. id: buildx
  29. uses: docker/setup-buildx-action@v3
  30. - name: Install poetry via pipx
  31. run: pipx install poetry
  32. - name: Set up Python
  33. uses: actions/setup-python@v5
  34. with:
  35. python-version: ${{ matrix.python-version }}
  36. cache: 'poetry'
  37. - name: Install Python dependencies using Poetry
  38. run: poetry install --without evaluation,llama-index
  39. - name: Build Environment
  40. run: make build
  41. - name: Run Tests
  42. run: poetry run pytest --forked --cov=openhands --cov-report=xml -svv ./tests/unit --ignore=tests/unit/test_memory.py
  43. - name: Upload coverage to Codecov
  44. uses: codecov/codecov-action@v4
  45. env:
  46. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}