ExtractConfiguration
The ExtractConfiguration
job template extracts Python project settings from pyproject.toml
and shares the
values via output parameters with other jobs. Thus, only a single centralized implementation is needed to avoid code
duplications within jobs.
Instantiation
The following instantiation example creates a ConfigParams
job derived from job template ExtractConfiguration
version @r6
. It requires no special parameters to extract unit test (pytest) and code coverage (Coverage.py)
settings.
jobs:
ConfigParams:
uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6
UnitTesting:
uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@r6
needs:
- ConfigParams
with:
unittest_report_xml: ${{ needs.ConfigParams.outputs.unittest_report_xml }}
coverage_report_xml: ${{ needs.ConfigParams.outputs.coverage_report_xml }}
coverage_report_json: ${{ needs.ConfigParams.outputs.coverage_report_json }}
coverage_report_html: ${{ needs.ConfigParams.outputs.coverage_report_html }}
See also
- UnitTesting
UnitTesting
is usually- StaticTypeCheck
xxx
- CheckDocumentation
xxx
- InstallPackage (beta)
xxx
- PublishCoverageResults
xxx
- PublishTestResults
xxx
- SphinxDocumentation
xxx
Parameter Summary
Goto input parameters
Parameter Name |
Required |
Type |
Default |
---|---|---|---|
no |
string |
|
|
no |
string |
|
|
no |
string |
|
Goto secrets
This job template needs no secrets.
Goto output parameters
Result Name |
Type |
Description |
---|---|---|
string (JSON) |
||
string (JSON) |
||
string (JSON) |
||
string (JSON) |
||
string (JSON) |
||
string (JSON) |
||
string (JSON) |
||
string (JSON) |
Input Parameters
ubuntu_image_version
- Type:
string
- Required:
no
- Default Value:
'24.04'
- Possible Values:
See actions/runner-images - Available Images for available Ubuntu image versions.
- Description:
Version of the Ubuntu image used to run the job.
Note
Unfortunately, GitHub Actions has only a limited set of functions, thus, the usual Ubuntu image name like
'ubuntu-24.04'
can’t be split into image name and image version.
python_version
- Type:
string
- Required:
no
- Default Value:
'3.13'
- Possible Values:
Any valid Python version conforming to the pattern
<major>.<minor>
orpypy-<major>.<minor>
.
See actions/python-versions - available Python versions and actions/setup-python - configurable Python versions.- Description:
Python version used to run Python code in the job.
coverage_config
- Type:
string
- Required:
no
- Default Value:
'pyproject.toml'
- Possible Values:
Any valid path to a
pyproject.toml
file.
Alternatively, path to a.coveragerc
file (deprecated).- Description:
Path to a Python project configuration file for extraction of project settings.
- Example:
Extracted values from
pyproject.toml
[tool.coverage.xml] output = "report/coverage/coverage.xml" [tool.coverage.json] output = "report/coverage/coverage.json" [tool.coverage.html] directory = "report/coverage/html" title="Code Coverage of myPackage" [tool.mypy] html_report = "report/typing/html" junit_xml = "report/typing/StaticTypingSummary.xml" cobertura_xml_report = "report/typing" [tool.pyedaa-reports] junit_xml = "report/unit/unittest.xml" [tool.pytest] junit_xml = "report/unit/UnittestReportSummary.xml"
Secrets
This job template needs no secrets.
Outputs
unittest_report_xml
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory, the filename and the fullpath to the unit test’s report XML file created by pytest in JUnit XML format.
The JSON object contains these fields:
- directory:
Contains the directory where the unittest XML report file will be created.
Example:reports/unit
- filename:
Contains the filename of the unittest XML report file.
Example:UnittestReportSummary.xml
- fullpath:
Contains the path where the unittest XML report file will be created.
This is the concatenation of both previous JSON fields.
Example:reports/unit/UnittestReportSummary.xml
- pyproject.toml:
Matching
pyproject.toml
configuration for tool pytest.[tool.pytest] junit_xml = "report/unit/UnittestReportSummary.xml"
- Example:
{ "directory": "reports/unit", "filename": "UnittestReportSummary.xml", "fullpath": "reports/unit/UnittestReportSummary.xml" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.unittest_report_xml }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.unittest_report_xml).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.unittest_report_xml).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.unittest_report_xml).fullpath }}
unittest_merged_report_xml
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory, the filename and the fullpath to the merged unittest report file in JUnit XML format created by pyEDAA.Reports.
The JSON object contains these fields:
- directory:
Contains the directory where the merged unittest XML report file will be created.
Example:reports/unit
- filename:
Contains the filename of the merged unittest XML report file.
Example:unittest.xml
- fullpath:
Contains the path where the merged unittest XML report file will be created.
This is the concatenation of both previous JSON fields.
Example:reports/unit/unittest.xml
- pyproject.toml:
Matching
pyproject.toml
configuration for tool pyEDAA.Reports.[tool.pyedaa-reports] junit_xml = "report/unit/unittest.xml"
- Example:
{ "directory": "reports/unit", "filename": "unittest.xml", "fullpath": "reports/unit/unittest.xml" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.unittest_merged_report_xml }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.unittest_merged_report_xml).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.unittest_merged_report_xml).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.unittest_merged_report_xml).fullpath }}
coverage_report_html
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory and the full path, where the code coverage HTML report will be generated by Coverage.py.
The JSON object contains these fields:
- directory:
Contains the directory where the code coverage report in HTML format will be created.
Example:report/coverage/html
- fullpath:
Contains the path where the code coverage report in HTML format will be created.
This is the same as the previous JSON field.
Example:report/coverage/html
- pyproject.toml:
Matching
pyproject.toml
configuration for tool Coverage.py.[tool.coverage.html] directory = "report/coverage/html" title="Code Coverage of pyDummy"
- Example:
{ "directory": "report/coverage/html", "fullpath": "report/coverage/html" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.coverage_report_html }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.coverage_report_html).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.coverage_report_html).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.coverage_report_html).fullpath }}
coverage_report_xml
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory, the filename and the fullpath to the code coverage XML report file in Cobertura XML format created by Coverage.py.
The JSON object contains these fields:
- directory:
Contains the directory where the code coverage XML report file will be created.
Example:reports/unit
- filename:
Contains the filename of the code coverage XML report file.
Example:unittest.xml
- fullpath:
Contains the path where the code coverage XML report file will be created.
This is the concatenation of both previous JSON fields.
Example:reports/unit/unittest.xml
- pyproject.toml:
Matching
pyproject.toml
configuration for tool Coverage.py.[tool.coverage.xml] output = "report/coverage/coverage.xml"
- Example:
{ "directory": "reports/coverage", "filename": "coverage.xml", "fullpath": "reports/coverage/coverage.xml" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.coverage_report_xml }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.coverage_report_xml).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.coverage_report_xml).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.coverage_report_xml).fullpath }}
coverage_report_json
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory, the filename and the fullpath to the code coverage JSON report file created by Coverage.py.
The JSON object contains these fields:
- directory:
Contains the directory where the code coverage JSON report file will be created.
Example:reports/unit
- filename:
Contains the filename of the code coverage JSON report file.
Example:unittest.json
- fullpath:
Contains the path where the code coverage JSON report file will be created.
This is the concatenation of both previous JSON fields.
Example:reports/unit/unittest.json
- pyproject.toml:
Matching
pyproject.toml
configuration for tool Coverage.py.[tool.coverage.json] output = "report/coverage/coverage.json"
- Example:
{ "directory": "reports/coverage", "filename": "coverage.json", "fullpath": "reports/coverage/coverage.json" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.coverage_report_json }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.coverage_report_json).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.coverage_report_json).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.coverage_report_json).fullpath }}
typing_report_cobertura
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory, the filename and the fullpath to the static type checking report file in Cobertura format created by mypy.
The JSON object contains these fields:
- directory:
Contains the directory where the type checking XML report file will be created.
Example:reports/typing
- filename:
Contains the filename of the type checking XML report file.
Example:cobertura.xml
- fullpath:
Contains the path where the type checking XML report file will be created.
This is the concatenation of both previous JSON fields.
Example:reports/typing/cobertura.xml
- pyproject.toml:
Matching
pyproject.toml
configuration for tool mypy.[tool.mypy] cobertura_xml_report = "report/typing"
- Example:
{ "directory": "reports/typing", "filename": "cobertura.xml", "fullpath": "reports/typing/cobertura.xml" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.typing_report_cobertura }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.typing_report_cobertura).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.typing_report_cobertura).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.typing_report_cobertura).fullpath }}
typing_report_junit
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory, the filename and the fullpath to the static type checking report file in JUnit XML format created by mypy.
The JSON object contains these fields:
- directory:
Contains the directory where the static typing JUnit XML report file will be created.
Example:reports/typing
- filename:
Contains the filename of the static typing JUnit XML report file.
Example:StaticTypingSummary.xml
- fullpath:
Contains the path where the cstatic typing JUnit XML report file will be created.
This is the concatenation of both previous JSON fields.
Example:reports/typing/StaticTypingSummary.xml
- pyproject.toml:
Matching
pyproject.toml
configuration for tool mypy.[tool.mypy] junit_xml = "report/typing/StaticTypingSummary.xml"
- Example:
{ "directory": "reports/typing", "filename": "StaticTypingSummary.xml", "fullpath": "reports/typing/StaticTypingSummary.xml" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.typing_report_junit }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.typing_report_junit).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.typing_report_junit).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.typing_report_junit).fullpath }}
typing_report_html
- Type:
string (JSON)
- Description:
Returns a string in JSON format containing the directory, the filename and the fullpath to the static type checking report in HTML format created by mypy.
The JSON object contains these fields:
- directory:
Contains the directory where the static typing HTML report will be created.
Example:reports/typing/html
- fullpath:
Contains the path where the static typing HTML report will be created.
This is the same as the previous JSON field.
Example:reports/typing/html
- pyproject.toml:
Matching
pyproject.toml
configuration for tool mypy.[tool.mypy] html_report = "report/typing/html"
- Example:
{ "directory": "reports/typing/html", "fullpath": "reports/typing/html" }
- Usage:
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: ${{ needs.ConfigParams.outputs.typing_report_html }}
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: report: >- { "dir": "${{ fromJson(needs.ConfigParams.outputs.typing_report_html).directory }}", "file": "${{ fromJson(needs.ConfigParams.outputs.typing_report_html).filename }}" }
ConfigParams: uses: pyTooling/Actions/.github/workflows/ExtractConfiguration.yml@r6 OtherJob: uses: some/path/to/a/template@r6 needs: - ConfigParams with: fullpath: ${{ fromJson(needs.ConfigParams.outputs.typing_report_html).fullpath }}
Optimizations
This template offers no optimizations (reduced job runtime).