diff --git a/README.md b/README.md index 9c726c0..6b306c3 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ This repo stores the following shared repository settings/configurations/templat - `isort` - `pylint` - `codecov` + - `mypy` - Shared configurations for Azure Pipelines - Shared configurations for GitHub Actions - Issue/PR labels shared across the organization diff --git a/azure/README.md b/azure/README.md index cda1b47..32c5aed 100644 --- a/azure/README.md +++ b/azure/README.md @@ -27,11 +27,12 @@ The templates are organized into the following files: | `COVERAGE` | boolean | `false` | Flag to report test coverage to `codecov` | | `TIMEOUT_STYLE` | number | `10` | Runtime allowed for each style check, in minutes | | `IGNORE_STYLE` | boolean | `false` | Flag to allow `formatting and linting` checks to fail without failing the pipeline | -| `BASE_FORMAT_AND_LINT` | boolean | `false` | Flag to trigger the `base_format_and_lint` check | +| `BASE_FORMAT_AND_LINT` | boolean | `true` | Flag to trigger the `base_format_and_lint` check | | `ISORT` | boolean | `false` | Flag to trigger the `isort` check | | `PYLINT` | boolean | `false` | Flag to trigger the `pylint` check | | `CLANG_FORMAT` | boolean | `false` | Flag to trigger the `clang-format` check | | `FPRETTIFY` | boolean | `false` | Flag to trigger the `fprettify` check | +| `MYPY` | boolean | `false` | Flag to trigger the `mypy` check | | `TAPENADE` | boolean | `false` | Flag to trigger the Tapenade check | | `TIMEOUT_TAPENADE` | number | `10` | Runtime allowed for the Tapenade check, in minutes | | `TAPENADE_SCRIPT` | string | `.github/build_tapenade.sh` | Path to Bash script with commands to run Tapenade | diff --git a/azure/azure_style.yaml b/azure/azure_style.yaml index 210017f..2236365 100644 --- a/azure/azure_style.yaml +++ b/azure/azure_style.yaml @@ -23,6 +23,9 @@ parameters: - name: FPRETTIFY type: boolean default: false + - name: MYPY + type: boolean + default: false jobs: - job: base_format_and_lint pool: @@ -153,4 +156,25 @@ jobs: # Exit with an error if any of the tracked files changed git diff --summary --exit-code + - job: mypy + pool: + vmImage: "ubuntu-22.04" + timeoutInMinutes: ${{ parameters.TIMEOUT }} + continueOnError: ${{ parameters.IGNORE_STYLE }} + condition: ${{ parameters.MYPY }} + steps: + - checkout: self + - checkout: azure_template + - task: UsePythonVersion@0 + inputs: + versionSpec: "3.11" + - script: | + cd ${{ parameters.REPO_NAME }} + + pip install wheel + pip install mypy + + # Run mypy check (should pick up local config from mypy.ini or .mypy.ini if present) + mypy + diff --git a/azure/azure_template.yaml b/azure/azure_template.yaml index 4a3bb66..76e21f5 100644 --- a/azure/azure_template.yaml +++ b/azure/azure_template.yaml @@ -42,6 +42,9 @@ parameters: - name: IGNORE_STYLE type: boolean default: false + - name: BASE_FORMAT_AND_LINT + type: boolean + default: true - name: ISORT type: boolean default: false @@ -54,7 +57,7 @@ parameters: - name: FPRETTIFY type: boolean default: false - - name: RUFF + - name: MYPY type: boolean default: false # Tapenade @@ -115,10 +118,12 @@ stages: REPO_NAME: ${{ parameters.REPO_NAME }} TIMEOUT: ${{ parameters.TIMEOUT_STYLE }} IGNORE_STYLE: ${{ parameters.IGNORE_STYLE }} + BASE_FORMAT_AND_LINT: ${{ parameters.BASE_FORMAT_AND_LINT }} ISORT: ${{ parameters.ISORT }} PYLINT: ${{ parameters.PYLINT }} CLANG_FORMAT: ${{ parameters.CLANG_FORMAT }} FPRETTIFY: ${{ parameters.FPRETTIFY }} + MYPY: ${{ parameters.MYPY }} - stage: Tapenade dependsOn: []