cli.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. retry:
  34. max-retries: 3
  35. always: false
  36. - name: check-requirements
  37. run: |
  38. changed_files=$(git diff --name-only -r HEAD~1 HEAD)
  39. echo $changed_files
  40. if [[ $changed_files =~ "requirements.txt" ]]; then
  41. pip install -r requirements.txt
  42. fi
  43. - name: config-net-reset
  44. run: |
  45. export http_proxy=""
  46. export https_proxy=""
  47. - name: test_cli
  48. run: |
  49. echo $GITHUB_WORKSPACE
  50. cd $GITHUB_WORKSPACE && pytest -s -v tests/test_cli/test_cli.py
  51. notify_to_feishu:
  52. if: ${{ always() && !cancelled() && contains(needs.*.result, 'failure') && (github.ref_name == 'master') }}
  53. needs: [cli-test]
  54. runs-on: pdf
  55. steps:
  56. - name: get_actor
  57. run: |
  58. metion_list="quyuan"
  59. echo $GITHUB_ACTOR
  60. if [[ $GITHUB_ACTOR == "drunkpig" ]]; then
  61. metion_list="xuchao"
  62. elif [[ $GITHUB_ACTOR == "myhloli" ]]; then
  63. metion_list="zhaoxiaomeng"
  64. elif [[ $GITHUB_ACTOR == "icecraft" ]]; then
  65. metion_list="xurui1"
  66. fi
  67. echo $metion_list
  68. echo "METIONS=$metion_list" >> "$GITHUB_ENV"
  69. echo ${{ env.METIONS }}
  70. - name: notify
  71. run: |
  72. curl ${{ secrets.WEBHOOK_URL }} -H 'Content-Type: application/json' -d '{
  73. "msgtype": "text",
  74. "text": {
  75. "mentioned_list": ["${{ env.METIONS }}"] , "content": "'${{ github.repository }}' GitHubAction Failed!\n 细节请查看:https://github.com/'${{ github.repository }}'/actions/runs/'${GITHUB_RUN_ID}'"
  76. }
  77. }'