Skip to content

Commit 175da9b

Browse files
committed
ci: fan out Azure pipelines on Python version (parallel matrix)
Previously, each (os, test_suite) pair ran as a single Azure Pipelines job and iterated over python_versions as a template loop inside that job's steps: strategy: matrix: <test_suite>: {...} steps: - ${{ each pyver in parameters.python_versions }}: - install python pyver - configure - run test_suite Consequence: all Python versions for a given (os, test_suite) ran sequentially on the same agent. If the first Python version failed (e.g. an env-specific test failure on the *_latest_from_pip matrix), all subsequent Python versions were skipped instead of also running and showing whether they were affected. Move python_version into the strategy.matrix so each (python_version, test_suite) combination runs as its own parallel job on its own agent VM. Each job becomes shorter (one Python install + configure + test run instead of N of each) and an issue affecting one Python version no longer hides results for the others. Matrix keys are of the form 'py3_10_all' / 'py3_11_misc_and_scancode' etc. (matrix keys must be alphanumeric+underscore, so dots in version strings are replaced). No changes to the per-job test command or to the caller pipelines in azure-pipelines.yml -- the python_versions and test_suites parameters keep the same shape. Signed-off-by: Guillem Serra Cazorla <gserracazorla@gmail.com>
1 parent 6570c13 commit 175da9b

2 files changed

Lines changed: 46 additions & 34 deletions

File tree

etc/ci/azure-posix.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,35 @@ jobs:
1111
pool:
1212
vmImage: ${{ parameters.image_name }}
1313

14+
# Fan out on both Python version AND test suite so each
15+
# (python_version, test_suite) combination runs as its own parallel
16+
# job on its own agent VM. Previously python_versions were iterated
17+
# as sequential steps inside a single job, so a failure on the first
18+
# Python version skipped all subsequent ones.
1419
strategy:
1520
matrix:
16-
${{ each tsuite in parameters.test_suites }}:
17-
${{ tsuite.key }}:
18-
test_suite_label: ${{ tsuite.key }}
19-
test_suite: ${{ tsuite.value }}
21+
${{ each pyver in parameters.python_versions }}:
22+
${{ each tsuite in parameters.test_suites }}:
23+
py${{ replace(pyver, '.', '_') }}_${{ tsuite.key }}:
24+
python_version: ${{ pyver }}
25+
test_suite_label: ${{ tsuite.key }}
26+
test_suite: ${{ tsuite.value }}
2027

2128
steps:
2229
- checkout: self
2330
fetchDepth: 10
2431

25-
- ${{ each pyver in parameters.python_versions }}:
26-
- task: UsePythonVersion@0
27-
inputs:
28-
versionSpec: '${{ pyver }}'
29-
architecture: '${{ parameters.python_architecture }}'
30-
displayName: '${{ pyver }} - Install Python'
32+
- task: UsePythonVersion@0
33+
inputs:
34+
versionSpec: '$(python_version)'
35+
architecture: '${{ parameters.python_architecture }}'
36+
displayName: 'Install Python $(python_version)'
3137

32-
- script: |
33-
python${{ pyver }} --version
34-
echo "python${{ pyver }}" > PYTHON_EXECUTABLE
35-
./configure --clean && ./configure --dev
36-
displayName: '${{ pyver }} - Configure'
38+
- script: |
39+
python$(python_version) --version
40+
echo "python$(python_version)" > PYTHON_EXECUTABLE
41+
./configure --clean && ./configure --dev
42+
displayName: 'Configure with Python $(python_version)'
3743
38-
- script: $(test_suite)
39-
displayName: '${{ pyver }} - $(test_suite_label) on ${{ parameters.job_name }}'
44+
- script: $(test_suite)
45+
displayName: '$(test_suite_label) on ${{ parameters.job_name }} with Python $(python_version)'

etc/ci/azure-win.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,35 @@ jobs:
1111
pool:
1212
vmImage: ${{ parameters.image_name }}
1313

14+
# Fan out on both Python version AND test suite so each
15+
# (python_version, test_suite) combination runs as its own parallel
16+
# job on its own agent VM. Previously python_versions were iterated
17+
# as sequential steps inside a single job, so a failure on the first
18+
# Python version skipped all subsequent ones.
1419
strategy:
1520
matrix:
16-
${{ each tsuite in parameters.test_suites }}:
17-
${{ tsuite.key }}:
18-
test_suite_label: ${{ tsuite.key }}
19-
test_suite: ${{ tsuite.value }}
21+
${{ each pyver in parameters.python_versions }}:
22+
${{ each tsuite in parameters.test_suites }}:
23+
py${{ replace(pyver, '.', '_') }}_${{ tsuite.key }}:
24+
python_version: ${{ pyver }}
25+
test_suite_label: ${{ tsuite.key }}
26+
test_suite: ${{ tsuite.value }}
2027

2128
steps:
2229
- checkout: self
2330
fetchDepth: 10
2431

25-
- ${{ each pyver in parameters.python_versions }}:
26-
- task: UsePythonVersion@0
27-
inputs:
28-
versionSpec: '${{ pyver }}'
29-
architecture: '${{ parameters.python_architecture }}'
30-
displayName: '${{ pyver }} - Install Python'
32+
- task: UsePythonVersion@0
33+
inputs:
34+
versionSpec: '$(python_version)'
35+
architecture: '${{ parameters.python_architecture }}'
36+
displayName: 'Install Python $(python_version)'
3137

32-
- script: |
33-
python --version
34-
echo | set /p=python> PYTHON_EXECUTABLE
35-
configure --clean && configure --dev
36-
displayName: '${{ pyver }} - Configure'
38+
- script: |
39+
python --version
40+
echo | set /p=python> PYTHON_EXECUTABLE
41+
configure --clean && configure --dev
42+
displayName: 'Configure with Python $(python_version)'
3743
38-
- script: $(test_suite)
39-
displayName: '${{ pyver }} - $(test_suite_label) on ${{ parameters.job_name }}'
44+
- script: $(test_suite)
45+
displayName: '$(test_suite_label) on ${{ parameters.job_name }} with Python $(python_version)'

0 commit comments

Comments
 (0)