Built matrix conditionally

This commit is contained in:
Marek Wolan
2023-07-11 07:16:11 +00:00
parent ca737e080f
commit 831469d01c

View File

@@ -8,30 +8,29 @@ trigger:
strategy: strategy:
matrix: matrix:
${{ if eq(variables['Build.Reason'], 'PullRequest') }}:
UbuntuPython38: UbuntuPython38:
python.version: '3.8' python.version: '3.8'
imageName: 'ubuntu-latest' imageName: 'ubuntu-latest'
condition: eq(variables['Build.Reason'], 'PullRequest')
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'
condition: eq(variables['Build.Reason'], 'PullRequest')
MacOSPython38: MacOSPython38:
python.version: '3.8' python.version: '3.8'
imageName: 'macOS-latest' imageName: 'macOS-latest'
condition: eq(variables['Build.Reason'], 'PullRequest')
MacOSPython310: MacOSPython310:
python.version: '3.10' python.version: '3.10'
imageName: 'macOS-latest' imageName: 'macOS-latest'
condition: eq(variables['Build.Reason'], 'PullRequest') ${{ if not(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. UbuntuPython310:
python.version: '3.10'
imageName: 'ubuntu-latest'
pool: pool:
vmImage: $(imageName) vmImage: $(imageName)