From 462e51253c95686d1b8fbbe64a69f521fb36fe25 Mon Sep 17 00:00:00 2001 From: umarcor Date: Mon, 29 Nov 2021 23:40:10 +0100 Subject: [PATCH] StaticTypeCheck: require the user to specify the mypy commands --- .github/workflows/Params.yml | 1 - .github/workflows/StaticTypeCheck.yml | 16 +++++++--------- ExamplePipeline.yml | 4 ++-- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Params.yml b/.github/workflows/Params.yml index 6817022..2f74ef2 100644 --- a/.github/workflows/Params.yml +++ b/.github/workflows/Params.yml @@ -40,7 +40,6 @@ jobs: run: | name = '${{ inputs.name }}' params = { - 'name': name, 'python_version': '${{ inputs.python_version }}', 'artifacts': { 'unittesting': f'{name}-TestReport', diff --git a/.github/workflows/StaticTypeCheck.yml b/.github/workflows/StaticTypeCheck.yml index 1855542..2facb91 100644 --- a/.github/workflows/StaticTypeCheck.yml +++ b/.github/workflows/StaticTypeCheck.yml @@ -13,13 +13,13 @@ on: required: false default: '-r tests/requirements.txt' type: string - html_report: - description: 'Directory for --html-report.' + report: + description: 'Directory to upload as an artifact.' required: false default: 'htmlmypy' type: string - mypy_args: - description: 'Arguments to mypy, except the HTML report (see option html_report).' + commands: + description: 'Commands to run the static type checks.' required: true type: string artifact: @@ -49,16 +49,14 @@ jobs: - name: Check Static Typing continue-on-error: true - run: | - [ 'x${{ inputs.html_report }}' != 'x' ] && MYPY_HTML='--html-report=${{ inputs.html_report }}' || unset MYPY_HTML - mypy $MYPY_HTML ${{ inputs.mypy_args }} + run: ${{ inputs.commands }} - name: 📤 Upload 'Static Typing Report' artifact - if: ${{ inputs.html_report != '' }} + if: ${{ inputs.artifact != '' }} continue-on-error: true uses: actions/upload-artifact@v2 with: name: ${{ inputs.artifact }} - path: ${{ inputs.html_report }} + path: ${{ inputs.report }} if-no-files-found: error retention-days: 1 diff --git a/ExamplePipeline.yml b/ExamplePipeline.yml index 23ece50..3368b15 100644 --- a/ExamplePipeline.yml +++ b/ExamplePipeline.yml @@ -40,12 +40,12 @@ jobs: needs: - Params 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 }} # Optional python_version: ${{ fromJson(needs.Params.outputs.params).python_version }} requirements: '-r tests/requirements.txt' - html_report: 'htmlmypy' + report: 'htmlmypy' Release: uses: pyTooling/Actions/.github/workflows/Release.yml@dev