1
0

lint.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Lint
  2. on:
  3. pull_request:
  4. jobs:
  5. quick-checks:
  6. runs-on: ubuntu-latest
  7. steps:
  8. - name: Fetch CosyVoice
  9. uses: actions/checkout@v1
  10. - name: Checkout PR tip
  11. run: |
  12. set -eux
  13. if [[ "${{ github.event_name }}" == "pull_request" ]]; then
  14. # We are on a PR, so actions/checkout leaves us on a merge commit.
  15. # Check out the actual tip of the branch.
  16. git checkout ${{ github.event.pull_request.head.sha }}
  17. fi
  18. echo ::set-output name=commit_sha::$(git rev-parse HEAD)
  19. id: get_pr_tip
  20. - name: Ensure no tabs
  21. run: |
  22. (! 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))
  23. - name: Ensure no trailing whitespace
  24. run: |
  25. (! git grep -I -n $' $' -- . ':(exclude)*.txt' ':(exclude)third_party' ':(exclude).gitattributes' ':(exclude).gitmodules' || (echo "The above files have trailing whitespace; please remove them"; false))
  26. flake8-py3:
  27. runs-on: ubuntu-latest
  28. steps:
  29. - name: Setup Python
  30. uses: actions/setup-python@v1
  31. with:
  32. python-version: 3.9
  33. architecture: x64
  34. - name: Fetch CosyVoice
  35. uses: actions/checkout@v1
  36. - name: Checkout PR tip
  37. run: |
  38. set -eux
  39. if [[ "${{ github.event_name }}" == "pull_request" ]]; then
  40. # We are on a PR, so actions/checkout leaves us on a merge commit.
  41. # Check out the actual tip of the branch.
  42. git checkout ${{ github.event.pull_request.head.sha }}
  43. fi
  44. echo ::set-output name=commit_sha::$(git rev-parse HEAD)
  45. id: get_pr_tip
  46. - name: Run flake8
  47. run: |
  48. set -eux
  49. 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
  50. flake8 --version
  51. flake8 --max-line-length 120 --exclude ./third_party/,./runtime/python/grpc/cosyvoice_pb2*py
  52. if [ $? != 0 ]; then exit 1; fi