Skip to content

Commit b87b4ac

Browse files
scbeddCopilotmccoyp
authored
Dispatch Checks + Use new mypy check in CI (#42831)
* add new dispatch_checks entrypoint that will successfully dispatch azpysdk checks in CI context * refactor some installation code to ensure that packages are installed in venv context properly if necessary * optimize package installation and usage in `analyze.yml` build steps * utilize new azpysdk `mypy` check in `analyze.yml` for static analysis of all packages Co-authored-by: Copilot <[email protected]> Co-authored-by: McCoy Patiño <[email protected]>
1 parent 8204b16 commit b87b4ac

File tree

12 files changed

+467
-151
lines changed

12 files changed

+467
-151
lines changed

eng/pipelines/templates/steps/run_bandit.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ parameters:
66

77
# Please use `$(TargetingString)` to refer to the python packages glob string. This variable is set from resolve-package-targeting.yml.
88
steps:
9-
- script: |
10-
python -m pip install -r eng/ci_tools.txt
11-
displayName: 'Prep Environment'
12-
condition: and(succeededOrFailed(), ne(variables['Skip.Bandit'],'true'))
13-
9+
# this step should run on python 3.9.
10+
# a previous step should have installed eng/ci_tools.txt to active venv
1411
- task: PythonScript@0
1512
displayName: 'Run Bandit'
1613
inputs:

eng/pipelines/templates/steps/run_black.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,8 @@ parameters:
44
AdditionalTestArgs: ''
55

66
steps:
7-
- task: UsePythonVersion@0
8-
displayName: 'Use Python 3.9'
9-
inputs:
10-
versionSpec: '3.9'
11-
condition: succeededOrFailed()
12-
13-
- script: |
14-
python -m pip install -r eng/ci_tools.txt
15-
displayName: 'Prep Environment'
16-
condition: succeededOrFailed()
17-
7+
# this step should run on python 3.9.
8+
# a previous step should have installed eng/ci_tools.txt to active venv
189
- task: PythonScript@0
1910
displayName: 'Run Black'
2011
inputs:

eng/pipelines/templates/steps/run_mypy.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,24 @@ parameters:
22
BuildTargetingString: 'azure-*'
33
ServiceDirectory: ''
44
TestMarkArgument: ''
5-
EnvVars: {}
65
AdditionalTestArgs: ''
76

87
# Please use `$(TargetingString)` to refer to the python packages glob string. This variable is set from resolve-package-targeting.yml.
98
steps:
10-
- task: UsePythonVersion@0
11-
displayName: 'Use Python 3.9'
12-
inputs:
13-
versionSpec: '3.9'
14-
condition: and(succeededOrFailed(), ne(variables['Skip.MyPy'],'true'))
15-
16-
- script: |
17-
python -m pip install -r eng/ci_tools.txt
18-
displayName: 'Prep Environment'
19-
condition: and(succeededOrFailed(), ne(variables['Skip.MyPy'],'true'))
20-
9+
# this step should run on python 3.9.
10+
# a previous step should have installed eng/ci_tools.txt to active venv
2111
- task: PythonScript@0
2212
displayName: 'Run MyPy'
2313
inputs:
24-
scriptPath: 'scripts/devops_tasks/dispatch_tox.py'
14+
scriptPath: 'eng/scripts/dispatch_checks.py'
2515
arguments: >-
2616
"$(TargetingString)"
27-
--mark_arg="${{ parameters.TestMarkArgument }}"
2817
--service="${{ parameters.ServiceDirectory }}"
29-
--toxenv="mypy"
18+
--checks="mypy"
3019
--disablecov
3120
${{ parameters.AdditionalTestArgs }}
32-
env: ${{ parameters.EnvVars }}
21+
env:
22+
TOX_PIP_IMPL: "uv"
23+
VIRTUAL_ENV: ""
24+
PYTHONHOME: ""
3325
condition: and(succeededOrFailed(), ne(variables['Skip.MyPy'],'true'))

eng/pipelines/templates/steps/run_pylint.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@ parameters:
66

77
# Please use `$(TargetingString)` to refer to the python packages glob string. This variable is set from resolve-package-targeting.yml.
88
steps:
9-
- task: UsePythonVersion@0
10-
displayName: 'Use Python 3.9'
11-
inputs:
12-
versionSpec: '3.9'
13-
condition: and(succeededOrFailed(), ne(variables['Skip.Pylint'],'true'))
14-
15-
- script: |
16-
python -m pip install -r eng/ci_tools.txt
17-
displayName: 'Prep Environment'
18-
condition: and(succeededOrFailed(), ne(variables['Skip.Pylint'],'true'))
19-
9+
# this step should run on python 3.9.
10+
# a previous step should have installed eng/ci_tools.txt to active venv
2011
- task: PythonScript@0
2112
displayName: 'Run Pylint'
2213
inputs:

eng/pipelines/templates/steps/run_pyright.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@ parameters:
66

77
# Please use `$(TargetingString)` to refer to the python packages glob string. This variable is set from resolve-package-targeting.yml.
88
steps:
9-
- task: UsePythonVersion@0
10-
displayName: 'Use Python 3.9'
11-
inputs:
12-
versionSpec: '3.9'
13-
condition: and(succeededOrFailed(), or(ne(variables['Skip.Pyright'],'true'), ne(variables['Skip.Verifytypes'],'true')))
14-
15-
- script: |
16-
python -m pip install -r eng/ci_tools.txt
17-
displayName: 'Prep Environment'
18-
condition: and(succeededOrFailed(), or(ne(variables['Skip.Pyright'],'true'), ne(variables['Skip.Verifytypes'],'true')))
19-
9+
# this step should run on python 3.9.
10+
# a previous step should have installed eng/ci_tools.txt to active venv
2011
- task: PythonScript@0
2112
displayName: 'Run Pyright'
2213
inputs:

eng/pipelines/templates/steps/update_snippet.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ parameters:
44
default: ''
55

66
steps:
7-
- task: UsePythonVersion@0
8-
displayName: 'Use Python 3.9'
9-
inputs:
10-
versionSpec: '3.9'
11-
condition: succeededOrFailed()
12-
7+
# this step should run on python 3.9.
8+
# a previous step should have installed eng/ci_tools.txt to active venv
139
- pwsh: |
1410
$failed = $false
1511

0 commit comments

Comments
 (0)