lint.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: Lint
  2. on:
  3. pull_request:
  4. push:
  5. jobs:
  6. quick-checks:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - name: Fetch CosyVoice
  10. uses: actions/checkout@v1
  11. - name: Checkout PR tip
  12. run: |
  13. set -eux
  14. if [[ "${{ github.event_name }}" == "pull_request" ]]; then
  15. # We are on a PR, so actions/checkout leaves us on a merge commit.
  16. # Check out the actual tip of the branch.
  17. git checkout ${{ github.event.pull_request.head.sha }}
  18. fi
  19. echo ::set-output name=commit_sha::$(git rev-parse HEAD)
  20. id: get_pr_tip
  21. - name: Ensure no tabs
  22. run: |
  23. (! git grep -I -l $'\t' -- . ':(exclude)*.txt' ':(exclude)*.svg' ':(exclude)**Makefile' ':(exclude)**/contrib/**' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have tabs; please convert them to spaces"; false))
  24. - name: Ensure no trailing whitespace
  25. run: |
  26. (! git grep -I -n $' $' -- . ':(exclude)*.txt' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have trailing whitespace; please remove them"; false))
  27. flake8-py3:
  28. runs-on: ubuntu-latest
  29. steps:
  30. - name: Setup Python
  31. uses: actions/setup-python@v1
  32. with:
  33. python-version: 3.9
  34. architecture: x64
  35. - name: Fetch CosyVoice
  36. uses: actions/checkout@v1
  37. - name: Checkout PR tip
  38. run: |
  39. set -eux
  40. if [[ "${{ github.event_name }}" == "pull_request" ]]; then
  41. # We are on a PR, so actions/checkout leaves us on a merge commit.
  42. # Check out the actual tip of the branch.
  43. git checkout ${{ github.event.pull_request.head.sha }}
  44. fi
  45. echo ::set-output name=commit_sha::$(git rev-parse HEAD)
  46. id: get_pr_tip
  47. - name: Run flake8
  48. run: |
  49. set -eux
  50. pip install flake8==3.8.2 flake8-bugbear flake8-comprehensions flake8-executable flake8-pyi==20.5.0 mccabe pycodestyle==2.6.0 pyflakes==2.2.0
  51. flake8 --version
  52. flake8 --max-line-length 150 --ignore B006,B008,B905,C408,E402,E731,E741,W503,W504 --exclude ./third_party/,./runtime/python/grpc/cosyvoice_pb2*py
  53. if [ $? != 0 ]; then exit 1; fi