StaticTypeCheck: require the user to specify the mypy commands

This commit is contained in:
umarcor
2021-11-29 23:40:10 +01:00
parent 72278fee1d
commit 462e51253c
3 changed files with 9 additions and 12 deletions

View File

@@ -40,7 +40,6 @@ jobs:
run: | run: |
name = '${{ inputs.name }}' name = '${{ inputs.name }}'
params = { params = {
'name': name,
'python_version': '${{ inputs.python_version }}', 'python_version': '${{ inputs.python_version }}',
'artifacts': { 'artifacts': {
'unittesting': f'{name}-TestReport', 'unittesting': f'{name}-TestReport',

View File

@@ -13,13 +13,13 @@ on:
required: false required: false
default: '-r tests/requirements.txt' default: '-r tests/requirements.txt'
type: string type: string
html_report: report:
description: 'Directory for --html-report.' description: 'Directory to upload as an artifact.'
required: false required: false
default: 'htmlmypy' default: 'htmlmypy'
type: string type: string
mypy_args: commands:
description: 'Arguments to mypy, except the HTML report (see option html_report).' description: 'Commands to run the static type checks.'
required: true required: true
type: string type: string
artifact: artifact:
@@ -49,16 +49,14 @@ jobs:
- name: Check Static Typing - name: Check Static Typing
continue-on-error: true continue-on-error: true
run: | run: ${{ inputs.commands }}
[ 'x${{ inputs.html_report }}' != 'x' ] && MYPY_HTML='--html-report=${{ inputs.html_report }}' || unset MYPY_HTML
mypy $MYPY_HTML ${{ inputs.mypy_args }}
- name: 📤 Upload 'Static Typing Report' artifact - name: 📤 Upload 'Static Typing Report' artifact
if: ${{ inputs.html_report != '' }} if: ${{ inputs.artifact != '' }}
continue-on-error: true continue-on-error: true
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: ${{ inputs.artifact }} name: ${{ inputs.artifact }}
path: ${{ inputs.html_report }} path: ${{ inputs.report }}
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 1

View File

@@ -40,12 +40,12 @@ jobs:
needs: needs:
- Params - Params
with: with:
mypy_args: -m ${{ fromJson(needs.Params.outputs.params).name }} commands: mypy --html-report htmlmypy -p ToolName
artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.typing }} artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.typing }}
# 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'
html_report: 'htmlmypy' report: 'htmlmypy'
Release: Release:
uses: pyTooling/Actions/.github/workflows/Release.yml@dev uses: pyTooling/Actions/.github/workflows/Release.yml@dev