-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (45 loc) · 1.57 KB
/
main.yml
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
name: Github workflows
on:
push:
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black radon mypy bandit pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check code format with black
run: |
black --check . || echo 'Warning: Code is not formatted according to black standards'
black .
- name: Check code complexity with radon
run: |
radon cc . -e "*/test/*" -nc || echo 'Warning: High code complexity detected'
- name: Type check with mypy
run: |
mypy . || echo 'Warning: Type check failed'
- name: Security check with bandit
run: |
bandit -r . || echo 'Warning: Security check failed'
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m 'Auto format code with black' || echo 'Warning: Nothing to commit'
git push