cli.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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: PDF
  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: pdf
  21. timeout-minutes: 40
  22. strategy:
  23. fail-fast: true
  24. steps:
  25. - name: config-net
  26. run: |
  27. export http_proxy=http://bigdata_open_proxy:H89k5qwQRDYfz@10.140.90.20:10811
  28. export https_proxy=http://bigdata_open_proxy:H89k5qwQRDYfz@10.140.90.20:10811
  29. - name: PDF cli
  30. uses: actions/checkout@v3
  31. with:
  32. fetch-depth: 2
  33. - name: check-requirements
  34. run: |
  35. changed_files=$(git diff --name-only -r HEAD~1 HEAD)
  36. echo $changed_files
  37. if [[ $changed_files =~ "requirements.txt" ]]; then
  38. pip install -r requirements.txt
  39. fi
  40. - name: config-net-reset
  41. run: |
  42. export http_proxy=""
  43. export https_proxy=""
  44. - name: test_cli
  45. run: |
  46. echo $GITHUB_WORKSPACE
  47. cd $GITHUB_WORKSPACE && export PYTHONPATH=. && pytest -s -v tests/test_unit.py
  48. cd $GITHUB_WORKSPACE && pytest -s -v tests/test_cli/test_cli.py
  49. notify_to_feishu:
  50. if: ${{ always() && !cancelled() && contains(needs.*.result, 'failure') && (github.ref_name == 'master') }}
  51. needs: [cli-test]
  52. runs-on: pdf
  53. steps:
  54. - name: get_actor
  55. run: |
  56. metion_list="quyuan"
  57. echo $GITHUB_ACTOR
  58. if [[ $GITHUB_ACTOR == "drunkpig" ]]; then
  59. metion_list="xuchao"
  60. elif [[ $GITHUB_ACTOR == "myhloli" ]]; then
  61. metion_list="zhaoxiaomeng"
  62. elif [[ $GITHUB_ACTOR == "icecraft" ]]; then
  63. metion_list="xurui1"
  64. fi
  65. echo $metion_list
  66. echo "METIONS=$metion_list" >> "$GITHUB_ENV"
  67. echo ${{ env.METIONS }}
  68. - name: notify
  69. run: |
  70. curl ${{ secrets.WEBHOOK_URL }} -H 'Content-Type: application/json' -d '{
  71. "msgtype": "text",
  72. "text": {
  73. "mentioned_list": ["${{ env.METIONS }}"] , "content": "'${{ github.repository }}' GitHubAction Failed!\n 细节请查看:https://github.com/'${{ github.repository }}'/actions/runs/'${GITHUB_RUN_ID}'"
  74. }
  75. }'