Skip to content

Add cross-platform template render checks in CI - #65

Merged
gtbuchanan merged 1 commit into
mainfrom
ci-cross-platform-template-render
Jul 5, 2026
Merged

Add cross-platform template render checks in CI#65
gtbuchanan merged 1 commit into
mainfrom
ci-cross-platform-template-render

Conversation

@gtbuchanan

Copy link
Copy Markdown
Owner

What

Render every source template on each platform in CI, not just Linux:

  • A render-templates matrix (macos-latest, ubuntu-latest, windows-latest) renders each OS's own templates natively. Because the render step self-selects via chezmoi ignored, each runner exercises only the templates deployed on its OS — real coverage of each platform's own template branches, which the single-OS pre-commit job can't give.
  • A render-templates-android job renders inside termux/termux-docker (arch-matched → native x86_64 on the runner, no QEMU), since android has no hosted runner and chezmoi.os can't be faked.

Unified render path

Everything now routes through one test:templates mise task — the hk render-templates hook and every CI leg call it. The android leg dispatches through scripts/docker-run.sh + scripts/render-templates-termux.sh back to the same task, so there is a single definition of how templates render (following the claude-code-termux script + mise-tasks/ pattern).

Externals fix

This exposed a latent fault: chezmoi ignored builds full source state, which realizes every .chezmoiexternal entry — downloading archives and SSH-cloning gists — merely to enumerate ignored targets. It only passed locally because the external cache was warm; a fresh checkout (CI) or the container would fetch and fail on missing CA certs / SSH keys.

chezmoi has no flag to suppress this (--refresh-externals=never only governs re-fetching a cached one; --exclude=externals filters output but still fetches — both verified). So home/.chezmoiexternal.yaml.tmpl now carries a {{ if not (get . "lintSkipExternals") }} guard that lint-templates.sh trips via --override-data on the single ignored call, keeping the check offline. get (not .field/hasKey) is a safe value-based read under chezmoi's missingkey=error. Normal chezmoi apply never sets the key, so externals deploy unchanged, and every template — including .chezmoiexternal itself — still renders in full.

Verification

  • Native render on Windows and the android leg in a real termux-docker container both pass offline (exit 0, correctly skipping non-platform templates).
  • render-templates, verify-mise, shellcheck, shfmt, and actionlint all green.

Documented in AGENTS.md (Template Render Lint).

🤖 Generated with Claude Code

Render every source template on each platform, not just Linux. A
render-templates matrix (macOS/Ubuntu/Windows) renders each OS's own
templates natively, and a render-templates-android job renders in a
termux/termux-docker container since android has no hosted runner.

Unify the render path on a single test:templates mise task: the hk
render-templates hook and every CI leg call it (android dispatches
through docker-run.sh + render-templates-termux.sh to the same task),
so there is one definition of how templates render.

Fix a latent externals fault this exposed: chezmoi ignored builds full
source state, realizing every .chezmoiexternal (downloading archives,
SSH-cloning gists) just to enumerate ignored targets. That passed only
because the local cache was warm; a fresh checkout (CI) or the container
would fetch and fail on missing certs / SSH keys. chezmoi has no flag to
skip externals, so guard .chezmoiexternal with lintSkipExternals and
trip it via --override-data on the one ignored call, keeping the check
offline. Every template, including .chezmoiexternal, still renders full.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 072b3de4-f602-4b5d-be33-ad18d79762b8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds cross-platform CI jobs to render/lint chezmoi templates on macOS, Ubuntu, Windows, and Android/Termux (via Docker). It introduces mise task scripts, a Docker runner, a Termux renderer, a lintSkipExternals guard in the externals template to avoid network fetches during linting, and documents the workflow.

Changes

Template Render Lint Feature

Layer / File(s) Summary
lintSkipExternals guard and lint updates
home/.chezmoiexternal.yaml.tmpl, scripts/lint-templates.sh
Wraps externals config in a conditional guard keyed on lintSkipExternals, and updates chezmoi ignored invocation to pass --override-data '{"lintSkipExternals":true}' so ignore-set computation avoids realizing externals.
Cross-platform render task scripts
mise-tasks/test/templates, mise-tasks/test/templates-android, scripts/docker-run.sh, scripts/render-templates-termux.sh, mise.toml
Adds a shared template rendering entrypoint, an Android-aware wrapper that runs natively or via Docker/Termux, a generic Docker runner script targeting termux/termux-docker, and updates mise.toml includes to load mise-tasks.
CI jobs and documentation
.github/workflows/ci.yml, AGENTS.md
Adds render-templates (macOS/Ubuntu/Windows matrix) and render-templates-android CI jobs, and documents the template render lint workflow and the lintSkipExternals guard rationale.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CI as CI Workflow
  participant TaskAndroid as mise-tasks/test/templates-android
  participant Docker as scripts/docker-run.sh
  participant Termux as scripts/render-templates-termux.sh
  participant Task as mise-tasks/test/templates
  participant Lint as scripts/lint-templates.sh

  CI->>TaskAndroid: mise run test:templates-android
  TaskAndroid->>TaskAndroid: check uname -o for Android
  alt Native Android
    TaskAndroid->>Task: mise run test:templates
  else Non-Android
    TaskAndroid->>Docker: run render-templates-termux.sh
    Docker->>Termux: exec inside termux/termux-docker
    Termux->>Termux: install chezmoi if missing
    Termux->>Task: exec mise-tasks/test/templates
  end
  Task->>Lint: lint each *.tmpl file
  Lint->>Lint: chezmoi ignored --override-data lintSkipExternals=true
  Lint-->>Task: render/validate result
Loading

Possibly related PRs

  • gtbuchanan/dotfiles#57: Both PRs modify scripts/lint-templates.sh, with this PR extending the chezmoi ignored computation via lintSkipExternals/--override-data.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main CI template rendering changes and stays concise.
Description check ✅ Passed The description clearly describes the cross-platform template render checks and offline externals fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped gtbuchanan/tooling.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gtbuchanan
gtbuchanan marked this pull request as ready for review July 5, 2026 00:43
@gtbuchanan
gtbuchanan marked this pull request as draft July 5, 2026 00:43
@gtbuchanan
gtbuchanan force-pushed the ci-cross-platform-template-render branch from dca860c to ce91f66 Compare July 5, 2026 00:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 18: The workflow uses mutable action tags instead of commit SHAs, so
update each `uses:` reference in the CI workflow to a full pinned commit hash
and add the matching version comment where appropriate. Apply this to
`actions/checkout` and the `mise-setup` action entries so the references in the
workflow are immutable and can be traced back to a specific release.
- Line 21: The CI workflow is still pinned to the temporary mutable branch ref
for the shared mise setup action. Update the workflow entries that use
gtbuchanan/tooling/.github/actions/mise-setup in the render jobs to point back
to the stable shared-action ref once the EXDEV fix is available, so the workflow
no longer depends on fix-mise-setup-windows-exdev.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 25777022-930a-4426-ab0f-c758c5d090e3

📥 Commits

Reviewing files that changed from the base of the PR and between 46d5b91 and dca860c.

⛔ Files ignored due to path filters (1)
  • hk.pkl is excluded by !**/*.pkl
📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • AGENTS.md
  • home/.chezmoiexternal.yaml.tmpl
  • mise-tasks/test/templates
  • mise-tasks/test/templates-android
  • mise.toml
  • scripts/docker-run.sh
  • scripts/lint-templates.sh
  • scripts/render-templates-termux.sh
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
home/.chezmoiexternal.yaml.tmpl

📄 CodeRabbit inference engine (AGENTS.md)

home/.chezmoiexternal.yaml.tmpl: Keep the {{ if not (get . "lintSkipExternals") }} guard in home/.chezmoiexternal.yaml.tmpl; do not remove it because lint relies on it to avoid realizing externals offline.
Add new Agent Skills by adding an entry in home/.chezmoiexternal.yaml.tmpl that points to the skill archive.

Files:

  • home/.chezmoiexternal.yaml.tmpl
AGENTS.md

📄 CodeRabbit inference engine (CLAUDE.md)

AGENTS.md: Document agent responsibilities and capabilities in AGENTS.md
Maintain AGENTS.md as the source of truth for agent configuration and behavior documentation

Files:

  • AGENTS.md
🪛 LanguageTool
AGENTS.md

[uncategorized] ~183-~183: The official name of this software platform is spelled with a capital “H”.
Context: ...mise run test:templates-android); see .github/workflows/ci.yml. chezmoi ignored r...

(GITHUB)

🪛 zizmor (1.26.1)
.github/workflows/ci.yml

[error] 18-18: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 21-21: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 35-35: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 38-38: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🔇 Additional comments (10)
home/.chezmoiexternal.yaml.tmpl (1)

2-7: LGTM!

Also applies to: 123-123

scripts/lint-templates.sh (1)

61-71: LGTM!

mise.toml (1)

38-41: LGTM!

.github/workflows/ci.yml (1)

8-17: LGTM!

Also applies to: 28-39

AGENTS.md (1)

178-192: LGTM!

mise-tasks/test/templates (2)

1-17: LGTM!


18-25: 🎯 Functional Correctness

scripts/lint-templates.sh already targets POSIX sh, so invoking it with sh is fine.

			> Likely an incorrect or invalid review comment.
mise-tasks/test/templates-android (1)

1-15: LGTM!

Detection via uname -o for Android, with a Docker fallback for non-Termux hosts, is a reasonable approach and consistent with the documented rationale (.chezmoi.os is unfakeable via GOOS).

scripts/render-templates-termux.sh (1)

1-18: LGTM!

Path resolution (Line 17) correctly derives the repo root relative to this script's location inside the container, and the git-free design matches the documented constraint about the read-only bind mount's .git.

scripts/docker-run.sh (1)

1-36: LGTM!

Arch-to-tag mapping matches the actual termux/termux-docker tags (aarch64, x86_64) available on Docker Hub, and the --privileged/read-only mount rationale is clearly documented.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
@gtbuchanan
gtbuchanan marked this pull request as ready for review July 5, 2026 00:55
@gtbuchanan
gtbuchanan merged commit 0b6fcad into main Jul 5, 2026
10 of 11 checks passed
@gtbuchanan
gtbuchanan deleted the ci-cross-platform-template-render branch July 5, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant