cli.yml 2.3 KB

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