Merge branch 'typing-junit' into dev and adjusted documentation.

This commit is contained in:
Patrick Lehmann
2022-11-05 23:15:37 +01:00
6 changed files with 85 additions and 33 deletions

View File

@@ -127,9 +127,12 @@ jobs:
- name: Collect coverage - name: Collect coverage
continue-on-error: true continue-on-error: true
run: | run: |
RELDIR="$(realpath --relative-to=${{ inputs.tests_directory }} .)"
echo "relative: ${RELDIR}"
cd ${{ inputs.tests_directory }} cd ${{ inputs.tests_directory }}
[ 'x${{ inputs.coverage_config }}' != 'x' ] && PYCOV_ARGS='--cov-config=../${{ inputs.coverage_config }}' || unset PYCOV_ARGS [ 'x${{ inputs.coverage_config }}' != 'x' ] && PYCOV_ARGS="--cov-config=${RELDIR}/${{ inputs.coverage_config }}" || unset PYCOV_ARGS
python -m pytest -rA --cov=. $PYCOV_ARGS ${{ inputs.unittest_directory }} --color=yes echo "python -m pytest -rA --cov=${RELDIR} ${PYCOV_ARGS} ${{ inputs.unittest_directory }} --color=yes"
python -m pytest -rA --cov=${RELDIR} $PYCOV_ARGS ${{ inputs.unittest_directory }} --color=yes
- name: Convert to cobertura format - name: Convert to cobertura format
run: coverage xml --data-file=${{ inputs.tests_directory }}/.coverage run: coverage xml --data-file=${{ inputs.tests_directory }}/.coverage

View File

@@ -28,7 +28,7 @@ on:
python_version: python_version:
description: 'Python version.' description: 'Python version.'
required: false required: false
default: '3.10' default: '3.11'
type: string type: string
requirements: requirements:
description: 'Python dependencies to be installed through pip.' description: 'Python dependencies to be installed through pip.'

View File

@@ -35,19 +35,29 @@ on:
required: false required: false
default: '-r tests/requirements.txt' default: '-r tests/requirements.txt'
type: string type: string
report:
description: 'Directory to upload as an artifact.'
required: false
default: 'htmlmypy'
type: string
commands: commands:
description: 'Commands to run the static type checks.' description: 'Commands to run the static type checks.'
required: true required: true
type: string type: string
artifact: html_report:
description: 'Directory to upload as an artifact.'
required: false
default: 'htmlmypy'
type: string
junit_report:
description: 'junit file to upload as an artifact.'
required: false
default: 'StaticTypingSummary.xml'
type: string
html_artifact:
description: 'Name of the typing artifact.' description: 'Name of the typing artifact.'
required: true required: true
type: string type: string
junit_artifact:
description: 'Name of the typing artifact.'
required: false
default: ''
type: string
jobs: jobs:
@@ -71,12 +81,22 @@ jobs:
continue-on-error: true continue-on-error: true
run: ${{ inputs.commands }} run: ${{ inputs.commands }}
- name: 📤 Upload 'Static Typing Report' artifact - name: 📤 Upload 'Static Typing Report' HTML artifact
if: ${{ inputs.artifact != '' }} if: ${{ inputs.html_artifact != '' }}
continue-on-error: true continue-on-error: true
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{ inputs.artifact }} name: ${{ inputs.html_artifact }}
path: ${{ inputs.report }} path: ${{ inputs.html_report }}
if-no-files-found: error
retention-days: 1
- name: 📤 Upload 'Static Typing Report' JUnit artifact
if: ${{ inputs.junit_artifact != '' }}
continue-on-error: true
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.junit_artifact }}
path: ${{ inputs.junit_report }}
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 1

View File

@@ -28,7 +28,7 @@ on:
python_version: python_version:
description: 'Python version.' description: 'Python version.'
required: false required: false
default: '3.10' default: '3.11'
type: string type: string
jobs: jobs:

View File

@@ -75,18 +75,22 @@ jobs:
needs: needs:
- Params - Params
with: with:
commands: mypy --html-report htmlmypy -p ToolName commands: |
artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.typing }} mypy --junit-xml StaticTypingSummary.xml --html-report htmlmypy -p ToolName
html_artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.typing_html }}
junit_artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.typing_junit }}
# Optional # Optional
python_version: ${{ fromJson(needs.Params.outputs.params).python_version }} python_version: ${{ fromJson(needs.Params.outputs.params).python_version }}
requirements: '-r tests/requirements.txt' requirements: '-r tests/requirements.txt'
report: 'htmlmypy' html_report: 'htmlmypy'
junit_report: 'StaticTypingSummary.xml'
allow_failure: true allow_failure: true
PublishTestResults: PublishTestResults:
uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@main uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@main
needs: needs:
- UnitTesting - UnitTesting
- StaticTypeCheck
with: with:
# Optional # Optional
report_files: artifacts/**/*.xml report_files: artifacts/**/*.xml
@@ -178,5 +182,6 @@ jobs:
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.9 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.9
${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.10 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.10
${{ fromJson(needs.Params.outputs.params).artifacts.coverage }} ${{ fromJson(needs.Params.outputs.params).artifacts.coverage }}
${{ fromJson(needs.Params.outputs.params).artifacts.typing }} ${{ fromJson(needs.Params.outputs.params).artifacts.typing_html }}
${{ fromJson(needs.Params.outputs.params).artifacts.typing_junit }}
${{ fromJson(needs.Params.outputs.params).artifacts.doc }} ${{ fromJson(needs.Params.outputs.params).artifacts.doc }}

View File

@@ -110,18 +110,6 @@ requirements
Python dependencies to be installed through pip. Python dependencies to be installed through pip.
report
======
+----------------+----------+----------+-----------------+
| Parameter Name | Required | Type | Default |
+================+==========+==========+=================+
| report | optional | string | ``htmlmypy`` |
+----------------+----------+----------+-----------------+
Directory to upload as an artifact.
commands commands
======== ========
@@ -134,13 +122,49 @@ commands
Commands to run the static type checks. Commands to run the static type checks.
artifact html_report
======== ===========
+----------------+----------+----------+-----------------+
| Parameter Name | Required | Type | Default |
+================+==========+==========+=================+
| report | optional | string | ``htmlmypy`` |
+----------------+----------+----------+-----------------+
HTML output directory to upload as an artifact.
junit_report
============
+----------------+----------+----------+-----------------------------+
| Parameter Name | Required | Type | Default |
+================+==========+==========+=============================+
| report | optional | string | ``StaticTypingSummary.xml`` |
+----------------+----------+----------+-----------------------------+
junit file to upload as an artifact.
html_artifact
=============
+----------------+----------+----------+--------------+ +----------------+----------+----------+--------------+
| Parameter Name | Required | Type | Default | | Parameter Name | Required | Type | Default |
+================+==========+==========+==============+ +================+==========+==========+==============+
| artifact | yes | string | — — — — | | html_artifact | yes | string | — — — — |
+----------------+----------+----------+--------------+
Name of the typing artifact.
junit_artifact
==============
+----------------+----------+----------+--------------+
| Parameter Name | Required | Type | Default |
+================+==========+==========+==============+
| junit_artifact | optional | string | ``""`` |
+----------------+----------+----------+--------------+ +----------------+----------+----------+--------------+
Name of the typing artifact. Name of the typing artifact.