Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
Added functionality for generated projects to optionally sign binaries (
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrownell committed Jun 5, 2024
2 parents 5e6d065 + 2d2cb24 commit 95e848b
Show file tree
Hide file tree
Showing 8 changed files with 250 additions and 164 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
# ----------------------------------------------------------------------
action_contexts:
name: "Display GitHub Action Contexts"
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_display_action_contexts.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_display_action_contexts.yaml@CI-v0.18.0

# ----------------------------------------------------------------------
validate:
Expand All @@ -45,7 +45,7 @@ jobs:

name: Validate

uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python.yaml@CI-v0.18.0
with:
operating_system: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
Expand All @@ -56,7 +56,7 @@ jobs:

name: Postprocess Coverage Info

uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_package_python_coverage.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_package_python_coverage.yaml@CI-v0.18.0
with:
gist_id: 2f9d770d13e3a148424f374f74d41f4b
gist_filename: PythonProjectBootstrapper_coverage.json
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:

name: Create Package

uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_package.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_package.yaml@CI-v0.18.0
with:
operating_system: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
Expand All @@ -112,7 +112,7 @@ jobs:

name: Validate Package

uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_package.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_package.yaml@CI-v0.18.0
with:
operating_system: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
Expand All @@ -136,7 +136,7 @@ jobs:

name: Create Binary

uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_binary.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_create_python_binary.yaml@CI-v0.18.0
with:
operating_system: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
Expand All @@ -159,7 +159,7 @@ jobs:

name: Validate Binary

uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_binary.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_validate_python_binary.yaml@CI-v0.18.0
with:
operating_system: ${{ matrix.os }}
python_version: ${{ matrix.python_version }}
Expand All @@ -173,7 +173,7 @@ jobs:

name: Publish

uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_publish_python.yaml@CI-v0.17.0
uses: davidbrownell/dbrownell_DevTools/.github/workflows/callable_publish_python.yaml@CI-v0.18.0
with:
release_sources_configuration_filename: .github/release_sources.yaml
secrets:
Expand Down
2 changes: 1 addition & 1 deletion Build.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def list_commands(self, *args, **kwargs): # pylint: disable=unused-argument
Black = RepoBuildTools.BlackFuncFactory(
this_dir,
app,
'--force-exclude "{{ cookiecutter.__empty_dir }}"',
'--force-exclude "{{ cookiecutter.__empty_dir }}|src/PythonProjectBootstrapper/package/hooks"',
)

Pylint = RepoBuildTools.PylintFuncFactory(
Expand Down
6 changes: 3 additions & 3 deletions src/PythonProjectBootstrapper/ProjectGenerationUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def DisplayModifications(modifications: CopyToOutputDirResult) -> None:


# ----------------------------------------------------------------------
def DisplayPrompt(output_dir: Path, prompts: dict[tuple[int, str], str]) -> None:
def DisplayPrompt(output_dir: Path, prompts: list[tuple[str, str]]) -> None:
"""
Display prompts/instructions after project generation
Expand All @@ -365,13 +365,13 @@ def DisplayPrompt(output_dir: Path, prompts: dict[tuple[int, str], str]) -> None

# ----------------------------------------------------------------------
# Print out saved prompts
for (prompt_index, title), prompt in sorted(prompts.items()):
for prompt_index, (title, prompt) in enumerate(prompts):
print(
Panel(
prompt.rstrip(),
border_style=next(border_colors),
padding=1,
title=f"[{prompt_index}/{len(prompts)}] {title}",
title=f"[{prompt_index + 1}/{len(prompts)}] {title}",
title_align="left",
),
)
Expand Down
2 changes: 2 additions & 0 deletions src/PythonProjectBootstrapper/package/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"gist_id": "<your gist id>",
"gist_username": "{{ cookiecutter.github_username }}",

"sign_binaries": true,
"create_docker_image": false,

"__empty_dir": "",
Expand All @@ -37,6 +38,7 @@
"pypi_project_name": "\n\nPlease enter the name of your project as it will appear on PyPI (https://pypi.org). This\nname cannot be associated with any other project on PyPI.\n\n",
"gist_id": "\n\nPlease enter the GitHub gist id for use with this project.\n\nGitHub defines a gist as \"a simple way to share snippets and pastes with others.\" The generated\npython project will use a gist to store information dynamically generated during the build (for\nexample code coverage information) that can be retrieved at a later time (for example, to display\na code coverage badge in the project's README.md file).\n\nTo create a gist:\n 1. Go to https://gist.github.com/\n 2. Enter the following values in their respective fields:\n\n Gist description...: Gist used by GitHub Action workflows to store and retrieve dynamic information (oftentimes used to create and display badges).\n Filename including extension...: README.md\n File contents: Gist used by GitHub Action workflows to store and retrieve dynamic information (oftentimes used to create and display badges).\n\n 3. Click the \"Create secret gist\" button\n 4. Copy the gist id (this will be the hex string at the end of the url associated with the gist\n that was just created). It will look something like:\n\n https://gist.github.com/<github username>/4c10281ff1abc26cafcb9a5f9a8a443e\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n This is the gist id\n\n",
"gist_username": "\n\nPlease enter the username associated with your gist_id. In most cases, this will be the same as your GitHub username.\n\n",
"sign_binaries": "\n\nWould you like the GitHub Action workflows to sign binaries produced by the project?\n\nA signed binary can be validated against its signature to ensure that changes have not been made\nto it after it was created. This is especially useful when distributing software to others and is\nhighly recommended.\n\n",
"create_docker_image": "\n\nWould you like the GitHub Action workflows to create docker images of the development environment?\nThese images can be used to produce exact results across different commits made to the repository\nover time (which is especially valuable when writing scientific software).\n\n"
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ gist_id: |-
gist_username: |-
Please enter the username associated with your gist_id. In most cases, this will be the same as your GitHub username.
sign_binaries: |-
Would you like the GitHub Action workflows to sign binaries produced by the project?
A signed binary can be validated against its signature to ensure that changes have not been made
to it after it was created. This is especially useful when distributing software to others and is
highly recommended.
create_docker_image: |-
Would you like the GitHub Action workflows to create docker images of the development environment?
These images can be used to produce exact results across different commits made to the repository
Expand Down
Loading

0 comments on commit 95e848b

Please sign in to comment.