-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] v1.10.0 Policy-based CI/CD Pipeline
Cookiecutter Python Package v1.10.0 Release. In this Release, we enhance the CI/CD Pipeline configuration (file) produced out-of-the-box by the Generator, with Policy-based configurable Jobs: Docker, Docs, Code Vizualization (along with already-supporting-policies Lint Job).
- Loading branch information
Showing
78 changed files
with
5,924 additions
and
880 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
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 |
---|---|---|
|
@@ -10,7 +10,7 @@ build-backend = "poetry.core.masonry.api" | |
## Also renders on pypi as 'subtitle' | ||
[tool.poetry] | ||
name = "cookiecutter_python" | ||
version = "1.9.0" | ||
version = "1.10.0" | ||
description = "Yet another modern Python Package (pypi) with emphasis in CI/CD and automation." | ||
authors = ["Konstantinos Lampridis <[email protected]>"] | ||
maintainers = ["Konstantinos Lampridis <[email protected]>"] | ||
|
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,3 +1,3 @@ | ||
__version__ = '1.9.0' | ||
__version__ = '1.10.0' | ||
|
||
from . import _logging # noqa |
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
123 changes: 123 additions & 0 deletions
123
src/cookiecutter_python/{{ cookiecutter.project_slug }}/.github/workflows/policy_docs.yml
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,123 @@ | ||
################################# | ||
## DOCS STATIC SITE Build/Test ## | ||
## Reusable Workflow ## | ||
################################# | ||
|
||
### TOOLS ### | ||
# - mkdocs | ||
# - sphinx | ||
|
||
## AUTONOMOUS JOB ## | ||
|
||
# 0. Never run | ||
# 1. Always run | ||
# 2. Run Docs on conditions | ||
# - Triggered on a Long-living branch (ie main) | ||
# - Triggered on a v* tag (ie v1.0.0) | ||
# - Docs Source Files (ie docs/) changed, compared to previous commit | ||
# 3. Run Docs, if Source Files changed, compared to previous commit | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
# Defaults to Policy 2 (CI/CD) | ||
run_policy: | ||
required: false | ||
type: string | ||
default: '2' | ||
dedicated_branches: | ||
required: false | ||
type: string | ||
default: 'main, master dev' | ||
source_code_targets: | ||
required: false | ||
type: string | ||
description: 'Comma separated list of folders to watch for changes' | ||
default: 'docs/' | ||
## Parametrizing Runtime Environment (ie py version) | ||
python_version: | ||
required: false | ||
type: string | ||
default: '3.10' | ||
|
||
jobs: | ||
docs_policy: | ||
name: "Run Docs Workflow/Job?" | ||
runs-on: ubuntu-latest | ||
if: always() && inputs.run_policy != 0 | ||
steps: | ||
- if: ${{ "{{" }} !contains('1, 2, 3', inputs.run_policy) {{ "}}" }} | ||
run: 'echo "Invalid run_policy: ${{ "{{" }} inputs.run_policy {{ "}}" }}. Must be >0 and <4" && exit 1' | ||
|
||
- if: inputs.run_policy == 1 | ||
name: 'POLICY: 1 -> Trigger' | ||
run: echo "SHOULD_RUN_DOCS=true" >> $GITHUB_ENV | ||
|
||
- if: inputs.run_policy == 2 && contains(inputs.dedicated_branches, github.ref_name) | ||
name: 'POLICY: 2 & Branch: ${{ "{{" }} github.ref_name {{ "}}" }} -> Trigger' | ||
run: echo "SHOULD_RUN_DOCS=true" >> $GITHUB_ENV | ||
|
||
- if: inputs.run_policy == 2 && startsWith(github.ref, 'refs/tags/v') | ||
name: 'POLICY: 2 & Tag: ${{ "{{" }} github.ref_name {{ "}}" }} -> Trigger' | ||
run: echo "SHOULD_RUN_DOCS=true" >> $GITHUB_ENV | ||
|
||
- if: ${{ "{{" }} env.SHOULD_RUN_DOCS != 'true' && contains('2, 3', inputs.run_policy) {{ "}}" }} | ||
name: 'POLICY: 2, 3 -> Derive from DIFF' | ||
run: echo "SHOULD_DERIVE_FROM_DIFF=true" >> $GITHUB_ENV | ||
|
||
- if: ${{ "{{" }} env.SHOULD_DERIVE_FROM_DIFF {{ "}}" }} | ||
name: 'POLICY: 2, 3 -> Checkout Code to compute DIFF' | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- if: ${{ "{{" }} env.SHOULD_DERIVE_FROM_DIFF {{ "}}" }} | ||
name: 'POLICY: 2, 3 -> Check Docs Source Files DIFF' | ||
run: | | ||
echo "============ List Modified Files ============" | ||
git diff --name-only HEAD^ HEAD | ||
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD) | ||
# Read Folders we 'Watch' for changes | ||
TARGETS=$(echo "${{ "{{" }} inputs.source_code_targets {{ "}}" }}" | tr ',' '\n') | ||
# Loop through the Watched Folders | ||
for TARGET in $TARGETS; do | ||
# if rel path of changed file matches glob pattern | ||
if [[ $CHANGED_FILES == *"$TARGET"* ]]; then | ||
echo "SHOULD_RUN_DOCS=true" >> $GITHUB_ENV | ||
echo " --> DOCS Change, from previous commit, found: $TARGET" | ||
break | ||
fi | ||
done | ||
### OUTPUT of JOB ### | ||
- name: "Set 'Run Docs' Signal to ${{ "{{" }} env.SHOULD_RUN_DOCS {{ "}}" }}" | ||
id: set_docs_signal | ||
run: echo "RUN_DOCS=${{ "{{" }} env.SHOULD_RUN_DOCS {{ "}}" }}" >> $GITHUB_OUTPUT | ||
outputs: | ||
RUN_DOCS: ${{ "{{" }} steps.set_docs_signal.outputs.RUN_DOCS {{ "}}" }} | ||
|
||
docs: | ||
name: "Docs: Build & Test" | ||
runs-on: ubuntu-latest | ||
needs: docs_policy | ||
if: always() && needs.docs_policy.outputs.RUN_DOCS == 'true' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ "{{" }} inputs.python_version {{ "}}" }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ "{{" }} inputs.python_version {{ "}}" }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install tox==3.28 | ||
- name: Install documentation test dependencies | ||
if: ${{ "{{" }} matrix.platform == 'macos-latest' && matrix.python-version != '3.6' {{ "}}" }} | ||
run: brew install enchant | ||
|
||
- name: Run Documentation Tests | ||
if: ${{ "{{" }} matrix.platform == 'ubuntu-latest' || matrix.python-version != '3.6' {{ "}}" }} | ||
run: tox -e docs --sitepackages -vv -s false |
Oops, something went wrong.