1- name : CI (uv)
1+ name : CI
22
33on :
44 push :
55 branches : [ main ]
66 pull_request :
77 branches : [ main ]
88
9- # Cancel redundant runs per-branch/PR
109concurrency :
1110 group : ci-${{ github.workflow }}-${{ github.ref }}
1211 cancel-in-progress : true
1312
14- # Least-privilege for the jobs below
1513permissions :
1614 contents : read
1715
1816jobs :
19- test :
20- name : Test / Lint / Typecheck (uv)
17+ build :
18+ name : Build Check
2119 runs-on : ubuntu-latest
22- # Write perms only where needed
23- permissions :
24- contents : read
25- strategy :
26- fail-fast : false
27- matrix :
28- include :
29- - python-version : " 3.11"
30- experimental : false
31- - python-version : " 3.12"
32- experimental : false
33- - python-version : " 3.13"
34- experimental : false
35- - python-version : " 3.14" # treat 3.14 as experimental so CI doesn't block if it breaks
36- experimental : true
37- continue-on-error : ${{ matrix.experimental }}
3820
3921 steps :
4022 - name : Checkout
@@ -46,118 +28,10 @@ jobs:
4628 enable-cache : true
4729
4830 - name : Set up Python
49- run : uv python install ${{ matrix.python-version }}
31+ run : uv python install 3.13
5032
51- # Ensure dev tools (ruff, mypy, pytest, bandit, safety, pytest-cov) are declared in pyproject dev deps.
52- - name : Sync dependencies
53- run : uv sync --all-extras --dev
33+ - name : Run tests
34+ run : uv run pytest -v
5435
55- - name : Lint (ruff)
56- run : uv run ruff check .
57-
58- - name : Typecheck (mypy)
59- run : uv run mypy python_project_deployment
60-
61- - name : Tests (pytest)
62- run : uv run pytest --cov --cov-report=xml --cov-report=html
63-
64- - name : Dangerous API scan (grep)
65- continue-on-error : true
66- shell : bash
67- run : |
68- set -euo pipefail
69- if grep -rn -E '\beval\(|\bexec\(|pickle\.loads|yaml\.load\(|subprocess\.(Popen|call)\(' python_project_deployment/ tests/ 2>/dev/null | grep -v 'yaml\.load_safe' || true; then
70- echo "⚠️ Potentially dangerous API usage detected. Please review." >&2
71- exit 2
72- fi
73-
74- - name : Upload coverage.xml
75- uses : actions/upload-artifact@v5
76- with :
77- name : coverage-${{ matrix.python-version }}
78- path : coverage.xml
79-
80- - name : Upload coverage HTML
81- uses : actions/upload-artifact@v5
82- with :
83- name : coverage-html-${{ matrix.python-version }}
84- path : htmlcov
85-
86- security :
87- name : Security Scan (Bandit)
88- runs-on : ubuntu-latest
89- needs : test
90- permissions :
91- contents : read
92-
93- env :
94- SECURITY_FAIL_LEVEL : MEDIUM
95-
96- steps :
97- - name : Checkout
98- uses : actions/checkout@v5
99-
100- - name : Install uv
101- uses : astral-sh/setup-uv@v7
102- with :
103- enable-cache : true
104-
105- - name : Set up Python
106- run : uv python install 3.11
107-
108- - name : Sync dependencies
109- run : uv sync --all-extras --dev
110-
111- - name : Run Bandit (JSON)
112- run : |
113- uv run bandit -r python_project_deployment/ -f json -o bandit-report.json || true
114- uv run bandit -r python_project_deployment/ -f txt
115-
116- - name : Apply Bandit threshold
117- run : uv run python scripts/security_bandit_check.py
118- continue-on-error : true
119-
120- - name : Upload security reports
121- uses : actions/upload-artifact@v5
122- with :
123- name : security-reports
124- path : bandit-report.json
125-
126- docs :
127- name : Build Documentation
128- runs-on : ubuntu-latest
129- needs : test
130- permissions :
131- contents : write # Needed for GitHub Pages deployment
132-
133- steps :
134- - name : Checkout
135- uses : actions/checkout@v5
136-
137- - name : Install uv
138- uses : astral-sh/setup-uv@v7
139- with :
140- enable-cache : true
141-
142- - name : Set up Python
143- run : uv python install 3.11
144-
145- - name : Sync dependencies (includes sphinx)
146- run : uv sync --all-extras --dev
147-
148- - name : Build documentation
149- run : uv run sphinx-build -b html docs docs/_build/html
150-
151- - name : Upload documentation artifacts
152- uses : actions/upload-artifact@v5
153- with :
154- name : documentation
155- path : docs/_build/html
156-
157- - name : Deploy to GitHub Pages
158- if : github.ref == 'refs/heads/main' && github.event_name == 'push'
159- uses : peaceiris/actions-gh-pages@v4
160- with :
161- github_token : ${{ secrets.GITHUB_TOKEN }}
162- publish_dir : ./docs/_build/html
163- keep_files : false
36+ - name : Build package
37+ run : uv build
0 commit comments