-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (66 loc) · 2.34 KB
/
python-ci.yml
File metadata and controls
87 lines (66 loc) · 2.34 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: Python CI
permissions:
contents: read
on:
pull_request:
push:
branches: [main]
jobs:
python313-security:
name: Python 3.13 security audit (Debian 13 trixie)
runs-on: ubuntu-latest
container: python:3.13-trixie
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install Python 3.13 security dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r requirements.txt -r requirements-dev.txt
- name: Check formatting
run: python -m ruff format --check .
- name: Lint
run: python -m ruff check .
- name: Run tests
run: python -m pytest
- name: Type check
run: pyright
- name: Run source security scan
run: python -m bandit -c pyproject.toml -r .
- name: Audit Python 3.13 dependencies
run: python -m pip_audit -r requirements.txt -r requirements-dev.txt
python37-legacy-compat:
name: Python 3.7 legacy compatibility (Debian 10 buster)
runs-on: ubuntu-latest
container: python:3.7-buster
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Install Python 3.7 legacy dependencies
run: |
python -m pip install --upgrade "pip<24.1" wheel
python -m pip install -r requirements-legacy-py37.txt -r requirements-dev.txt
- name: Check formatting
run: python -m ruff format --check .
- name: Lint
run: python -m ruff check .
- name: Run tests
run: python -m pytest
- name: Type check
run: pyright
- name: Run source security scan
run: python -m bandit -c pyproject.toml -r .
- name: Parse source with Python 3.7
run: |
python - <<'PY'
import ast
from pathlib import Path
for path in sorted(Path(".").rglob("*.py")):
if any(part in {".venv", ".git", "__pycache__"} for part in path.parts):
continue
source = path.read_text(encoding="utf-8")
# This job runs on python:3.7-buster, so ast.parse() intentionally
# omits feature_version. Keep this gate enforcing syntax the
# Python 3.7 interpreter itself can parse.
ast.parse(source, filename=str(path))
PY