-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (73 loc) · 1.93 KB
/
code-quality.yml
File metadata and controls
91 lines (73 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Code Quality
on:
push:
branches: [ main, dev ]
paths:
- '**.py'
- 'requirements/**'
- 'setup.py'
- 'setup.cfg'
- 'pyproject.toml'
- '.github/workflows/code-quality.yml'
pull_request:
branches: [ main, dev ]
paths:
- '**.py'
- 'requirements/**'
- 'setup.py'
- 'setup.cfg'
- 'pyproject.toml'
- '.github/workflows/code-quality.yml'
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black isort
- name: Format code with black
run: |
black pytubesearch tests
- name: Sort imports with isort
run: |
isort pytubesearch tests
- name: Check for changes
run: |
git diff --exit-code || (echo "Code formatting changes detected. Please run 'black pytubesearch tests' and 'isort pytubesearch tests' locally." && exit 1)
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 flake8-docstrings flake8-import-order
- name: Lint with flake8
run: |
flake8 pytubesearch --max-line-length=100
type-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -r requirements/dev.txt
- name: Type check with mypy
run: |
mypy pytubesearch