ci.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. name: ci
  2. on:
  3. push:
  4. branches: [main]
  5. paths:
  6. - 'mem0/**'
  7. - 'tests/**'
  8. - 'embedchain/**'
  9. - 'embedchain/tests/**'
  10. - 'embedchain/examples/**'
  11. pull_request:
  12. paths:
  13. - 'mem0/**'
  14. - 'tests/**'
  15. - 'embedchain/**'
  16. - 'embedchain/tests/**'
  17. - 'embedchain/examples/**'
  18. jobs:
  19. check_changes:
  20. runs-on: ubuntu-latest
  21. outputs:
  22. mem0_changed: ${{ steps.filter.outputs.mem0 }}
  23. embedchain_changed: ${{ steps.filter.outputs.embedchain }}
  24. steps:
  25. - uses: actions/checkout@v3
  26. - uses: dorny/paths-filter@v2
  27. id: filter
  28. with:
  29. filters: |
  30. mem0:
  31. - 'mem0/**'
  32. - 'tests/**'
  33. embedchain:
  34. - 'embedchain/**'
  35. - 'embedchain/tests/**'
  36. - 'embedchain/examples/**'
  37. build_mem0:
  38. needs: check_changes
  39. if: ${{ needs.check_changes.outputs.mem0_changed == 'true' || (needs.check_changes.outputs.mem0_changed == 'false' && needs.check_changes.outputs.embedchain_changed == 'false') }}
  40. runs-on: ubuntu-latest
  41. strategy:
  42. matrix:
  43. python-version: ["3.10", "3.11"]
  44. steps:
  45. - uses: actions/checkout@v3
  46. - name: Set up Python ${{ matrix.python-version }}
  47. uses: actions/setup-python@v4
  48. with:
  49. python-version: ${{ matrix.python-version }}
  50. - name: Install poetry
  51. uses: snok/install-poetry@v1
  52. with:
  53. version: 1.4.2
  54. virtualenvs-create: true
  55. virtualenvs-in-project: true
  56. - name: Load cached venv
  57. id: cached-poetry-dependencies
  58. uses: actions/cache@v2
  59. with:
  60. path: .venv
  61. key: venv-mem0-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
  62. - name: Install dependencies
  63. run: make install_all
  64. if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
  65. - name: Run tests and generate coverage report
  66. run: make test
  67. build_embedchain:
  68. needs: check_changes
  69. if: ${{ needs.check_changes.outputs.embedchain_changed == 'true' || (needs.check_changes.outputs.mem0_changed == 'false' && needs.check_changes.outputs.embedchain_changed == 'false') }}
  70. runs-on: ubuntu-latest
  71. strategy:
  72. matrix:
  73. python-version: ["3.9", "3.10", "3.11"]
  74. steps:
  75. - uses: actions/checkout@v3
  76. - name: Set up Python ${{ matrix.python-version }}
  77. uses: actions/setup-python@v4
  78. with:
  79. python-version: ${{ matrix.python-version }}
  80. - name: Install poetry
  81. uses: snok/install-poetry@v1
  82. with:
  83. version: 1.4.2
  84. virtualenvs-create: true
  85. virtualenvs-in-project: true
  86. - name: Load cached venv
  87. id: cached-poetry-dependencies
  88. uses: actions/cache@v2
  89. with:
  90. path: .venv
  91. key: venv-embedchain-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
  92. - name: Install dependencies
  93. run: cd embedchain && make install_all
  94. if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
  95. - name: Lint with ruff
  96. run: cd embedchain && make lint
  97. - name: Run tests and generate coverage report
  98. run: cd embedchain && make coverage
  99. - name: Upload coverage reports to Codecov
  100. uses: codecov/codecov-action@v3
  101. with:
  102. file: coverage.xml
  103. env:
  104. CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}