cli.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
  2. # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
  3. name: mineru
  4. on:
  5. push:
  6. branches:
  7. - "master"
  8. - "dev"
  9. paths-ignore:
  10. - "cmds/**"
  11. - "**.md"
  12. - "**.yml"
  13. pull_request:
  14. branches:
  15. - "master"
  16. - "dev"
  17. paths-ignore:
  18. - "cmds/**"
  19. - "**.md"
  20. - "**.yml"
  21. workflow_dispatch:
  22. jobs:
  23. cli-test:
  24. runs-on: pdf
  25. timeout-minutes: 120
  26. strategy:
  27. fail-fast: true
  28. steps:
  29. - name: PDF cli
  30. uses: actions/checkout@v3
  31. with:
  32. fetch-depth: 2
  33. - name: install
  34. run: |
  35. echo $GITHUB_WORKSPACE && sh tests/retry_env.sh
  36. - name: unit test
  37. run: |
  38. cd $GITHUB_WORKSPACE && export PYTHONPATH=. && coverage run -m pytest tests/test_unit.py --cov=magic_pdf/ --cov-report term-missing --cov-report html
  39. cd $GITHUB_WORKSPACE && python tests/get_coverage.py
  40. - name: cli test
  41. run: |
  42. cd $GITHUB_WORKSPACE && pytest -s -v tests/test_cli/test_cli_sdk.py
  43. notify_to_feishu:
  44. if: ${{ always() && !cancelled() && contains(needs.*.result, 'failure') && (github.ref_name == 'master') }}
  45. needs: cli-test
  46. runs-on: pdf
  47. steps:
  48. - name: get_actor
  49. run: |
  50. metion_list="dt-yy"
  51. echo $GITHUB_ACTOR
  52. if [[ $GITHUB_ACTOR == "drunkpig" ]]; then
  53. metion_list="xuchao"
  54. elif [[ $GITHUB_ACTOR == "myhloli" ]]; then
  55. metion_list="zhaoxiaomeng"
  56. elif [[ $GITHUB_ACTOR == "icecraft" ]]; then
  57. metion_list="xurui1"
  58. fi
  59. echo $metion_list
  60. echo "METIONS=$metion_list" >> "$GITHUB_ENV"
  61. echo ${{ env.METIONS }}
  62. - name: notify
  63. run: |
  64. echo ${{ secrets.USER_ID }}
  65. curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"'${{ github.repository }}' GitHubAction Failed","content":[[{"tag":"text","text":""},{"tag":"a","text":"Please click here for details ","href":"https://github.com/'${{ github.repository }}'/actions/runs/'${GITHUB_RUN_ID}'"},{"tag":"at","user_id":"'${{ secrets.USER_ID }}'"}]]}}}}' ${{ secrets.WEBHOOK_URL }}