@@ -12,40 +12,76 @@ jobs:
1212 strategy :
1313 matrix :
1414 python-version : [3.12]
15+
1516 steps :
1617 - name : Checkout repository
17- uses : actions/checkout@v3
18+ uses : actions/checkout@v4
1819
1920 - name : Set up Python
2021 uses : actions/setup-python@v4
2122 with :
2223 python-version : ${{ matrix.python-version }}
23-
24+ cache : " pip"
25+
2426 - name : Install UV
2527 run : |
2628 python -m pip install --upgrade pip
2729 pip install uv
2830
31+ - name : Cache UV virtualenv
32+ uses : actions/cache@v4
33+ with :
34+ path : |
35+ .venv
36+ ~/.cache/uv
37+ key : ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
38+ restore-keys : |
39+ ${{ runner.os }}-uv-
40+
2941 - name : Sync dependencies
3042 run : uv sync
3143
3244 - name : Run Pre-commit checks
3345 uses : pre-commit/action@v3.0.0
3446 with :
3547 extra_args : --all-files
36-
48+
3749 - name : Clear pre-commit cache
3850 run : pre-commit clean
3951
40- - name : Run type checking
52+ - name : Run Mypy
4153 run : uv run mypy src/
4254
43- - name : Run linter
55+ - name : Run Ruff
4456 run : uv run ruff check src/
4557
46- - name : Run tests
58+ - name : Run Tests
4759 env :
48- # Для CI подставляем тестовые значения
60+ ENV : test
4961 MAIL_USERNAME : test@example.com
5062 MAIL_PASSWORD : testpass
51- run : uv run pytest -v tests
63+ run : uv run pytest -v --disable-warnings --maxfail=1
64+
65+ # - name: Install security tools
66+ # run: |
67+ # python -m pip install --upgrade pip
68+ # pip install pip-audit bandit safety
69+
70+ - name : Dependency security audit (pip-audit)
71+ run : |
72+ pip-audit --format=human
73+
74+ - name : Static security scan (Bandit)
75+ run : |
76+ bandit -r src -ll
77+
78+ - name : Safety check (optional)
79+ run : |
80+ safety check
81+
82+ - name : Upload pytest cache
83+ if : failure()
84+ uses : actions/upload-artifact@v4
85+ with :
86+ name : pytest-cache
87+ path : .pytest_cache/
0 commit comments