Skip to content

Commit 25fa38c

Browse files
authored
Add Zensical, Actionlint, and MkDocs (#22)
* Add Zensical, Actionlint, and MkDocs * Update just config
1 parent 069ea95 commit 25fa38c

15 files changed

Lines changed: 918 additions & 24 deletions

‎.github/workflows/python.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,19 @@ jobs:
3232
- name: Unit tests
3333
run: |
3434
just test
35+
- name: Docs build
36+
run: |
37+
just docs-build
38+
markdownlint:
39+
runs-on: ubuntu-slim
40+
permissions:
41+
contents: read
42+
steps:
43+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
44+
with:
45+
persist-credentials: false
46+
# Keep markdownlint-cli2 in step with the VS Code markdownlint extension
47+
- name: Markdownlint
48+
uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0
49+
with:
50+
globs: "**/*.md"

‎.github/workflows/security.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ jobs:
2424
uses: zizmorcore/zizmor-action@45d7276c9ca790aabd705e31ca99c6185c3e76dd # v0.8.1
2525
with:
2626
advanced-security: false
27+
pip-audit:
28+
runs-on: ubuntu-slim
29+
permissions:
30+
contents: read
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
34+
with:
35+
persist-credentials: false
36+
- name: Install uv
37+
uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
38+
with:
39+
enable-cache: false
40+
version: ">=0.13,<0.14"
41+
- name: Setup environment
42+
run: |
43+
uv tool install rust-just
44+
just sync
45+
- name: Audit dependencies
46+
run: |
47+
just audit
2748
gitleaks:
2849
runs-on: ubuntu-slim
2950
steps:

‎.markdownlint-cli2.jsonc‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
2+
// Rule configuration
3+
"config": {
4+
// Line length
5+
"MD013": {
6+
"line_length": 120
7+
}
8+
},
29
// Files excluded from markdown linting (glob syntax)
310
"ignores": [
4-
".github/pull_request_template.md"
11+
".github/pull_request_template.md",
12+
".venv/**",
13+
"site/**"
514
]
615
}

‎Brewfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
brew "gitleaks"
22
brew "just"
3+
brew "markdownlint-cli2"
34
brew "uv"
45
brew "zizmor"

‎CHANGELOG.md‎

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎CLAUDE.md.example‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ Python project template using `uv` for environment/dependency management and `ju
66

77
- `just setup` - install Homebrew tools (`Brewfile`) and sync the project
88
- `just sync` - install all dependency groups into `.venv`
9-
- `just lint` - type check (ty), lint + autofix (ruff), format (ruff), spell check (codespell)
9+
- `just lint` - type check (ty), lint + autofix (ruff), format (ruff), spell check (codespell),
10+
workflow lint (actionlint)
1011
- `just ci-lint` - same checks without modifying files (used to verify, not fix)
1112
- `just test` - run pytest with coverage (fails under 98%)
13+
- `just audit` - check dependencies for known vulnerabilities (pip-audit)
14+
- `just markdownlint` - lint Markdown files (markdownlint-cli2, config in `.markdownlint-cli2.jsonc`)
15+
- `just docs-build` - build the docs with Zensical in strict mode (`zensical.toml`, pages in `docs/`)
16+
- `just docs-serve` - serve the docs locally with live reload
1217
- `just zizmor` - audit GitHub Actions workflows for security issues
1318
- `just git-leaks` - scan staged changes for secrets
14-
- `just set-github-labels` - create/update the release labels on GitHub (`scripts/sync-labels.sh`, needs `gh`)
19+
- `just set-github-labels` - remove non-release default labels, then create/update the release labels on GitHub
20+
(`scripts/sync-labels.sh`, needs `gh`, for fresh repos)
1521
- `uv add <pkg>` / `uv add --dev <pkg>` - add a runtime / dev dependency (never edit `uv.lock` by hand)
1622
- `uv run example` - run the app entry point
1723

@@ -23,7 +29,8 @@ Run `just lint` and `just test` before considering a change done.
2329
- `src/example/__init__.py` - `main()` entry point, exposed as the `example` script
2430
- `tests/` - pytest tests; import the package as `from example.<module> import ...`
2531
- `prek.toml` - git hook config (`prek install` to enable)
26-
- `.github/workflows/` - `python.yml` (lint + tests), `security.yml` (zizmor, gitleaks),
32+
- `.github/workflows/` - `python.yml` (lint, tests, docs build, markdownlint),
33+
`security.yml` (zizmor, gitleaks, pip-audit),
2734
`release-drafter.yml` (draft release, PR labels), `release.yml` (manual release)
2835
- `.github/release-drafter.yml` - release label → version bump / release notes section mapping
2936
- `.github/dependabot.yml` - weekly updates for actions, uv, dev container image and features

‎README.md‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,28 @@ manage project configuration and commands
2929

3030
* `just setup` - install Homebrew tools from the `Brewfile` and sync the project
3131
* `just sync` - sync project dependencies (all groups)
32-
* `just lint` - type check, lint, format, and spellcheck project files (applies fixes)
32+
* `just lint` - type check, lint, format, spellcheck, and lint workflows (actionlint) (applies fixes)
3333
* `just ci-lint` - run the same checks without modifying files (used in CI)
3434
* `just test` - run unit tests
35+
* `just audit` - check dependencies for known vulnerabilities with pip-audit
36+
* `just markdownlint` - lint Markdown files with markdownlint-cli2
37+
* `just docs-build` - build the docs site with Zensical (strict mode, output in `site/`)
38+
* `just docs-serve` - serve the docs locally with live reload
3539
* `just prek` - run pre-commit hooks via prek
3640
* `just git-leaks` - scan staged changes for secrets with gitleaks
3741
* `just zizmor` - audit GitHub Actions workflows for security issues
38-
* `just set-github-labels` - create or update the release labels on GitHub (requires `gh auth login`)
42+
* `just set-github-labels` - remove GitHub's non-release default labels, then create or update the release labels
43+
(for fresh repos, requires `gh auth login`)
3944
* `uv add {package}` - install a dependency
4045

4146
## CI and Security
4247

43-
| Workflow | Runs on | Purpose |
44-
| ------------------------------------------------- | ---------------------------- | ---------------------------------------------- |
45-
| `python.yml` | push / PR to `main` | lint and unit tests |
46-
| `security.yml` | push to `main`, all PRs | zizmor workflow audit, gitleaks secret scan |
47-
| `release-drafter.yml` | push to `main`, PRs | update the draft release, label PRs |
48-
| `release.yml` | manual | publish a release |
48+
| Workflow | Runs on | Purpose |
49+
| --------------------- | ----------------------- | -------------------------------------------- |
50+
| `python.yml` | push / PR to `main` | lint, unit tests, docs build, markdownlint |
51+
| `security.yml` | push to `main`, all PRs | zizmor, gitleaks, pip-audit dependency audit |
52+
| `release-drafter.yml` | push to `main`, PRs | update the draft release, label PRs |
53+
| `release.yml` | manual | publish a release |
4954

5055
* GitHub Actions are pinned to full commit SHAs, with the version in a trailing comment
5156
* Dependabot (`.github/dependabot.yml`) checks monthly for updates to GitHub Actions, Python
@@ -60,7 +65,7 @@ which reads the **release labels** on merged pull requests.
6065
A release label is a GitHub label added to the pull request itself, from the **Labels** section
6166
of the PR sidebar. Release Drafter only reads these labels. Commit messages and PR titles are not
6267
parsed, so prefixes like `feat:` or `fix:` have no effect. Only the labels below count as release
63-
labels; other repository labels (e.g. `good first issue`, `question`) are ignored.
68+
labels; any other repository labels you add are ignored.
6469

6570
| Release label | Version bump | Release notes section |
6671
| ----------------------------------------------------------------- | ------------ | --------------------- |

‎docs/index.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# example
2+
3+
Baseline Python project template.
4+
5+
* Build the docs with `just docs-build`
6+
* Add pages under `docs/` and list them in `nav` in `zensical.toml`
7+
* See the [API Reference](reference.md) for documentation generated from docstrings

‎docs/reference.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# API Reference
2+
3+
::: example.hello_world

‎justfile‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
1+
# List available recipes
2+
[private]
3+
default:
4+
@just --list
5+
# Check dependencies for known vulnerabilities (pip-audit)
6+
audit:
7+
uv run pip-audit --skip-editable
8+
# Type check, lint, format check, spell check, and lint workflows without changing files
19
ci-lint:
210
uv run ty check
311
uv run ruff check .
412
uv run ruff format --check .
513
uv run codespell
14+
uv run actionlint
15+
# Build the docs in strict mode (output in site/)
16+
docs-build:
17+
uv run zensical build --strict
18+
# Serve the docs locally with live reload
19+
docs-serve:
20+
uv run zensical serve
21+
# Scan staged changes for secrets
622
git-leaks:
723
gitleaks git --pre-commit --staged --redact
24+
# Type check, lint, format, spell check, and lint workflows, applying fixes
825
lint:
926
uv run ty check
1027
uv run ruff check . --fix
1128
uv run ruff format .
1229
uv run codespell
30+
uv run actionlint
31+
# Lint Markdown files
32+
markdownlint:
33+
markdownlint-cli2 "**/*.md"
34+
# Run the git hooks on staged files
1335
prek:
1436
uv run prek
37+
# Remove non-release default labels and sync the release labels on GitHub
1538
set-github-labels:
1639
./scripts/sync-labels.sh
40+
# Install Homebrew tools and sync the project
1741
setup:
1842
brew bundle install
1943
just sync
44+
# Install all dependency groups into .venv
2045
sync:
2146
uv sync --all-groups
47+
# Run unit tests with coverage
2248
test:
2349
uv run pytest
50+
# Audit GitHub Actions workflows for security issues
2451
zizmor:
2552
zizmor . --collect all

0 commit comments

Comments
 (0)