Built matrix conditionally

This commit is contained in:
Marek Wolan
2023-07-11 07:16:11 +00:00
parent 59b34ffdf2
commit d90a00d063

View File

@@ -8,30 +8,29 @@ trigger:
strategy:
matrix:
UbuntuPython38:
python.version: '3.8'
imageName: 'ubuntu-latest'
condition: eq(variables['Build.Reason'], 'PullRequest')
UbuntuPython310:
python.version: '3.10'
imageName: 'ubuntu-latest'
WindowsPython38:
python.version: '3.8'
imageName: 'windows-latest'
condition: eq(variables['Build.Reason'], 'PullRequest')
WindowsPython310:
python.version: '3.10'
imageName: 'windows-latest'
condition: eq(variables['Build.Reason'], 'PullRequest')
MacOSPython38:
python.version: '3.8'
imageName: 'macOS-latest'
condition: eq(variables['Build.Reason'], 'PullRequest')
MacOSPython310:
python.version: '3.10'
imageName: 'macOS-latest'
condition: eq(variables['Build.Reason'], 'PullRequest')
# pretty sure this does not support a 'condition' parameter but worth a try. Otherwise a more complicated solution might be warranted.
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
UbuntuPython38:
python.version: '3.8'
imageName: 'ubuntu-latest'
UbuntuPython310:
python.version: '3.10'
imageName: 'ubuntu-latest'
WindowsPython38:
python.version: '3.8'
imageName: 'windows-latest'
WindowsPython310:
python.version: '3.10'
imageName: 'windows-latest'
MacOSPython38:
python.version: '3.8'
imageName: 'macOS-latest'
MacOSPython310:
python.version: '3.10'
imageName: 'macOS-latest'
${{ if not(eq(variables['Build.Reason'], 'PullRequest')) }}:
UbuntuPython310:
python.version: '3.10'
imageName: 'ubuntu-latest'
pool:
vmImage: $(imageName)