This repository was archived by the owner on Apr 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Expand file tree Collapse file tree 2 files changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Check Code
2
+ on :
3
+ pull_request :
4
+
5
+ jobs :
6
+ static-analysis :
7
+ runs-on : ubuntu-latest
8
+ steps :
9
+ - uses : actions/checkout@v3
10
+ with :
11
+ fetch-depth : 0
12
+ - name : Set up Python 3.9
13
+ uses : actions/setup-python@v4
14
+ with :
15
+ python-version : 3.9
16
+
17
+
18
+ with :
19
+ virtualenvs-create : true
20
+ virtualenvs-in-project : true
21
+
22
+ - name : Cache Dependencies
23
+ uses : actions/cache@v2
24
+ id : cache-dependencies
25
+ with :
26
+ path : .venv
27
+ key : venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
28
+
29
+ - name : Install Dependencies if cache doesn't hit
30
+ if : steps.cache-dependencies.cache-hit != 'true'
31
+ run : poetry install
32
+
33
+ - name : Check Code Styles
34
+ run : poetry run invoke check-code-style
35
+
36
+ - name : Check Types
37
+ run : poetry run invoke check-types
Original file line number Diff line number Diff line change
1
+ # pyright: reportUnknownMemberType=false
2
+
1
3
import toml
4
+ from colorama import Fore
5
+ from colorama import init as init_colorama
2
6
from invoke import Context , task
3
7
from invoke .exceptions import UnexpectedExit
4
8
5
9
import monkey_patch_invoke as _
6
10
7
11
12
+ @task
13
+ def check_code_style (context : Context ) -> None :
14
+ """Runs static analysis."""
15
+ PROJECT_PATH = 'twitter_video_tools'
16
+ init_colorama ()
17
+
18
+ print (f'{ Fore .MAGENTA } ==========Check Code Styles with `yapf`=========={ Fore .RESET } ' )
19
+ context .run (f'yapf --diff --recursive --parallel { PROJECT_PATH } ' , pty = True )
20
+ print (f'{ Fore .GREEN } Yapf: Success{ Fore .RESET } ' )
21
+
22
+ print (f'\n { Fore .MAGENTA } ==========Check Code Styles with `pylint`=========={ Fore .GREEN } ' )
23
+ context .run (f'pylint { PROJECT_PATH } ' , pty = True )
24
+
25
+
26
+ @task
27
+ def check_types (context : Context ) -> None :
28
+ """Runs static analysis."""
29
+ PROJECT_PATH = 'twitter_video_tools'
30
+ init_colorama ()
31
+
32
+ print (f'{ Fore .CYAN } ==========Check typings with `pyright`=========={ Fore .RESET } ' )
33
+ context .run (f'pyright { PROJECT_PATH } ' , pty = True )
34
+
35
+ print (f'\n { Fore .CYAN } ==========Check typings with `mypy`=========={ Fore .RESET } ' )
36
+ context .run (f'mypy { PROJECT_PATH } ' , pty = True )
37
+
38
+
8
39
@task
9
40
def test (context : Context ) -> None :
10
41
"""Run tests."""
You can’t perform that action at this time.
0 commit comments