1- parameters :
2- PROJECT_DIRECTORY : ' workers'
3-
41jobs :
52 - job : " TestPython"
63 displayName : " Run Dependency Checks"
129
1310 strategy :
1411 matrix :
12+ Python39 :
13+ PYTHON_VERSION : ' 3.9'
14+ Python310 :
15+ PYTHON_VERSION : ' 3.10'
1516 Python311 :
1617 PYTHON_VERSION : ' 3.11'
1718 Python312 :
@@ -24,40 +25,47 @@ jobs:
2425 - task : UsePythonVersion@0
2526 inputs :
2627 versionSpec : $(PYTHON_VERSION)
27- - bash : |
28- PY_VER= "$(PYTHON_VERSION)"
29- echo "Python version: $PY_VER"
28+ - powershell : |
29+ $ PY_VER = "$(PYTHON_VERSION)"
30+ Write-Host "Python version: $PY_VER"
3031
31- # Extract minor version
32- PY_MINOR="${PY_VER#*.}"
32+ # Extract minor version as integers
33+ $versionParts = $PY_VER.Split('.')
34+ $PY_MINOR = [int]$versionParts[1]
35+ Write-Host "Minor version: $PY_MINOR"
36+ Write-Host "##vso[task.setvariable variable=minorVersion;]$PY_MINOR"
3337
34- if [ "$PY_MINOR" -ge 13 ]; then
35- echo "Checking proxy_worker (Python >= 3.13)..."
36- python workers/tests/unittests/check_imports.py workers proxy_worker
38+ # Set build-related variables based on Python minor version
39+ if( $PY_MINOR -ge 13 )
40+ {
41+ Write-Host "##vso[task.setvariable variable=proxyWorker;]true"
42+ }
3743 else
38- echo "Checking azure_functions_worker (Python < 3.13)..."
39- python workers/tests/unittests/check_imports.py workers azure_functions_worker
40- fi
41- displayName: 'Python Worker: check for missing dependencies '
44+ {
45+ Write-Host "##vso[task.setvariable variable=proxyWorker;]false"
46+ }
47+ displayName: 'Set necessary variables '
4248 - bash : |
43- PY_VER="$(PYTHON_VERSION)"
44- echo "Python version: $PY_VER"
45-
46- # Extract minor version
47- PY_MINOR="${PY_VER#*.}"
48-
49- if [ "$PY_MINOR" -ge 13 ]; then
50- python workers/tests/unittests/check_imports.py runtimes/v1 azure-functions-runtime-v1
51- fi
49+ echo "Checking azure_functions_worker (Python < 3.13)..."
50+ cd workers
51+ python -c "import pkgutil, importlib; [importlib.import_module(f'azure_functions_worker.{name}') for _, name, _ in pkgutil.walk_packages(['azure_functions_worker'])]"
52+ displayName: 'Python Azure Functions Worker: check for missing dependencies'
53+ condition: eq(variables['proxyWorker'], false)
54+ - bash : |
55+ echo "Checking proxy_worker (Python >= 3.13)..."
56+ cd workers
57+ python -c "import pkgutil, importlib; [importlib.import_module(f'proxy_worker.{name}') for _, name, _ in pkgutil.walk_packages(['proxy_worker'])]"
58+ displayName: 'Python Proxy Worker: check for missing dependencies'
59+ condition: eq(variables['proxyWorker'], true)
60+ - bash : |
61+ echo "Checking V1 Library Worker (Python >= 3.13)..."
62+ cd runtimes/v1
63+ python -c "import pkgutil, importlib; [importlib.import_module(f'azure_functions_runtime_v1.{name}') for _, name, _ in pkgutil.walk_packages(['azure_functions_runtime_v1'])]"
5264 displayName: 'Python Library V1: check for missing dependencies'
65+ condition: eq(variables['proxyWorker'], true)
5366 - bash : |
54- PY_VER="$(PYTHON_VERSION)"
55- echo "Python version: $PY_VER"
56-
57- # Extract minor version
58- PY_MINOR="${PY_VER#*.}"
59-
60- if [ "$PY_MINOR" -ge 13 ]; then
61- python workers/tests/unittests/check_imports.py runtimes/v2 azure-functions-runtime
62- fi
67+ echo "Checking V2 Library Worker (Python >= 3.13)..."
68+ cd runtimes/v2
69+ python -c "import pkgutil, importlib; [importlib.import_module(f'azure_functions_runtime.{name}') for _, name, _ in pkgutil.walk_packages(['azure_functions_runtime'])]"
6370 displayName: 'Python Library V2: check for missing dependencies'
71+ condition: eq(variables['proxyWorker'], true)
0 commit comments