Skip to content

Commit a33c655

Browse files
committed
ci: use matrix for azure pipelines
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 01eb077 commit a33c655

File tree

1 file changed

+45
-83
lines changed

1 file changed

+45
-83
lines changed

azure-pipelines.yml

Lines changed: 45 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -16,99 +16,61 @@ pr:
1616
- noxfile.py
1717

1818
jobs:
19-
- job: linux_311
19+
- job: tests
20+
strategy:
21+
matrix:
22+
linux_311:
23+
imageName: "ubuntu-latest"
24+
pythonVersion: "3.11"
25+
platformName: "native"
26+
android_311:
27+
imageName: "ubuntu-latest"
28+
pythonVersion: "3.11"
29+
platformName: "android"
30+
macos_311:
31+
imageName: "macos-latest"
32+
pythonVersion: "3.11"
33+
platformName: "native"
34+
ios_311:
35+
imageName: "macos-latest"
36+
pythonVersion: "3.11"
37+
platformName: "ios"
38+
android_macos_311:
39+
imageName: "macos-latest"
40+
pythonVersion: "3.11"
41+
platformName: "android"
42+
windows_311:
43+
imageName: "windows-latest"
44+
pythonVersion: "3.11"
45+
platformName: "native"
2046
timeoutInMinutes: 180
21-
pool: {vmImage: 'ubuntu-latest'}
22-
steps:
23-
- task: UsePythonVersion@0
24-
inputs:
25-
versionSpec: '3.11'
26-
- bash: |
27-
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
28-
python -m pip install -U pip
29-
python -m pip install -e. --group test
30-
if [ "$(Build.SourceBranch)" = "refs/heads/main" ]; then
31-
echo "INFO: Exporting CIBW_ENABLE=all for main branch test run."
32-
export CIBW_ENABLE=all
33-
else
34-
echo "INFO: CIBW_ENABLE not set for this branch ($(Build.SourceBranch))."
35-
fi
36-
python ./bin/run_tests.py --platform=native
47+
pool:
48+
vmImage: $(imageName)
3749

38-
- job: android_313
39-
timeoutInMinutes: 180
40-
pool: {vmImage: 'ubuntu-latest'}
4150
steps:
4251
- task: UsePythonVersion@0
4352
inputs:
44-
versionSpec: '3.13'
53+
versionSpec: $(pythonVersion)
54+
4555
- task: JavaToolInstaller@0
56+
condition: eq(variables['platformName'], 'android')
4657
inputs:
4758
versionSpec: '17'
4859
jdkArchitectureOption: 'x64'
4960
jdkSourceOption: 'PreInstalled'
50-
- bash: |
51-
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
52-
python -m pip install -U pip
53-
python -m pip install -e. --group test
54-
if [ "$(Build.SourceBranch)" = "refs/heads/main" ]; then
55-
echo "INFO: Exporting CIBW_ENABLE=all for main branch test run."
56-
export CIBW_ENABLE=all
57-
else
58-
echo "INFO: CIBW_ENABLE not set for this branch ($(Build.SourceBranch))."
59-
fi
60-
python ./bin/run_tests.py --platform=android
6161

62-
- job: macos_311
63-
pool: {vmImage: 'macOS-latest'}
64-
timeoutInMinutes: 120
65-
steps:
66-
- task: UsePythonVersion@0
67-
inputs:
68-
versionSpec: '3.11'
69-
- bash: |
70-
python -m pip install -U pip
71-
python -m pip install -e. --group test
72-
if [ "$(Build.SourceBranch)" = "refs/heads/main" ]; then
73-
echo "INFO: Exporting CIBW_ENABLE=all for main branch test run."
74-
export CIBW_ENABLE=all
75-
else
76-
echo "INFO: CIBW_ENABLE not set for this branch ($(Build.SourceBranch))."
77-
fi
78-
python ./bin/run_tests.py --platform=native
62+
- bash: docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
63+
condition: and(eq(variables['imageName'], 'ubuntu-latest'), eq(variables['platformName'], 'native'))
64+
displayName: 'Install binfmt on Linux'
7965

80-
- job: ios_313
81-
pool: {vmImage: 'macOS-latest'}
82-
timeoutInMinutes: 120
83-
steps:
84-
- task: UsePythonVersion@0
85-
inputs:
86-
versionSpec: '3.13'
87-
- bash: |
88-
python -m pip install -U pip
89-
python -m pip install -e. --group test
90-
if [ "$(Build.SourceBranch)" = "refs/heads/main" ]; then
91-
echo "INFO: Exporting CIBW_ENABLE=all for main branch test run."
92-
export CIBW_ENABLE=all
93-
else
94-
echo "INFO: CIBW_ENABLE not set for this branch ($(Build.SourceBranch))."
95-
fi
96-
python ./bin/run_tests.py --platform ios && python ./bin/run_tests.py --platform android
66+
- bash: python -m pip install -U pip && python -m pip install -e. --group test
67+
displayName: 'Update pip and install cibuildwheel --group test'
9768

98-
- job: windows_311
99-
pool: {vmImage: 'windows-latest'}
100-
timeoutInMinutes: 180
101-
steps:
102-
- task: UsePythonVersion@0
103-
inputs:
104-
versionSpec: '3.11'
105-
- bash: |
106-
python -m pip install -U pip
107-
python -m pip install -e. --group test
108-
if [ "$(Build.SourceBranch)" = "refs/heads/main" ]; then
109-
echo "INFO: Exporting CIBW_ENABLE=all for main branch test run."
110-
export CIBW_ENABLE=all
111-
else
112-
echo "INFO: CIBW_ENABLE not set for this branch ($(Build.SourceBranch))."
113-
fi
114-
python ./bin/run_tests.py
69+
- bash: echo "##vso[task.setvariable variable=enable;all]"
70+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
71+
displayName: Set CIBW_ENABLE to all (main branch)
72+
73+
- bash: python ./bin/run_tests.py --platform $(platformName)
74+
displayName: 'Run tests'
75+
env:
76+
CIBW_ENABLE: $(enable)

0 commit comments

Comments
 (0)