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