Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Add workflow to cleanup after project was created from template #3

Merged
merged 9 commits into from
Mar 5, 2022

Conversation

LtdSauce
Copy link
Contributor

@LtdSauce LtdSauce commented Feb 25, 2022

This PR was moved from the cpp_starter_project (cpp-best-practices/gui_starter_template#197).
This PR implements a first simple workflow to do some cleanup inspired by #5.

As community/community#5336 is not implemented by github, this PR should workaround that need for a template project.

Goals of this PR:

  • cleanup build badges when project is created from template and remove the worklfow from the project
  • allow to make forks to contribute to the template without triggering the workflow: Use the information if the repository is a template for this
  • make it possible to create another template based on this template with correct build badges easily or automatically (better: don't make it impossible): Use the information if the repository is a template for this
  • rename the cmake project when project is created
  • remove LICENSE file so new project is not by default Public Domain, and encourage user to place their own
  • remove funding.yml file so new project doesn't implicitly point back to @lefticus
  • consider a README-Template.md that is easier to regex replace from and use that to replace existing README.md This might make setup and maintenance easier?
  • Test: on template repo run the workflow with random variables to check it is working and just omit the push into the repository
  • Probably have the diffs of the commit checked when run on the project template (those should be deterministic)
  • Use repo description to fill in a placeholder inside the README template

LtdSauce and others added 4 commits February 25, 2022 20:42
Add a workflow that cleansup the created project. Basically it does the
following:
- Rename cmake project to the github repository name
- Replace some placeholder with the information from the new project in
  a README template. Then move it into place.
- delete everything from the cleanup process
@LtdSauce LtdSauce marked this pull request as draft February 27, 2022 18:57
@LtdSauce
Copy link
Contributor Author

I'll close the PR while i am working on it so not every push wants to trigger the workflows

@LtdSauce LtdSauce closed this Feb 27, 2022
@LtdSauce
Copy link
Contributor Author

I guess i have everything covered. I am not sure how to test if the search and replace worked out correctly,,, currently i just print the diff.

@LtdSauce LtdSauce reopened this Feb 27, 2022
@LtdSauce LtdSauce marked this pull request as ready for review February 27, 2022 21:15
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@54e8dbf). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main       cpp-best-practices/cpp_starter_project#3   +/-   ##
=======================================
  Coverage        ?   72.72%           
=======================================
  Files           ?        3           
  Lines           ?       33           
  Branches        ?       19           
=======================================
  Hits            ?       24           
  Misses          ?        8           
  Partials        ?        1           
Flag Coverage Δ
Linux 37.03% <0.00%> (?)
Windows 74.07% <0.00%> (?)
macOS 38.46% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54e8dbf...31a9474. Read the comment docs.

.github/workflows/template-janitor.yml Outdated Show resolved Hide resolved
@lefticus
Copy link
Member

This is amazing. I just left one small suggestion for catching some of the C++ things and I'm also wondering if you think we can do anything with this?

https://github.com/cpp-best-practices/cpp_boilerplate_project/blob/main/CMakeLists.txt#L38-L39

I think HOMEPAGE_URL should be relatively easy to take care of. Description, I'm concerned about newlines or something else breaking CMake.

@LtdSauce
Copy link
Contributor Author

LtdSauce commented Mar 1, 2022

I agree.
I would try to cut off the description on the first newline and treat it as a short_description and pass that to cmake.

@lefticus i wonder if it would be a good idea to run cmake configure before commiting the changes inside the workflow? That makes it more complex but would catch any problems the replace introduces to the cmake files

@lefticus
Copy link
Member

lefticus commented Mar 1, 2022

I agree. I would try to cut off the description on the first newline and treat it as a short_description and pass that to cmake.

@lefticus i wonder if it would be a good idea to run cmake configure before commiting the changes inside the workflow? That makes it more complex but would catch any problems the replace introduces to the cmake files

I think that would make sense. Just need to make sure cmake and conan are installed.

And on that note - has anyone else noticed that docopt conan just stopped working on Windows CI? All of my builds with it are broken. I'm going to have to look into that. Maybe move away from docopt entirely here.

@lefticus
Copy link
Member

lefticus commented Mar 2, 2022

@LtdSauce I think it would be safe to auto-fill the description inside of CMake, because it doesn't seem to be possible to create a multi-line description when using the template project

Co-authored-by: Jason Turner <jason@emptycrate.com>
@lefticus lefticus changed the base branch from main to develop March 5, 2022 16:17
@lefticus lefticus merged commit 50a6861 into cpp-best-practices:develop Mar 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants