cli.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. pull_request:
  13. branches:
  14. - "master"
  15. - "dev"
  16. paths-ignore:
  17. - "cmds/**"
  18. - "**.md"
  19. workflow_dispatch:
  20. jobs:
  21. cli-test:
  22. runs-on: pdf
  23. timeout-minutes: 240
  24. strategy:
  25. fail-fast: true
  26. steps:
  27. - name: PDF cli
  28. uses: actions/checkout@v3
  29. with:
  30. fetch-depth: 2
  31. - name: install&test
  32. run: |
  33. source activate mineru
  34. conda env list
  35. pip show coverage
  36. # cd $GITHUB_WORKSPACE && sh tests/retry_env.sh
  37. cd $GITHUB_WORKSPACE && python tests/clean_coverage.py
  38. cd $GITHUB_WORKSPACE && coverage run -m pytest tests/unittest/ --cov=magic_pdf/ --cov-report html --cov-report term-missing
  39. cd $GITHUB_WORKSPACE && python tests/get_coverage.py
  40. cd $GITHUB_WORKSPACE && pytest -m P0 -s -v tests/test_cli/test_cli_sdk.py
  41. notify_to_feishu:
  42. if: ${{ always() && !cancelled() && contains(needs.*.result, 'failure') && (github.ref_name == 'master') }}
  43. needs: cli-test
  44. runs-on: pdf
  45. steps:
  46. - name: get_actor
  47. run: |
  48. metion_list="dt-yy"
  49. echo $GITHUB_ACTOR
  50. if [[ $GITHUB_ACTOR == "drunkpig" ]]; then
  51. metion_list="xuchao"
  52. elif [[ $GITHUB_ACTOR == "myhloli" ]]; then
  53. metion_list="zhaoxiaomeng"
  54. elif [[ $GITHUB_ACTOR == "icecraft" ]]; then
  55. metion_list="xurui1"
  56. fi
  57. echo $metion_list
  58. echo "METIONS=$metion_list" >> "$GITHUB_ENV"
  59. echo ${{ env.METIONS }}
  60. - name: notify
  61. run: |
  62. echo ${{ secrets.USER_ID }}
  63. 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 }}