-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (69 loc) · 3.15 KB
/
ci-python-zensical.yml
File metadata and controls
86 lines (69 loc) · 3.15 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
# ============================================================
# .github/workflows/ci-python-zensical.yml (Continuous Integration)
# ============================================================
# SOURCE: https://github.com/denisecase/templates
#
# WHY-FILE: Validate repository hygiene, python, and documentation builds.
# REQ: CI MUST NOT introduce arbitrary rules that are not reproducible locally.
# OBS: CI validates only; it should not edit files or deploy docs.
name: CI (Python + Zensical)
# WHY: Validate code, docs, and repo metadata on PRs and pushes.
# OBS: This workflow validates only; it never deploys.
on:
push:
branches: [main] # WHY: Run when pushing to main branch.
pull_request:
branches: [main] # WHY: Run on pull requests targeting main branch.
workflow_dispatch: # WHY: Allow manual triggering from Actions tab.
permissions: # WHY: Use least privileges required.
contents: read
env:
PYTHONUNBUFFERED: "1" # WHY: Real-time logging.
PYTHONIOENCODING: "utf-8" # WHY: Ensure UTF-8 encoding for international characters.
jobs:
ci:
name: Repository / Python checks and Zensical build
runs-on: ubuntu-latest # WHY: Linux environment matches most production deployments
timeout-minutes: 30 # WHY: Prevent hanging jobs. If over time, it is likely stuck.
env:
UV_PYTHON: "3.14" # WHY: Set Python version for all steps.
steps:
# ============================================================
# ASSEMBLE: Get code and set up environment
# ============================================================
- name: A1) Checkout repository code
# WHY: Needed to access files for checks.
uses: actions/checkout@v6
- name: A2) Install uv (with caching and uv.lock awareness)
uses: astral-sh/setup-uv@v7
with:
enable-cache: true # WHY: Speed up installs on subsequent runs
cache-dependency-glob: "uv.lock" # WHY: Only re-cache when dependencies change
- name: A3) Install Python 3.14 (no repo changes needed)
run: uv python install 3.14
- name: A4) Sync to install all dependencies
run: uv sync --extra dev --extra docs --upgrade
- name: A5) Show tool versions
run: |
uv --version
uv run python --version
if [ -f "zensical.toml" ]; then
uv run zensical --version
fi
- name: A6) Run pre-commit (all files)
run: uv tool run pre-commit run --all-files
# ============================================================
# === BASELINE CHECKS ===
# ============================================================
- name: B1) validate-pyproject (must be in pyproject.toml dependencies)
run: uv run validate-pyproject pyproject.toml
# ============================================================
# === DEPLOY: Build only, don't deploy yet ===
# ============================================================
- name: D1) Build docs with Zensical
run: |
if [ -f "zensical.toml" ]; then
uv run zensical build
else
echo "No zensical.toml config found; skipping docs build."
fi