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