Skip to content

feat(template): document remaining one-time setup, soften Codecov gate, fix freezer spec - #53

Merged
hasansezertasan merged 4 commits into
mainfrom
feat/document-codecov-setup
Jul 5, 2026
Merged

feat(template): document remaining one-time setup, soften Codecov gate, fix freezer spec#53
hasansezertasan merged 4 commits into
mainfrom
feat/document-codecov-setup

Conversation

@hasansezertasan

@hasansezertasan hasansezertasan commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #51. That PR hardened and documented the optional Docker Hub publish channel; auditing the rest of a generated project's external integrations surfaced more that are inert or silently broken until manually configured, none covered by the generated CONTRIBUTING.md "Repository setup" section. This completes that section, softens the Codecov gate the same way #51 handled GHCR-only runs, and fixes a latent PyInstaller-spec corruption bug found along the way.

Codecov (behavior + docs)

CI passed CODECOV_TOKEN unconditionally with no setup guidance, and a missing token made the codecov-action upload silently no-op — the inverse of the fail-fast/visible-skip treatment #51 gave Docker Hub.

  • ci.yml.jinja: surface CODECOV_TOKEN as a job-level CODECOV_TOKEN_SET presence flag (the secrets context is unavailable in if:), gate the upload step on it, and emit an Ubuntu-only ::notice:: when unset so the skip is visible instead of a quiet non-upload. The build still passes.
  • Documented as repository-setup step 6 + a README "Coverage reporting setup" walkthrough.

GitHub Pages & Renovate (docs)

  • GitHub Pagesdeploy-docs pushes docs to a gh-pages branch, but GitHub won't serve it until Pages is pointed there, so docs build every release and are never visible. Repository-setup step 7 + README note.
  • Renovate.github/renovate.json is inert until the hosted Renovate app is installed. Repository-setup step 8 + README note.
  • Docker Hub (optional, include_web) renumbers to step 9; CLAUDE.md's stale "runs unconditionally" Codecov line is corrected.

PyInstaller freezer spec corruption (fix)

The typos prek hook auto-writes fixes and misreads PyInstaller's datas field (Analysis(datas=...) / a.datas) as data. A generated project with include_freezer shipped no typos allowlist, so prek run would silently rewrite <pkg>.spec to the invalid data=, breaking freezer builds.

  • template/pyproject.toml.jinja: add an include_freezer-gated [tool.typos] section allowing datas — per-project config lives in pyproject.toml, not a standalone file.
  • _typos.toml (template repo root): allow CPY (ruff rule code) and datas so the template's own prek run doesn't rewrite template/{...}.spec.jinja. The repo has no root pyproject.toml; adding a bare one breaks uv run --group prek (Group prek is not defined), so its config stays in _typos.toml.

Other folded-in lint fixes

Pre-existing on main, so the template repo's prek run --all-files is fully green: pad ADR table delimiters for MD060 (markdownlint-cli2 v0.22.1 bump), reword a mis-bump typos false-positive, fix the generated README's stale TOC link (Disclaimer → real Credits heading, MD051), and reformat copier.yml help text via yamlfmt.

Test plan

  • Rendered defaults (steps 1–8, no Docker Hub) and include_web (Docker Hub → step 9); actionlint passes on ci.yml
  • ci.yml Codecov upload gated on CODECOV_TOKEN_SET with an Ubuntu-only visible-skip notice
  • Rendered include_freezer project: [tool.typos] present, datas no longer flagged, spec is not rewritten
  • Rendered non-freezer project: no [tool.typos] section, pyproject.toml valid TOML
  • prek run --all-files green and idempotent on the template repo (second pass makes no changes)

…decov gate

PR #51 hardened + documented the Docker Hub publish channel. Auditing the rest
of the generated project's external integrations surfaced three more that were
inert or undocumented until manually configured, none covered by the
CONTRIBUTING repository-setup section:

- Codecov: CI passed CODECOV_TOKEN unconditionally with no setup guidance, and a
  missing token made the upload silently no-op. Now gated on a job-level
  CODECOV_TOKEN_SET presence flag with an Ubuntu-only ::notice:: visible skip
  (build still passes); documented as repo-setup step 6 + a README walkthrough.
- GitHub Pages: deploy-docs pushes to gh-pages, but Pages must be pointed at that
  branch or docs build and are never served. Added repo-setup step 7 + README note.
- Renovate: .github/renovate.json is inert until the hosted Renovate app is
  installed. Added repo-setup step 8 + README note.

Docker Hub (optional, include_web) renumbers to step 9. CLAUDE.md's now-stale
'Codecov upload runs unconditionally' line is corrected to match the new gate.

Verified: renders with defaults (steps 1-8) and include_web (adds step 9);
actionlint passes on ci.yml; rendered CONTRIBUTING.md passes markdownlint.
Folded in alongside the repository-setup docs so the template repo's `prek run`
is green. All pre-existing on main, none related to the docs change:

- docs/adr/*.md: pad table delimiter rows (`| --- |`) to satisfy MD060, newly
  enforced by the markdownlint-cli2 v0.22.1 bump.
- CLAUDE.md: reword "mis-bump" (typos false-positive) to "bump them incorrectly".
- template/README.md.jinja: the generated README's table of contents linked a
  non-existent "Disclaimer" section; point it at the real "Credits" heading (MD051).
- _typos.toml: allow the `CPY` ruff rule code (flake8-copyright), which typos
  misreads as COPY/CPU only in the .jinja source. Repo-root only, so generated
  projects are unaffected.
@sourcery-ai

sourcery-ai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Documents all remaining one-time external integrations (Codecov, GitHub Pages, Renovate), softens the Codecov CI gate to be opt‑in with visible skips, renumbers Docker Hub setup accordingly, and folds in small lint/config fixes to keep the template’s own tooling green.

Sequence diagram for gated Codecov upload in CI workflow

sequenceDiagram
    participant Developer
    participant GitHubActions as GitHub_Actions_CI
    participant CIJob as ci_job_tests
    participant Codecov

    Developer->>GitHubActions: push_or_pr_event
    GitHubActions->>CIJob: start_matrix_job
    CIJob->>CIJob: set_env CODECOV_TOKEN_SET
    CIJob->>CIJob: run_tests_and_generate_coverage_xml

    alt [env.CODECOV_TOKEN_SET == 'true']
        CIJob->>Codecov: codecov_action_upload(coverage.xml, CODECOV_TOKEN)
    else [env.CODECOV_TOKEN_SET != 'true' && matrix.os == 'ubuntu-latest']
        CIJob->>CIJob: echo_notice_skipped_coverage_upload
    end

    CIJob-->>GitHubActions: job_success
    GitHubActions-->>Developer: CI_passes_without_coverage_requirement
Loading

File-Level Changes

Change Details Files
Make Codecov coverage upload in CI opt-in, gated on presence of CODECOV_TOKEN, with a visible notice when skipped.
  • Expose a CODECOV_TOKEN_SET flag via job env to represent presence of CODECOV_TOKEN, since secrets are unavailable in if conditions.
  • Gate the Codecov upload step on CODECOV_TOKEN_SET being true.
  • Add a follow-up step that emits a ::notice:: on Ubuntu when CODECOV_TOKEN is missing, explaining the skip and pointing to CONTRIBUTING.md.
template/.github/workflows/ci.yml.jinja
Fully document Codecov, GitHub Pages, and Renovate as one-time repository setup steps, and renumber Docker Hub setup accordingly.
  • Clarify that repository setup covers both release and maintenance workflows.
  • Add a new step describing Codecov setup, including linking the repo, creating CODECOV_TOKEN, and explaining opt-in behavior.
  • Add a new step explaining GitHub Pages configuration after gh-pages branch creation, with gh CLI and UI instructions.
  • Add a new step explaining that Renovate configuration is inert until the GitHub App is installed, with installation guidance.
  • Renumber the optional Docker Hub publishing step from 6 to 9 when include_web is enabled to keep numbering contiguous.
template/CONTRIBUTING.md.jinja
Surface the new coverage, documentation, and dependency update setup flows in the main README.
  • Add a Coverage reporting setup section that walks through Codecov setup and notes opt-in behavior.
  • Add a Documentation site and dependency updates section summarizing GitHub Pages and Renovate one-time configuration, pointing to CONTRIBUTING.md for full commands.
README.md
template/README.md.jinja
Update template documentation to reflect the new Codecov gating behavior and fix minor wording and TOC issues.
  • Change CLAUDE.md description of CI to state that Codecov upload is gated on CODECOV_TOKEN and produces a visible notice when unset, with setup documented in CONTRIBUTING.md.
  • Tighten wording around how misconfigured merge strategies affect release-please, clarifying miss vs incorrect bump.
  • Fix the generated README’s table of contents entry from Disclaimer to Credits to match the actual heading.
CLAUDE.md
template/README.md.jinja
Apply markdownlint table formatting fixes across ADR docs to satisfy updated lint rules.
  • Pad table delimiter rows with spaces across multiple ADR markdown files to conform to MD060 expectations.
  • Adjust table header separators where needed to match the new linting style.
docs/adr/002-release-please-for-release-automation.md
docs/adr/003-tox-as-canonical-lint-runner.md
docs/adr/004-commitizen-as-commit-helper-not-release-tool.md
docs/adr/005-five-type-checkers-basedpyright-strict.md
docs/adr/006-sphinx-shibuya-for-documentation.md
docs/adr/007-standalone-executable-toggles.md
Add a root typos configuration to ignore the CPY identifier used in the ruff config so template lint runs stay green.
  • Create a _typos.toml at repo root, scoped outside template/, to avoid affecting generated projects.
  • Extend identifiers to treat CPY as an allowed token, preventing false positives from typos against the ruff ignore list.
_typos.toml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@hasansezertasan hasansezertasan added the no-issue Bypass the linked-issue requirement for PRs that need no issue label Jul 5, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c1abc43f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread template/.github/workflows/ci.yml.jinja Outdated
The `typos` prek hook auto-writes fixes and misreads PyInstaller's `datas`
field (`Analysis(datas=...)` / `a.datas`) as `data`. A generated project with
include_freezer shipped no typos allowlist, so `prek run` silently rewrote its
<pkg>.spec to the invalid `data=`, breaking freezer builds.

- template/pyproject.toml.jinja: add an include_freezer-gated [tool.typos]
  section allowing `datas` — per-project config lives in pyproject.toml (which
  generated projects have), not a standalone _typos.toml.
- _typos.toml: also allow `datas` so the template repo's own `prek run` does not
  rewrite template/{...}.spec.jinja (the repo has no root pyproject.toml — a bare
  one breaks `uv run --group prek`, so its config stays in _typos.toml).

Also folds in the yamlfmt reformat of copier.yml surfaced by `prek run
--all-files` (help-text line rejoin) so the repo's prek run is fully green.
@hasansezertasan hasansezertasan changed the title feat(template): document remaining one-time setup and soften the Codecov gate feat(template): document remaining one-time setup, soften Codecov gate, fix freezer spec Jul 5, 2026
…typos block

Gating the Codecov upload solely on CODECOV_TOKEN_SET skipped coverage for
forked PRs on public repos, which never receive secrets — regressing the prior
tokenless fallback. Also run the upload when the run is a forked PR, and keep
the visible skip only for same-repo runs with no token.

Drop the stray blank lines around the include_freezer [tool.typos] block so it
renders a single section separator, per the {%- -%} whitespace convention.
@hasansezertasan
hasansezertasan merged commit 5e7f288 into main Jul 5, 2026
10 checks passed
@hasansezertasan
hasansezertasan deleted the feat/document-codecov-setup branch July 5, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-issue Bypass the linked-issue requirement for PRs that need no issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant