tests.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: PaddleOCR PR Tests
  2. on:
  3. push:
  4. branches: ["main", "release/*"]
  5. pull_request:
  6. branches: ["main", "release/*"]
  7. paths-ignore:
  8. permissions:
  9. contents: read
  10. jobs:
  11. detect-changes:
  12. runs-on: ubuntu-latest
  13. outputs:
  14. docs_only: ${{ steps.filter.outputs.docs_only }}
  15. steps:
  16. - uses: actions/checkout@v4
  17. - id: filter
  18. uses: dorny/paths-filter@v3
  19. with:
  20. filters: |
  21. docs_only:
  22. - '**.md'
  23. - '**.txt'
  24. - '**.yml'
  25. - '**.yaml'
  26. test-pr:
  27. runs-on: ubuntu-latest
  28. needs: detect-changes
  29. if: needs.detect-changes.outputs.docs_only != 'true'
  30. steps:
  31. - uses: actions/checkout@v4
  32. - name: Set up Python 3.10
  33. uses: actions/setup-python@v5
  34. with:
  35. python-version: "3.10"
  36. - name: Cache dependencies
  37. uses: actions/cache@v4
  38. with:
  39. path: |
  40. ~/.cache/pip
  41. ~/.local/lib/python3.10/site-packages
  42. ~/.paddleocr/
  43. key: ${{ runner.os }}-dependencies-${{ hashFiles('**/requirements.txt', 'pyproject.toml') }}
  44. restore-keys: |
  45. ${{ runner.os }}-dependencies-
  46. - name: Install dependencies
  47. run: |
  48. python -m pip install --upgrade pip
  49. pip install pytest
  50. if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  51. python -m pip install paddlepaddle==3.2.0 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
  52. python -m pip install -e '.[all]' 'paddlex@git+https://github.com/PaddlePaddle/PaddleX.git@develop'
  53. - name: Test with pytest
  54. run: |
  55. pytest --verbose tests/