cli.yml 2.4 KB

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