Skip to content

Commit b1b55a6

Browse files
committed
Update cookiecutter templates
1 parent aa7b27b commit b1b55a6

File tree

7 files changed

+49
-5
lines changed

7 files changed

+49
-5
lines changed

cookiecutter/apply_templates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@click.option("--bootstrap/--no-bootstrap")
1616
@click.option("--force/--no-force")
1717
@click.command()
18-
def main(bootstrap: bool, force: bool):
18+
def main(bootstrap: bool, force: bool) -> None:
1919
cutter_path = Path(__file__).parent
2020

2121
if bootstrap:

cookiecutter/ci/cookiecutter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"binary_dependencies": "",
88
"current_version": "0.0.1.dev",
99
"test_matrix": null,
10+
"unittests": false,
1011
"__app_label_suffix": "{{ cookiecutter.app_label and '-' + cookiecutter.app_label }}",
1112
"__project_name": "pulp-cli{{ cookiecutter.__app_label_suffix }}",
1213
"repository": "https://github.com/pulp/{{ cookiecutter.__project_name }}",

cookiecutter/ci/{{ cookiecutter.__project_name }}/.github/workflows/test.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,33 @@ env:
1111
CONTAINER_RUNTIME: "docker"
1212

1313
jobs:
14+
{%- if cookiecutter.unittests %}
15+
unittest:
16+
runs-on: "ubuntu-20.04"
17+
steps:
18+
- uses: "actions/checkout@v4"
19+
{%- include "cache_action" %}
20+
- name: "Download wheels"
21+
uses: "actions/download-artifact@v4"
22+
with:
23+
name: "pulp_cli_packages"
24+
- name: "Set up Python"
25+
uses: "actions/setup-python@v5"
26+
with:
27+
python-version: "3.12"
28+
- name: "Install Python Test Dependencies"
29+
run: |
30+
pip install dist/pulp_cli{{ cookiecutter.__app_label_suffix | replace("-", "_") }}-*.whl {%- if cookiecutter.glue %} pulp-glue{{ cookiecutter.__app_label_suffix }}/dist/pulp_glue{{ cookiecutter.__app_label_suffix | replace("-", "_") }}-*.whl {%- endif %} -r test_requirements.txt
31+
- name: "Run tests"
32+
run: |
33+
make unittest
34+
{%- endif %}
1435
test:
1536
runs-on: "ubuntu-20.04"
37+
{%- if cookiecutter.unittests %}
38+
needs:
39+
- "unittest"
40+
{%- endif %}
1641
strategy:
1742
fail-fast: false
1843
matrix:{{ cookiecutter.test_matrix | jaml(level=4, embed_in="dict") }}
@@ -26,7 +51,9 @@ jobs:
2651
- name: "Set up Python"
2752
uses: "actions/setup-python@v5"
2853
with:
29-
python-version: "{{ "${{ matrix.python }}" }}"
54+
{%- raw %}
55+
python-version: "${{ matrix.python }}"
56+
{%- endraw %}
3057
allow-prereleases: true
3158
{%- if cookiecutter.binary_dependencies %}
3259
- name: "Install Binary Test Dependencies"
@@ -57,5 +84,5 @@ jobs:
5784
PULP_API_ROOT: "${{ matrix.pulp_api_root }}"
5885
{%- endraw %}
5986
run: |
60-
.ci/run_container.sh make test
87+
.ci/run_container.sh make {% if cookiecutter.unittests %}live{% endif %}test
6188
...

cookiecutter/ci/{{ cookiecutter.__project_name }}/Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ build:
2020
{%- endif %}
2121
pyproject-build -n
2222

23-
black:
23+
black: format
24+
25+
format:
2426
isort .
2527
{%- if cookiecutter.glue %}
2628
cd pulp-glue{{ cookiecutter.__app_label_suffix }}; isort .
@@ -51,6 +53,18 @@ tests/cli.toml:
5153
test: | tests/cli.toml
5254
python3 -m pytest -v tests {%- if cookiecutter.glue %} pulp-glue{{ cookiecutter.__app_label_suffix }}/tests {%- endif %}
5355
{%- if cookiecutter.__app_label_suffix == "" %} cookiecutter/pulp_filter_extension.py {%- endif %}
56+
57+
livetest: | tests/cli.toml
58+
python3 -m pytest -v tests {%- if cookiecutter.glue %} pulp-glue{{ cookiecutter.__app_label_suffix }}/tests {%- endif %} -m live
59+
60+
unittest:
61+
python3 -m pytest -v tests {%- if cookiecutter.glue %} pulp-glue{{ cookiecutter.__app_label_suffix }}/tests {%- endif %}
62+
{%- if cookiecutter.__app_label_suffix == "" %} cookiecutter/pulp_filter_extension.py {%- endif %} -m "not live"
63+
{%- if cookiecutter.glue %}
64+
65+
unittest_glue:
66+
python3 -m pytest -v pulp-glue{{ cookiecutter.__app_label_suffix }}/tests -m "not live"
67+
{%- endif %}
5468
{%- if cookiecutter.docs %}
5569

5670
docs:

cookiecutter/ci/{{ cookiecutter.__project_name }}/lint_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ black==24.10.0
33
flake8==7.1.1
44
flake8-pyproject==1.2.3
55
isort==5.13.2
6-
mypy==1.11.2
6+
mypy==1.13.0
77
shellcheck-py==0.10.0.1
88

99
# Type annotation stubs

cookiecutter/ci/{{ cookiecutter.__project_name }}/pyproject.toml.update

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ docs = {{ cookiecutter.docs | toml_value }}
2222
translations = {{ cookiecutter.translations | toml_value }}
2323
main_package = {{ cookiecutter.main_package | toml_value }}
2424
binary_dependencies = {{ cookiecutter.binary_dependencies | toml_value }}
25+
unittests = {{ cookiecutter.unittests | toml_value }}
2526

2627
[tool.bumpversion]
2728
# This section is managed by the cookiecutter templates.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ docs = true
7777
translations = true
7878
main_package = "common"
7979
binary_dependencies = ""
80+
unittests = true
8081

8182
[tool.bumpversion]
8283
# This section is managed by the cookiecutter templates.

0 commit comments

Comments
 (0)