-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (70 loc) · 1.92 KB
/
ci.yml
File metadata and controls
87 lines (70 loc) · 1.92 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
name: CI Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install UV
run: |
python -m pip install --upgrade pip
pip install uv
- name: Cache UV virtualenv
uses: actions/cache@v4
with:
path: |
.venv
~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-
- name: Sync dependencies
run: uv sync
- name: Run Pre-commit checks
uses: pre-commit/action@v3.0.0
with:
extra_args: --all-files
- name: Clear pre-commit cache
run: pre-commit clean
- name: Run Mypy
run: uv run mypy src/
- name: Run Ruff
run: uv run ruff check src/
- name: Run Tests
env:
ENV: test
MAIL_USERNAME: test@example.com
MAIL_PASSWORD: testpass
run: uv run pytest -v --disable-warnings --maxfail=1
# - name: Install security tools
# run: |
# python -m pip install --upgrade pip
# pip install pip-audit bandit safety
- name: Dependency security audit (pip-audit)
run: |
pip-audit --format=human
- name: Static security scan (Bandit)
run: |
bandit -r src -ll
- name: Safety check (optional)
run: |
safety check
- name: Upload pytest cache
if: failure()
uses: actions/upload-artifact@v4
with:
name: pytest-cache
path: .pytest_cache/