Skip to content

Commit 09b802e

Browse files
authored
Merge pull request #11 from ferreteleco/feature/upgrades
Feature/upgrades
2 parents ea78a0c + 0a382ee commit 09b802e

File tree

7 files changed

+59
-18
lines changed

7 files changed

+59
-18
lines changed

.github/ISSUE_TEMPLATE/feature_request.yaml renamed to .github/ISSUE_TEMPLATE/task.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ body:
66
attributes:
77
value: |
88
Please be sure to include as much details and indications as possible (and applicable)!
9+
- type: dropdown
10+
id: task-type
11+
attributes:
12+
label: What type of Task are you filling?
13+
multiple: false
14+
options:
15+
- New Feature
16+
- Maintenance
17+
- Improvement
18+
- Idea
19+
- Other
20+
validations:
21+
required: true
922
- type: textarea
10-
id: Suggestion
23+
id: summary
1124
attributes:
12-
label: Suggestion / Feature
13-
description: Describe the task to be carried out.
25+
label: Description
26+
description: Describe what do you have in your mind.
1427
placeholder: Implement a new awesome feature that makes coffee! or Add some tests!
1528
validations:
1629
required: true

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This repository can be used for adding Github Actions and templates to an existi
44

55
## Version
66

7-
Current version is 1.1.0 and was set according to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
Current version is 1.2.0 and was set according to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

99
Project's version should be updated, when applicable:
1010

@@ -44,12 +44,14 @@ you will be prompted to fill in the following values:
4444
folder.
4545
- **add_PR_template:** this flags controls wether or not to add a PR template in the generated
4646
folder.
47+
- **project_language:** This variable choice serves to select the main project language, and it is
48+
aligned with the actions that will be later opt to be created.
4749
- **add_ci_action_unit_tests_runner:** this variable controls whether or not to create an action to
48-
run unit tests in the repository. The available choices are:
49-
- none (no action created).
50+
run unit tests in the repository. The available actions (per project_language variable) are:
5051
- cpp, which creates an action for Catch2 based unit tests, built using CMake.
51-
- python, which creates an action for Python code unit tests, executed with pytest over a
52+
- python, which creates an action for Python code unit tests, executed with pytest over a
5253
project built with Poetry.
54+
- other, which does not generate any action.
5355

5456
## Contributing
5557

cookiecutter.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
true,
88
false
99
],
10-
"add_ci_action_unit_tests_runner": [
11-
"none",
10+
"project_language": [
1211
"cpp",
13-
"python"
12+
"python",
13+
"other"
14+
],
15+
"add_ci_action_unit_tests_runner": [
16+
true,
17+
false
1418
],
1519
"__github_folder": ".github"
1620
}

hooks/post_gen_project.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44
from pathlib import Path
5-
from shutil import rmtree, copy, copytree
5+
from shutil import rmtree, copytree
66

77

88
def change_line_endings_crlf_to_lf():
@@ -29,22 +29,22 @@ def remove_unwanted_templates():
2929
def add_ci_action_unit_tests_runner():
3030
"""Adds a CI action for running unit tests, if applicable"""
3131

32-
target_ci_tests_action = "{{cookiecutter.add_ci_action_unit_tests_runner}}"
32+
target_language = "{{cookiecutter.project_language}}"
3333

34-
if target_ci_tests_action.lower() != "none":
34+
if {{cookiecutter.add_ci_action_unit_tests_runner}} and target_language.lower() != "other":
3535

3636
LOG.info("Adding action for running unit tests (workflows folder) with default config...")
3737

3838
destination = Path("workflows")
39-
ci_test_workflow_files_path = Path("_", "workflows", target_ci_tests_action)
39+
ci_test_workflow_files_path = Path("_", "workflows", target_language)
4040
copytree(ci_test_workflow_files_path, destination)
4141

4242
print("\n\n#################################################################")
4343
print("# Please check gen. checklist in order to adjust CI UT basic action #")
4444
print("#################################################################\n\n")
4545

4646
else:
47-
LOG.info("Skipping CI action for running unit tests file generation (%s selected) ...", target_ci_tests_action)
47+
LOG.info("Skipping CI action for running unit tests file generation (%s language selected) ...", target_language)
4848

4949

5050
def clean():

{{ cookiecutter.__github_folder }}/ISSUE_TEMPLATE/feature_request.yaml renamed to {{ cookiecutter.__github_folder }}/ISSUE_TEMPLATE/task.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ body:
66
attributes:
77
value: |
88
Please be sure to include as much details and indications as possible (and applicable)!
9+
- type: dropdown
10+
id: task-type
11+
attributes:
12+
label: What type of Task are you filling?
13+
multiple: false
14+
options:
15+
- New Feature
16+
- Maintenance
17+
- Improvement
18+
- Idea
19+
- Other
20+
validations:
21+
required: true
922
- type: textarea
10-
id: Suggestion
23+
id: summary
1124
attributes:
12-
label: Suggestion / Feature
13-
description: Describe the task to be carried out.
25+
label: Description
26+
description: Describe what do you have in your mind.
1427
placeholder: Implement a new awesome feature that makes coffee! or Add some tests!
1528
validations:
1629
required: true

{{ cookiecutter.__github_folder }}/_/workflows/cpp/cpp-unit-test-action-checklist.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ it to the remote repository.
1212
(defaults to *ubuntu-22.04*, hosted by GH).
1313
- [ ] The credentials for acquiring the Docker image(if needed) have been configured via secrets
1414
and required section in action file uncommented.
15+
16+
In GitHub's repository settings >> Branches >> Branch protection rules >> Enable 'Require status
17+
checks to pass before merging'.

{{ cookiecutter.__github_folder }}/_/workflows/python/python-unit-test-action-checklist.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ it to the remote repository.
1010
- [ ] The target test directory where tests live has been defined (defaults to *tests*).
1111
- [ ] The target runner(s) in which to run the CI Unit Testing workflow have been configured
1212
(defaults to *ubuntu-22.04*, hosted by GH).
13+
14+
Note that, for a PR to be blocked if Unit Testing action fails, status checks must be enabled on the
15+
target branch.
16+
17+
In GitHub's repository settings >> Branches >> Branch protection rules >> Enable 'Require status
18+
checks to pass before merging'.

0 commit comments

Comments
 (0)