-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor: rename cicd.yaml in template #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| Should be `ci.yaml` for more precise naming. | ||
|
|
||
| --- | ||
|
|
||
| ## Spec | ||
|
|
||
| **What:** Rename `template/.github/workflows/cicd.yaml` → `template/.github/workflows/ci.yaml`, | ||
| change its internal `name: CI/CD` → `name: CI`, and update the two references to the old filename: | ||
| `template/.github/workflows/release.yaml:28` (`uses: ./.github/workflows/cicd.yaml`) and the badge | ||
| in `template/README.md.jinja:3`. No `_migrations` entry, no test changes beyond keeping the suite | ||
| green. | ||
|
|
||
| **Why:** The workflow contains only `lint`, `test` and `docs` jobs — there is no deployment in it. | ||
| Releasing lives in `release.yaml` and publishing in `publish.yaml`, so `cicd.yaml` / `name: CI/CD` | ||
| claims a responsibility the file does not have, and generated projects inherit that misnomer. `ci` | ||
| is what the file actually is, and it matches this repo's own `.github/workflows/ci.yaml`. | ||
|
|
||
| ### Copier-update behaviour (the open question, answered) | ||
|
|
||
| Verified empirically with copier 9.11.3 by generating a project from `origin/main`, committing the | ||
| rename in a template clone, and running `copier update`: | ||
|
|
||
| - **A clean `copier update` does perform the rename.** `cicd.yaml` is deleted, `ci.yaml` is created, | ||
| and the `release.yaml` / `README.md` references are rewritten. This holds whether or not the | ||
| template carries git tags. **So this ticket needs no `_migrations` entry.** | ||
| - **A downstream project's local edits to `cicd.yaml` are silently dropped** — they are not carried | ||
| into `ci.yaml`, and no conflict or `.rej` file is produced. Recoverable from the project's own git | ||
| history, but the update will not warn. | ||
| - Two pre-existing template defects gate the above; both are **out of scope here** (see below) and | ||
| neither blocks this rename: | ||
| 1. The template ships no `{{ _copier_conf.answers_file }}.jinja`, so generated projects have no | ||
| `.copier-answers.yml` and `copier update` refuses to run at all: *"Cannot update because cannot | ||
| obtain old template references from `.copier-answers.yml`."* Every project generated to date is | ||
| therefore un-updatable, which is why this rename cannot strand anyone today. | ||
| 2. `_tasks` (`git init`, `git checkout -b main`) also run on `update` and fail there | ||
| (`fatal: a branch named 'main' already exists`, exit 128). The abort lands *after* `ci.yaml` is | ||
| written and *before* `cicd.yaml` is deleted — a half-applied rename leaving both files, with the | ||
| stale `cicd.yaml` still triggering on `push`/`pull_request` and producing duplicate CI runs. | ||
|
|
||
| ### Notes for the implementer | ||
|
|
||
| - Use `git mv` so the rename is recorded as a rename. | ||
| - `cicd.yaml` has no `.jinja` suffix and is copied verbatim (`_templates_suffix: .jinja`); keep it | ||
| that way — its `${{ matrix.python-version }}` would collide with Jinja. | ||
| - Branch rulesets require **job** names (`lint`, `test`, `docs`), which do not change, so no ruleset | ||
| breaks. The README **badge URL is per-filename**, so existing generated projects keep a badge | ||
| pointing at `cicd.yaml` until they re-render; acceptable, and noted rather than mitigated. | ||
| - #7 (CI gate) edits the same file and declares this rename out of its own scope — whichever lands | ||
| first, the other rebases. Not a dependency. | ||
|
|
||
| ## Acceptance criteria | ||
|
|
||
| - [ ] `template/.github/workflows/ci.yaml` exists with the previous `cicd.yaml` content and no | ||
| `.jinja` suffix; `template/.github/workflows/cicd.yaml` no longer exists. | ||
| - [ ] The rename is recorded as a rename in the commit (`git show --stat` shows R, not add+delete). | ||
| - [ ] `ci.yaml` line 1 reads `name: CI`. | ||
| - [ ] `template/.github/workflows/release.yaml` uses `./.github/workflows/ci.yaml`. | ||
| - [ ] The `Tests` badge in `template/README.md.jinja` points at `actions/workflows/ci.yaml` in both | ||
| the image URL and the link target. | ||
| - [ ] `git grep -i cicd` returns nothing under `template/`. | ||
| - [ ] `uv run pytest tests` is green. | ||
| - [ ] Commit uses a `refactor:` prefix and carries no AI attribution trailer. | ||
|
|
||
| ## Out of scope | ||
|
|
||
| - Shipping `{{ _copier_conf.answers_file }}.jinja` so generated projects become updatable (defect 1 | ||
| above) — its own ticket. | ||
| - Guarding `_tasks` with `when: "{{ _copier_conf.operation == 'copy' }}"` so `copier update` is not | ||
| aborted by `git init` / `git checkout -b main` (defect 2 above) — its own ticket. | ||
| - Renaming the `template/docs/source/contributing/ci_cd.md` stub or its `# CI/CD` heading: that page | ||
| documents the whole pipeline including release and publish, so its name is not the misnomer. | ||
| - Any `_migrations` entry — the empirical result above shows the rename propagates without one. | ||
|
|
||
| ## Verification | ||
|
|
||
| ```bash | ||
| uv run pytest tests # needs network; renders a project and runs its lint/test/pre-commit | ||
| git grep -i cicd -- template/ ; echo "exit=$?" # expect no matches | ||
| ``` | ||
|
|
||
| No `Depends-on:` — every file this spec touches is present on `origin/main`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| name: CI/CD | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ on: | |
|
|
||
| jobs: | ||
| ci: | ||
| uses: ./.github/workflows/cicd.yaml | ||
| uses: ./.github/workflows/ci.yaml | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the reference that would actually break the generated project if missed — a stale Nit / follow-up candidate: ~Written by Claude, run via the agentic engineering loop |
||
|
|
||
| release: | ||
| needs: ci | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # {{ project_name }} | ||
|
|
||
| [](https://github.com/{{ github_username }}/{{ project_slug }}/actions/workflows/cicd.yaml) | ||
| [](https://github.com/{{ github_username }}/{{ project_slug }}/actions/workflows/ci.yaml) | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both the image URL and the link target were updated — I checked the rendered output too, not just the template source: Worth remembering when this lands: badge URLs are per-filename, so already-generated projects keep a badge pointing at ~Written by Claude, run via the agentic engineering loop |
||
| [ }}.svg)](https://pypi.org/project/{{ project_slug | replace('_', '-') }}/) | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,11 +18,11 @@ | |
|
|
||
| # Both CI workflows carry the aggregate `ci-gate` job. They can be parsed | ||
| # straight from disk: `_templates_suffix: .jinja` means only `.jinja` files are | ||
| # rendered, so the template's cicd.yaml is copied verbatim (which is also why | ||
| # rendered, so the template's ci.yaml is copied verbatim (which is also why | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: now that both files are named ~Written by Claude, run via the agentic engineering loop |
||
| # its `${{ matrix.python-version }}` survives generation). | ||
| CI_WORKFLOWS = [ | ||
| TEMPLATE_ROOT / ".github" / "workflows" / "ci.yaml", | ||
| TEMPLATE_ROOT / "template" / ".github" / "workflows" / "cicd.yaml", | ||
| TEMPLATE_ROOT / "template" / ".github" / "workflows" / "ci.yaml", | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A failure now reports Non-blocking. ~Written by Claude, run via the agentic engineering loop
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor (legibility, introduced by this diff): both Before the rename these read Suggested fix (one line, no behaviour change): ids=lambda p: str(p.relative_to(TEMPLATE_ROOT))Not blocking, and the spec's "no test changes beyond keeping the suite green" arguably scopes it out of this PR. ~Written by Claude, run via the agentic engineering loop |
||
| ] | ||
|
|
||
|
|
||
|
|
@@ -310,7 +310,7 @@ def test_generated_release_keeps_local_workflow_ref_unpinned(project): | |
| for path, _, ref, _ in _uses_refs(project.path / ".github" / "workflows") | ||
| if ref.startswith("./") | ||
| ] | ||
| assert local == [("release.yaml", "./.github/workflows/cicd.yaml")] | ||
| assert local == [("release.yaml", "./.github/workflows/ci.yaml")] | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (pre-existing gap, not introduced here): this asserts the text of the local The PR description already flags this as a follow-up candidate, and the spec explicitly scopes test additions out ("no test changes beyond keeping the suite green"), so this is a note for the human reviewer rather than a request. I closed the gap manually for this PR by rendering a project from the committed HEAD — see the summary. ~Written by Claude, run via the agentic engineering loop |
||
|
|
||
|
|
||
| def test_default_slug_is_valid_package_name(tmp_path): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct and complete: this is the only content change in the renamed file (similarity index 99%), and
git show --name-status -Mrecords it asR099, so history follows the file.Nit, no action needed here:
template/docs/source/contributing/ci_cd.mdstill carries# CI/CD, andcontributing/index.md:8still lists CI/CD in the toc. The spec deliberately scopes that out — that page describes the whole pipeline includingrelease.yamlandpublish.yaml, so its name isn't the misnomer this ticket targets. Flagging only so the residual "CI/CD" strings intemplate/aren't mistaken for a missed rename.~Written by Claude, run via the agentic engineering loop