Skip to content

Commit

Permalink
Parse pylint_options depending on newlines (#170)
Browse files Browse the repository at this point in the history
Clarify when single space-separated line is accepted

If it not accepted: Remove the mention of single line in the description
of the input, leaving only "multi-line". And always parse as if it is a
multi-line input.
If it is accepted: Update the parsing to check for newline characters
before actually parsing the input. Also add "(space-separated)" to
describe a multi-valued single-line input.

A new section "General information" has been added in the documentation
under the overview of the workflows.
A section about single vs multi-line values have been added, including
examples.
This section has then been referenced throughout the documentation for
specific input parameters that mention "single og multi-line values".
  • Loading branch information
CasperWA authored Aug 29, 2023
1 parent a056de7 commit 0e0df50
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 90 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/cd_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ on:
type: string
default: "3.9"
package_dirs:
description: "A single or multi-line string of paths to Python package directories relative to the repository directory to have its `__version__` value updated. Example: `'src/my_package'`. **Important**: This is _required_ if 'python_package' is 'true', which is the default."
description: "A multi-line string of paths to Python package directories relative to the repository directory to have its `__version__` value updated. Example: `'src/my_package'`. **Important**: This is _required_ if 'python_package' is 'true', which is the default."
required: false
type: string
default: ""
version_update_changes:
description: "A single or multi-line string of changes to be implemented in the repository files upon updating the version. The string should be made up of three parts: 'file path', 'pattern', and 'replacement string'. These are separated by the 'version_update_changes_separator' value. The 'file path' must _always_ either be relative to the repository root directory or absolute. The 'pattern' should be given as a 'raw' Python string."
description: "A multi-line string of changes to be implemented in the repository files upon updating the version. The string should be made up of three parts: 'file path', 'pattern', and 'replacement string'. These are separated by the 'version_update_changes_separator' value. The 'file path' must _always_ either be relative to the repository root directory or absolute. The 'pattern' should be given as a 'raw' Python string."
required: false
type: string
default: ""
Expand Down Expand Up @@ -339,10 +339,16 @@ jobs:
- name: Install system dependencies
if: inputs.system_dependencies != ''
run: |
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
if [[ "${{ inputs.system_dependencies }}" =~ \n ]]; then
# Expected to be a multi-line string
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
else
# Expected to be a single-line string
SYSTEM_PACKAGES=(${{ inputs.system_dependencies }})
fi
sudo apt update && sudo apt install -y "${SYSTEM_PACKAGES[@]}"
Expand All @@ -365,10 +371,16 @@ jobs:
REF=${{ github.ref }}
if [ "${{ inputs.docs_framework }}" == "sphinx" ]; then
SPHINX_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SPHINX_OPTIONS+=("${line}"); fi
done <<< "${{ inputs.sphinx-build_options }}"
if [[ "${{ inputs.sphinx-build_options }}" =~ \n ]]; then
# Expected to be a multi-line string
SPHINX_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SPHINX_OPTIONS+=("${line}"); fi
done <<< "${{ inputs.sphinx-build_options }}"
else
# Expected to be a single-line string
SPHINX_OPTIONS=(${{ inputs.sphinx-build_options }})
fi
fi
if [ "${{ inputs.test }}" == "true" ]; then
Expand Down
42 changes: 27 additions & 15 deletions .github/workflows/ci_cd_updated_default_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ on:
type: boolean
default: true
package_dirs:
description: "A single or multi-line string of paths to Python package directories relative to the repository directory to be considered for creating the Python API reference documentation. Example: `'src/my_package'`. **Important**: This is _required_ if 'update_docs' and 'update_python_api_ref' are 'true'."
description: "A multi-line string of paths to Python package directories relative to the repository directory to be considered for creating the Python API reference documentation. Example: `'src/my_package'`. **Important**: This is _required_ if 'update_docs' and 'update_python_api_ref' are 'true'."
required: false
type: string
default: ""
Expand All @@ -74,32 +74,32 @@ on:
type: boolean
default: false
exclude_dirs:
description: "A single or multi-line string of directories to exclude in the Python API reference documentation. Note, only directory names, not paths, may be included. Note, all folders and their contents with these names will be excluded. Defaults to `'__pycache__'`. Important: When a user value is set, the preset value is overwritten - hence `'__pycache__'` should be included in the user value if one wants to exclude these directories."
description: "A multi-line string of directories to exclude in the Python API reference documentation. Note, only directory names, not paths, may be included. Note, all folders and their contents with these names will be excluded. Defaults to `'__pycache__'`. Important: When a user value is set, the preset value is overwritten - hence `'__pycache__'` should be included in the user value if one wants to exclude these directories."
required: false
type: string
default: "__pycache__"
exclude_files:
description: "A single or multi-line string of files to exclude in the Python API reference documentation. Note, only full file names, not paths, may be included, i.e., filename + file extension. Note, all files with these names will be excluded. Defaults to `'__init__.py'`. Important: When a user value is set, the preset value is overwritten - hence `'__init__.py'` should be included in the user value if one wants to exclude these files."
description: "A multi-line string of files to exclude in the Python API reference documentation. Note, only full file names, not paths, may be included, i.e., filename + file extension. Note, all files with these names will be excluded. Defaults to `'__init__.py'`. Important: When a user value is set, the preset value is overwritten - hence `'__init__.py'` should be included in the user value if one wants to exclude these files."
required: false
type: string
default: "__init__.py"
full_docs_dirs:
description: "A single or multi-line string of directories in which to include everything - even those without documentation strings. This may be useful for a module full of data models or to ensure all class attributes are listed."
description: "A multi-line string of directories in which to include everything - even those without documentation strings. This may be useful for a module full of data models or to ensure all class attributes are listed."
required: false
type: string
default: ""
full_docs_files:
description: "A single or multi-line string of relative paths to files in which to include everything - even those without documentation strings. This may be useful for a file full of data models or to ensure all class attributes are listed."
description: "A multi-line string of relative paths to files in which to include everything - even those without documentation strings. This may be useful for a file full of data models or to ensure all class attributes are listed."
required: false
type: string
default: ""
special_file_api_ref_options:
description: "A single or multi-line string of combinations of a relative path to a Python file and a fully formed mkdocstrings option that should be added to the generated MarkDown file for the Python API reference documentation. Example: 'my_module/py_file.py,show_bases:false'. Encapsulate the value in double quotation marks (\") if including spaces ( ). Important: If multiple `package_dirs` are supplied, the relative path MUST include/start with the appropriate 'package_dir' value, e.g., '\"my_package/my_module/py_file.py,show_bases: false\"'."
description: "A multi-line string of combinations of a relative path to a Python file and a fully formed mkdocstrings option that should be added to the generated MarkDown file for the Python API reference documentation. Example: 'my_module/py_file.py,show_bases:false'. Encapsulate the value in double quotation marks (\") if including spaces ( ). Important: If multiple `package_dirs` are supplied, the relative path MUST include/start with the appropriate 'package_dir' value, e.g., '\"my_package/my_module/py_file.py,show_bases: false\"'."
required: false
type: string
default: ""
landing_page_replacements:
description: "A single or multi-line string of replacements (mappings) to be performed on README.md when creating the documentation's landing page (index.md). This list ALWAYS includes replacing `'docs/'` with an empty string to correct relative links, i.e., this cannot be overwritten. By default `'(LICENSE)'` is replaced by `'(LICENSE.md)'`."
description: "A multi-line string of replacements (mappings) to be performed on README.md when creating the documentation's landing page (index.md). This list ALWAYS includes replacing `'docs/'` with an empty string to correct relative links, i.e., this cannot be overwritten. By default `'(LICENSE)'` is replaced by `'(LICENSE.md)'`."
required: false
type: string
default: "(LICENSE),(LICENSE.md)"
Expand Down Expand Up @@ -201,10 +201,16 @@ jobs:
- name: Install system dependencies
if: env.RELEASE_RUN == 'false' && inputs.system_dependencies != ''
run: |
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
if [[ "${{ inputs.system_dependencies }}" =~ \n ]]; then
# Expected to be a multi-line string
SYSTEM_PACKAGES=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SYSTEM_PACKAGES+=("${line}"); fi
done <<< "${{ inputs.system_dependencies }}"
else
# Expected to be a single-line string
SYSTEM_PACKAGES=(${inputs.system_dependencies})
fi
sudo apt update && sudo apt install -y "${SYSTEM_PACKAGES[@]}"
Expand Down Expand Up @@ -357,10 +363,16 @@ jobs:
if: env.RELEASE_RUN == 'false' && ( ! inputs.test )
run: |
if [ "${{ inputs.docs_framework }}" == "sphinx" ]; then
SPHINX_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SPHINX_OPTIONS+=("${line}"); fi
done <<< "${{ inputs.sphinx-build_options }}"
if [[ "${{ inputs.sphinx-build_options }}" =~ \n ]]; then
# Expected to be a multi-line string
SPHINX_OPTIONS=()
while IFS= read -r line; do
if [ -n "${line}" ]; then SPHINX_OPTIONS+=("${line}"); fi
done <<< "${{ inputs.sphinx-build_options }}"
else
# Expected to be a single-line string
SPHINX_OPTIONS=(${{ inputs.sphinx-build_options }})
fi
fi
if [ "${{ inputs.test }}" == "true" ]; then
Expand Down
Loading

0 comments on commit 0e0df50

Please sign in to comment.