-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Add cookiecutter templates for CI
This should help to keep the CI consistent across multiple cli plugin repositories. [noissue]
- Loading branch information
Showing
39 changed files
with
1,234 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
import toml | ||
from cookiecutter.main import cookiecutter | ||
|
||
if __name__ == "__main__": | ||
sections = ["ci"] | ||
|
||
if len(sys.argv) == 2: | ||
config = { | ||
"app_label": sys.argv[1], | ||
"glue": True, | ||
"docs": False, | ||
"translations": False, | ||
} | ||
sections.insert(0, "bootstrap") | ||
else: | ||
with open("pyproject.toml") as fp: | ||
config = toml.load(fp)["tool"]["pulp_cli_template"] | ||
|
||
if config["docs"]: | ||
sections.append("docs") | ||
|
||
print(sections) | ||
exit | ||
|
||
cutter_path = Path(__file__).parent.parent.parent / "cookiecutter" | ||
|
||
for section in sections: | ||
print(f"Apply {section} template") | ||
cookiecutter( | ||
str(cutter_path / section), | ||
no_input=True, | ||
extra_context=config, | ||
overwrite_if_exists=True, | ||
output_dir="..", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
name: Collect changes | ||
name: "Collect changes" | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
collect-changes: | ||
runs-on: ubuntu-latest | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: "actions/checkout@v4" | ||
with: | ||
ref: "main" | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v5 | ||
- uses: "actions/setup-python@v5" | ||
with: | ||
python-version: "3.11" | ||
- name: Setup git | ||
- name: "Setup git" | ||
run: | | ||
git config user.name pulpbot | ||
git config user.email [email protected] | ||
- name: Collect changes | ||
- name: "Collect changes" | ||
run: | | ||
pip install GitPython packaging toml | ||
python3 .ci/scripts/collect_changes.py | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
- name: "Create Pull Request" | ||
uses: "peter-evans/create-pull-request@v5" | ||
with: | ||
token: ${{ secrets.RELEASE_TOKEN }} | ||
token: "${{ secrets.RELEASE_TOKEN }}" | ||
title: "Update Changelog" | ||
body: "" | ||
branch: "update_changes" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"app_label": "noname", | ||
"glue": true, | ||
"docs": false, | ||
"translations": false, | ||
"test_matrix": "- python: \"3.11\"\nimage_tag: \"nightly\"\npulp_api_root: \"/relocated/djnd/\"\n- python: \"3.6\"\nimage_tag: \"latest\"\nlower_bounds: true", | ||
"__app_label_suffix": "{{ cookiecutter.app_label and '-' + cookiecutter.app_label }}", | ||
"__project_name": "pulp-cli{{ cookiecutter.__app_label_suffix }}", | ||
"__project_slug": "{{ cookiecutter.__project_name | lower | replace(' ', '_') }}", | ||
"_copy_without_render": [ | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
cookiecutter/bootstrap/{{ cookiecutter.__project_slug }}/CHANGES.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
[//]: # (You should *NOT* be adding new change log entries to this file, this) | ||
[//]: # (file is managed by towncrier. You *may* edit previous change logs to) | ||
[//]: # (fix problems like typo corrections or such.) | ||
[//]: # (To add a new change log entry, please see) | ||
[//]: # (https://docs.pulpproject.org/contributing/git.html#changelog-update) | ||
|
||
[//]: # (WARNING: Don't drop the towncrier directive!) | ||
|
||
[//]: # (towncrier release notes start) | ||
|
139 changes: 139 additions & 0 deletions
139
cookiecutter/bootstrap/{{ cookiecutter.__project_slug }}/pyproject.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "{{ cookiecutter.__project_slug }}" | ||
version = "0.0.1.dev" | ||
description = "Command line interface to talk to pulpcore's REST API. ({{ cookiecutter.app_label | capitalize }} plugin commands)" | ||
readme = "README.md" | ||
requires-python = ">=3.6" | ||
license = {text = "GPLv2+"} | ||
authors = [ | ||
{name = "Pulp Team", email = "[email protected]"}, | ||
] | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Console", | ||
"Intended Audience :: System Administrators", | ||
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Topic :: System :: Software Distribution", | ||
"Typing :: Typed", | ||
] | ||
dependencies = [ | ||
"pulp-cli>=0.23.1,<0.24.0.dev", | ||
"pulp-glue-{{ cookiecutter.app_label }}==0.0.1.dev", | ||
] | ||
|
||
[project.urls] | ||
repository = "https://github.com/pulp/{{ cookiecutter.__project_slug }}" | ||
changelog = "https://github.com/pulp/{{ cookiecutter.__project_slug }}/blob/main/CHANGES.md" | ||
|
||
[project.entry-points."pulp_cli.plugins"] | ||
{{ cookiecutter.app_label }} = "pulpcore.cli.{{ cookiecutter.app_label }}" | ||
|
||
[tool.setuptools.packages.find] | ||
where = ["."] | ||
include = ["pulpcore.cli.*"] | ||
namespaces = true | ||
|
||
[tool.setuptools.package-data] | ||
"*" = ["py.typed", "locale/*/LC_MESSAGES/*.mo"] | ||
|
||
[tool.pulp_cli_template] | ||
app_label = "{{ cookiecutter.app_label }}" | ||
glue = true | ||
docs = false | ||
translations = false | ||
test_matrix = """ | ||
- python: "3.11" | ||
image_tag: "nightly" | ||
pulp_api_root: "/relocated/djnd/" | ||
- python: "3.6" | ||
image_tag: "latest" | ||
lower_bounds: true | ||
""" | ||
|
||
[tool.towncrier] | ||
filename = "CHANGES.md" | ||
directory = "CHANGES/" | ||
title_format = "## {version} ({project_date})" | ||
template = "CHANGES/.TEMPLATE.md" | ||
issue_format = "[#{issue}](https://github.com/pulp/{{ cookiecutter.__project_slug }}/issues/{issue})" | ||
start_string = "[//]: # (towncrier release notes start)\n" | ||
underlines = ["", "", ""] | ||
|
||
[[tool.towncrier.section]] | ||
path = "" | ||
name = "" | ||
|
||
[[tool.towncrier.section]] | ||
path = "pulp-glue-{{ cookiecutter.app_label }}" | ||
name = "Pulp-{{ cookiecutter.app_label }} GLUE" | ||
|
||
[[tool.towncrier.type]] | ||
directory = "feature" | ||
name = "Features" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "bugfix" | ||
name = "Bugfixes" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "doc" | ||
name = "Improved Documentation" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "removal" | ||
name = "Deprecations and Removals" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "translation" | ||
name = "Translations" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "devel" | ||
name = "Developer Notes" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "misc" | ||
name = "Misc" | ||
showcontent = false | ||
|
||
[tool.black] | ||
target = "py36" | ||
line-length = 100 | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 100 | ||
skip = ["pulp-glue-{{ cookiecutter.app_label }}"] | ||
|
||
[tool.pytest.ini_options] | ||
markers = [ | ||
"script: tests provided as shell scripts", | ||
"help_page: tests that render help pages", | ||
"pulp_{{ cookiecutter.app_label }}: pulp_{{ cookiecutter.app_label }} tests", | ||
] | ||
|
||
[tool.mypy] | ||
strict = true | ||
show_error_codes = true | ||
files = "pulpcore/**/*.py" | ||
namespace_packages = true | ||
explicit_package_bases = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = [ | ||
"click_shell.*", | ||
"schema.*", | ||
] | ||
ignore_missing_imports = true |
Oops, something went wrong.