cli.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. paths-ignore:
  9. - "cmds/**"
  10. - "**.md"
  11. pull_request:
  12. branches:
  13. - "master"
  14. paths-ignore:
  15. - "cmds/**"
  16. - "**.md"
  17. workflow_dispatch:
  18. jobs:
  19. cli-test:
  20. runs-on: ubuntu-latest
  21. timeout-minutes: 40
  22. strategy:
  23. fail-fast: true
  24. steps:
  25. - name: PDF cli
  26. uses: actions/checkout@v3
  27. with:
  28. fetch-depth: 2
  29. - name: check-requirements
  30. run: |
  31. pip install -r requirements.txt
  32. pip install -r requirements-qa.txt
  33. pip install magic-pdf
  34. - name: test_cli
  35. run: |
  36. cp magic-pdf.template.json ~/magic-pdf.json
  37. echo $GITHUB_WORKSPACE
  38. cd $GITHUB_WORKSPACE && export PYTHONPATH=. && pytest -s -v tests/test_unit.py
  39. cd $GITHUB_WORKSPACE && pytest -s -v tests/test_cli/test_cli.py
  40. - name: benchmark
  41. run: |
  42. cd $GITHUB_WORKSPACE && pytest -s -v tests/test_cli/test_bench.py
  43. notify_to_feishu:
  44. if: ${{ always() && !cancelled() && contains(needs.*.result, 'failure') && (github.ref_name == 'master') }}
  45. needs: [cli-test]
  46. runs-on: mineru
  47. steps:
  48. - name: get_actor
  49. run: |
  50. metion_list="quyuan"
  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. curl ${{ secrets.WEBHOOK_URL }} -H 'Content-Type: application/json' -d '{
  65. "msgtype": "text",
  66. "text": {
  67. "mentioned_list": ["${{ env.METIONS }}"] , "content": "'${{ github.repository }}' GitHubAction Failed!\n 细节请查看:https://github.com/'${{ github.repository }}'/actions/runs/'${GITHUB_RUN_ID}'"
  68. }
  69. }'