Skip to content

Commit 921f4d5

Browse files
committed
Move motivation for cruft usage to separate doc.
It doesn't need to be in the README and was taking up most of the space in there. Link the doc from CONTRIBUTING.md for the more curious contributors (and to make it more discoverable). Signed-off-by: Adam Cmiel <[email protected]>
1 parent ea36534 commit 921f4d5

File tree

3 files changed

+73
-71
lines changed

3 files changed

+73
-71
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
all rendering so that we don't have to bother with that.
2323
* You may have noticed that we kind of work around the entirety of Cookiecutter
2424
by configuring it this way. Why use it at all then? Single reason: so that
25-
those who onboard can get automated updates using [`cruft`][cruft].
25+
those who onboard can get automated updates using [`cruft`][cruft] (if you'd
26+
like to know more, see [docs/why-cruft.md](docs/why-cruft.md)).
2627
* [`.github/`](.github/)
2728
* Your standard `.github` directory for workflows and related resources
2829
* Most of the files are copy-pasted from `{{cookiecutter.repo_root}}/`

README.md

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -60,76 +60,6 @@ Process:
6060

6161
See [CONTRIBUTING.md](CONTRIBUTING.md).
6262

63-
## 📜 Why use [cruft]
64-
65-
What we need to share:
66-
67-
- `.github/workflows/*` files
68-
- scripts used for `.github/workflows/*` **and** for local development
69-
70-
### Options considered
71-
72-
#### GitHub actions
73-
74-
Maintain a set of GitHub actions that task repos can reuse.
75-
76-
❌ Problems:
77-
78-
- Each repo still needs its own workflow files referencing the actions
79-
- The repos don't get locally runnable scripts
80-
- [nektos/act] could help to some extent, but it brings more complexity
81-
82-
#### Git submodule
83-
84-
Include the workflow files and scripts as a git submodule.
85-
86-
❌ Problems:
87-
88-
- It's not possible to run workflows from git submodules ([github#10892])
89-
90-
#### Reusable workflows
91-
92-
Maintain a set of [reusable workflows] that task repos can call.
93-
94-
❌ Problems:
95-
96-
- Same as the [GitHub actions](#github-actions) approach
97-
98-
#### GitHub template repo
99-
100-
Create a [template repo], generate task repos from the template.
101-
For existing repos, they would have to copy-paste the files directly.
102-
103-
❌ Problems:
104-
105-
- The shared files get copied once and then never updated
106-
- No good way to evolve functionality over time, introduce new checks etc.
107-
108-
#### cruft
109-
110-
Create a [cookiecutter] template, include the template in task repos, use [cruft]
111-
to keep it up to date.
112-
113-
✅ What works:
114-
115-
- Task repos include the workflow files and scripts from the template directly
116-
- The repos get a solid mechanism for keeping the shared CI up to date
117-
- It's straightforward to test CI changes directly in the target repo
118-
119-
❔ What may not:
120-
121-
- To some extent, it's possible to patch the shared files and have the patches
122-
respected during updates
123-
- Task repo maintainers may decide not to contribute to the shared templates and
124-
overly rely on local patches (we don't want that)
125-
- Making local patches increases the chance of merge conflicts during the update
126-
(which may be good, because it discourages the above)
127-
12863
[cruft]: https://cruft.github.io/cruft
129-
[nektos/act]: https://github.com/nektos/act
130-
[github#10892]: https://github.com/orgs/community/discussions/10892
131-
[reusable workflows]: https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows#calling-a-reusable-workflow
132-
[template repo]: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository
133-
[cookiecutter]: https://cookiecutter.readthedocs.io/en/stable/
13464
[uv]: https://docs.astral.sh/uv/
13565
[Renovate]: https://docs.renovatebot.com/

docs/why-cruft.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Why we use [cruft]
2+
3+
What we need to share:
4+
5+
* `.github/workflows/*` files
6+
* scripts used for `.github/workflows/*` **and** for local development
7+
8+
## Options considered
9+
10+
### GitHub actions
11+
12+
Maintain a set of GitHub actions that task repos can reuse.
13+
14+
❌ Problems:
15+
16+
* Each repo still needs its own workflow files referencing the actions
17+
* The repos don't get locally runnable scripts
18+
* [nektos/act] could help to some extent, but it brings more complexity
19+
20+
### Git submodule
21+
22+
Include the workflow files and scripts as a git submodule.
23+
24+
❌ Problems:
25+
26+
* It's not possible to run workflows from git submodules ([github#10892])
27+
28+
### Reusable workflows
29+
30+
Maintain a set of [reusable workflows] that task repos can call.
31+
32+
❌ Problems:
33+
34+
* Same as the [GitHub actions](#github-actions) approach
35+
36+
### GitHub template repo
37+
38+
Create a [template repo], generate task repos from the template.
39+
For existing repos, they would have to copy-paste the files directly.
40+
41+
❌ Problems:
42+
43+
* The shared files get copied once and then never updated
44+
* No good way to evolve functionality over time, introduce new checks etc.
45+
46+
### cruft
47+
48+
Create a [cookiecutter] template, include the template in task repos, use [cruft]
49+
to keep it up to date.
50+
51+
✅ What works:
52+
53+
* Task repos include the workflow files and scripts from the template directly
54+
* The repos get a solid mechanism for keeping the shared CI up to date
55+
* It's straightforward to test CI changes directly in the target repo
56+
57+
❔ What may not:
58+
59+
* To some extent, it's possible to patch the shared files and have the patches
60+
respected during updates
61+
* Task repo maintainers may decide not to contribute to the shared templates and
62+
overly rely on local patches (we don't want that)
63+
* Making local patches increases the chance of merge conflicts during the update
64+
(which may be good, because it discourages the above)
65+
66+
[cruft]: https://cruft.github.io/cruft
67+
[cookiecutter]: https://cookiecutter.readthedocs.io/en/stable/
68+
[nektos/act]: https://github.com/nektos/act
69+
[github#10892]: https://github.com/orgs/community/discussions/10892
70+
[reusable workflows]: https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows#calling-a-reusable-workflow
71+
[template repo]: https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository

0 commit comments

Comments
 (0)