11# ============================================================
2- # .github/workflows/ci-python-mkdocs .yml (Continuous Integration)
2+ # .github/workflows/ci-python-zensical .yml (Continuous Integration)
33# ============================================================
44# SOURCE: https://github.com/denisecase/templates
55#
66# WHY-FILE: Validate repository hygiene, python, and documentation builds.
7- # REQ: Any check that can be run locally MUST be available locally via pre-commit.
87# REQ: CI MUST NOT introduce arbitrary rules that are not reproducible locally.
9- # OBS: CI validates only; it never edits files or deploys docs.
8+ # OBS: CI validates only; it should not edit files or deploy docs.
109
11- name : CI (Python + MkDocs )
10+ name : CI (Python + Zensical )
1211
1312# WHY: Validate code, docs, and repo metadata on PRs and pushes.
1413# OBS: This workflow validates only; it never deploys.
2928
3029jobs :
3130 ci :
32- name : Repository / Python checks and MkDocs build
31+ name : Repository / Python checks and Zensical build
3332 runs-on : ubuntu-latest # WHY: Linux environment matches most production deployments
3433 timeout-minutes : 30 # WHY: Prevent hanging jobs. If over time, it is likely stuck.
34+ env :
35+ UV_PYTHON : " 3.14" # WHY: Set Python version for all steps.
3536
3637 steps :
3738 # ============================================================
@@ -42,81 +43,64 @@ jobs:
4243 # WHY: Needed to access files for checks.
4344 uses : actions/checkout@v6
4445
45- - name : A2) Run pre-commit (all files)
46- # WHY: Single source of truth for locally runnable quality gates.
47- # OBS: Fails if hooks would modify files; does not commit changes.
48- id : precommit # WHY: Identify step for conditional follow-up.
49- uses : pre-commit/action@v3.0.1
50- with :
51- extra_args : --all-files
52-
53- - name : A2f) If pre-commit failed, run it locally
54- if : failure()
55- run : |
56- echo "## Pre-commit failed" >> "$GITHUB_STEP_SUMMARY"
57- echo "Please run pre-commit locally and commit the resulting changes." >> "$GITHUB_STEP_SUMMARY"
58-
59- - name : A3) Install uv (with caching)
46+ - name : A2) Install uv (with caching and uv.lock awareness)
6047 uses : astral-sh/setup-uv@v7
6148 with :
6249 enable-cache : true # WHY: Speed up installs on subsequent runs
6350 cache-dependency-glob : " uv.lock" # WHY: Only re-cache when dependencies change
6451
65- - name : A4 ) Install Python 3.14
52+ - name : A3 ) Install Python 3.14 (no repo changes needed)
6653 run : uv python install 3.14
6754
55+ - name : A4) Sync to install all dependencies
56+ run : uv sync --extra dev --extra docs --upgrade
57+
6858 - name : A5) Show tool versions
6959 run : |
70- python --version
7160 uv --version
61+ uv run python --version
62+ if [ -f "zensical.toml" ]; then
63+ uv run zensical --version
64+ fi
7265
73- - name : A6) Sync to install all dependencies
74- run : uv sync --extra dev --extra docs --upgrade
66+ - name : A6) Run pre-commit ( all files)
67+ run : uv tool run pre-commit run --all-files
7568
7669 # ============================================================
7770 # === BASELINE CHECKS ===
7871 # ============================================================
7972
80- - name : B1) validate-pyproject (must be in pyproject.toml deps )
73+ - name : B1) validate-pyproject (must be in pyproject.toml dependencies )
8174 run : uv run validate-pyproject pyproject.toml
8275
83- - name : B2) Ruff format (check only; no fixes)
84- run : uv run ruff format --check --diff .
85-
86- - name : B3) Ruff lint (no fixes)
87- run : uv run ruff check .
88-
8976 # ============================================================
9077 # === COVERAGE AND TESTS: Verify functionality ===
9178 # ============================================================
9279
9380 - name : C1) Run pytest with coverage
9481 run : |
95- if [ -d "tests" ] && [ -n "$(find tests -name 'test_*.py' -o -name '*_test.py')" ]; then
82+ if [ -d "tests" ] && [ -n "$(find tests -type f \( - name 'test_*.py' -o -name '*_test.py' \) -print -quit )" ]; then
9683 uv run pytest --verbose --cov=src --cov-report=term-missing --cov-report=xml
9784 else
98- echo "No tests found - creating empty coverage report"
99- echo "## No Tests Found" >> $GITHUB_STEP_SUMMARY
100- echo "Please add test files to the tests/ directory." >> $GITHUB_STEP_SUMMARY
101- # Create empty coverage file so artifact upload doesn't fail
102- echo '<?xml version="1.0" ?><coverage></coverage>' > coverage.xml
85+ echo "## No Tests Found" >> "$GITHUB_STEP_SUMMARY"
86+ echo "Tests directory missing or empty. CI continues." >> "$GITHUB_STEP_SUMMARY"
10387 fi
10488
10589 - name : C2) Upload test coverage to GitHub Summary
10690 if : always()
10791 run : |
108- echo "## Test Coverage Report" >> $GITHUB_STEP_SUMMARY
92+ echo "## Test Coverage Report" >> " $GITHUB_STEP_SUMMARY"
10993 if [ -f ".coverage" ]; then
110- echo '```' >> $GITHUB_STEP_SUMMARY
111- uv run coverage report >> $GITHUB_STEP_SUMMARY
112- echo '```' >> $GITHUB_STEP_SUMMARY
94+ echo '```' >> " $GITHUB_STEP_SUMMARY"
95+ uv run coverage report >> " $GITHUB_STEP_SUMMARY"
96+ echo '```' >> " $GITHUB_STEP_SUMMARY"
11397 else
114- echo "No coverage data available." >> $GITHUB_STEP_SUMMARY
98+ echo "No coverage data available." >> " $GITHUB_STEP_SUMMARY"
11599 fi
116100
117101 - name : C3) Upload coverage artifact
118102 if : always() && hashFiles('coverage.xml') != ''
119- uses : actions/upload-artifact@v6
103+ uses : actions/upload-artifact@v7
120104 with :
121105 name : coverage-report
122106 path : coverage.xml
@@ -126,11 +110,10 @@ jobs:
126110 # === DEPLOY: Build only, don't deploy yet ===
127111 # ============================================================
128112
129- - name : D1) Build docs (mkdocs --strict)
130- id : build-docs
113+ - name : D1) Build docs with Zensical
131114 run : |
132- if [ -f "mkdocs.yml" ] || [ -f "mkdocs.yaml " ]; then
133- uv run mkdocs build --strict --verbose
115+ if [ -f "zensical.toml " ]; then
116+ uv run zensical build
134117 else
135- echo "No mkdocs config found; skipping docs build."
118+ echo "No zensical.toml config found; skipping docs build."
136119 fi
0 commit comments