Skip to content

Commit c7f68db

Browse files
committed
ENH: Add Azure Pipelines configuration
1 parent a7d94d1 commit c7f68db

File tree

1 file changed

+219
-0
lines changed

1 file changed

+219
-0
lines changed

test/azure-pipelines.yml

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
variables:
2+
ITKGitTag: v5.0.1
3+
ITKPythonGitTag: v5.0.1
4+
CMakeBuildType: Release
5+
6+
trigger:
7+
batch: true
8+
branches:
9+
include:
10+
- master
11+
12+
jobs:
13+
14+
- job: 'Test'
15+
displayName: "Build and test"
16+
timeoutInMinutes: 0
17+
cancelTimeoutInMinutes: 300
18+
19+
strategy:
20+
matrix:
21+
Linux:
22+
imageName: 'ubuntu-16.04'
23+
cCompiler: gcc
24+
cxxCompiler: g++
25+
compilerInitialization: ''
26+
macOS:
27+
imageName: 'macos-10.13'
28+
cCompiler: clang
29+
cxxCompiler: clang++
30+
compilerInitialization: ''
31+
Windows:
32+
imageName: 'vs2017-win2016'
33+
cCompiler: cl.exe
34+
cxxCompiler: cl.exe
35+
compilerInitialization: 'call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"'
36+
37+
pool:
38+
vmImage: $(imageName)
39+
40+
steps:
41+
- bash: |
42+
set -x
43+
if [ -n "$(System.PullRequest.SourceCommitId)" ]; then
44+
git checkout $(System.PullRequest.SourceCommitId)
45+
fi
46+
displayName: 'Checkout pull request HEAD'
47+
48+
- task: UsePythonVersion@0
49+
inputs:
50+
versionSpec: '3.7'
51+
architecture: 'x64'
52+
53+
- script: |
54+
python -m pip install --upgrade pip
55+
python -m pip install --upgrade setuptools
56+
python -m pip install scikit-ci-addons
57+
python -m pip install ninja
58+
displayName: 'Install build dependencies'
59+
60+
- script: |
61+
git clone https://github.com/InsightSoftwareConsortium/ITK.git
62+
cd ITK
63+
git checkout $(ITKGitTag)
64+
workingDirectory: $(Agent.BuildDirectory)
65+
displayName: 'Download ITK'
66+
67+
- script: |
68+
mkdir ITK-build
69+
cd ITK-build
70+
$(compilerInitialization)
71+
cmake -DCMAKE_C_COMPILER:FILEPATH="$(cCompiler)" -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_CXX_COMPILER="$(cxxCompiler)" -DCMAKE_BUILD_TYPE:STRING=$(CMakeBuildType) -DBUILD_TESTING:BOOL=OFF -GNinja ../ITK
72+
ninja
73+
workingDirectory: $(Agent.BuildDirectory)
74+
displayName: 'Build ITK'
75+
76+
- script: |
77+
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/dashboard/itk_common.cmake -O
78+
displayName: 'Fetch CTest driver script'
79+
80+
- bash: |
81+
cat > dashboard.cmake << EOF
82+
set(CTEST_SITE "Azure.\$ENV{AGENT_MACHINENAME}")
83+
file(TO_CMAKE_PATH "\$ENV{AGENT_BUILDDIRECTORY}" CTEST_DASHBOARD_ROOT)
84+
file(TO_CMAKE_PATH "\$ENV{BUILD_SOURCESDIRECTORY}" CTEST_SOURCE_DIRECTORY)
85+
file(TO_CMAKE_PATH "\$ENV{AGENT_BUILDDIRECTORY}/build" CTEST_BINARY_DIRECTORY)
86+
set(dashboard_source_name "$(Build.Repository.Name)")
87+
if(DEFINED ENV{SYSTEM_PULLREQUEST_SOURCEBRANCH})
88+
set(branch "-\$ENV{SYSTEM_PULLREQUEST_SOURCEBRANCH}")
89+
set(dashboard_model "Experimental")
90+
elseif(ENV{BUILD_SOURCEBRANCHNAME} STREQUAL "master")
91+
set(branch "-master")
92+
set(dashboard_model "Continuous")
93+
else()
94+
set(branch "-\$ENV{BUILD_SOURCEBRANCHNAME}")
95+
set(dashboard_model "Experimental")
96+
endif()
97+
if(DEFINED ENV{SYSTEM_PULLREQUEST_PULLREQUESTNUMBER})
98+
set(pr "-PR\$ENV{SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}")
99+
else()
100+
set(pr "")
101+
endif()
102+
set(CTEST_BUILD_NAME "$(Build.Repository.Name)-$(Agent.OS)-Build$(Build.BuildId)\${pr}\${branch}")
103+
set(CTEST_UPDATE_VERSION_ONLY 1)
104+
set(CTEST_TEST_ARGS \${CTEST_TEST_ARGS} PARALLEL_LEVEL \${PARALLEL_LEVEL})
105+
set(CTEST_BUILD_CONFIGURATION "Release")
106+
set(CTEST_CMAKE_GENERATOR "Ninja")
107+
set(CTEST_CUSTOM_WARNING_EXCEPTION
108+
\${CTEST_CUSTOM_WARNING_EXCEPTION}
109+
# macOS Azure Pipelines
110+
"ld: warning: text-based stub file"
111+
)
112+
set(dashboard_no_clean 1)
113+
set(ENV{CC} $(cCompiler))
114+
set(ENV{CXX} $(cxxCompiler))
115+
set(dashboard_cache "
116+
ITK_DIR:PATH=\${CTEST_DASHBOARD_ROOT}/ITK-build
117+
BUILD_TESTING:BOOL=ON
118+
")
119+
string(TIMESTAMP build_date "%Y-%m-%d")
120+
message("CDash Build Identifier: \${build_date} \${CTEST_BUILD_NAME}")
121+
message("CTEST_SITE = \${CTEST_SITE}")
122+
include(\${CTEST_SCRIPT_DIRECTORY}/itk_common.cmake)
123+
EOF
124+
cat dashboard.cmake
125+
displayName: 'Configure CTest script'
126+
127+
- script: |
128+
$(compilerInitialization)
129+
ctest -j 2 -V -S dashboard.cmake
130+
displayName: 'Build and test'
131+
132+
- script: |
133+
sudo pip3 install --upgrade pip
134+
sudo pip3 install --upgrade setuptools
135+
sudo pip3 install scikit-ci-addons
136+
ci_addons ctest_junit_formatter $(Agent.BuildDirectory)/build > $(Agent.BuildDirectory)/JUnitTestResults.xml
137+
condition: succeededOrFailed()
138+
displayName: 'Format CTest output in JUnit format'
139+
140+
- task: PublishTestResults@2
141+
inputs:
142+
testResultsFiles: "$(Agent.BuildDirectory)/JUnitTestResults.xml"
143+
testRunTitle: 'CTest $(Agent.OS)'
144+
condition: succeededOrFailed()
145+
displayName: 'Publish test results'
146+
147+
148+
- job: 'PackageLinux'
149+
timeoutInMinutes: 0
150+
cancelTimeoutInMinutes: 300
151+
displayName: "Build Linux Python packages"
152+
pool:
153+
vmImage: 'Ubuntu-16.04'
154+
155+
steps:
156+
- script: |
157+
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh -O
158+
chmod u+x dockcross-manylinux-download-cache-and-build-module-wheels.sh
159+
displayName: 'Fetch build script'
160+
161+
- script: |
162+
export ITK_PACKAGE_VERSION=$(ITKPythonGitTag)
163+
./dockcross-manylinux-download-cache-and-build-module-wheels.sh
164+
displayName: 'Build Python packages'
165+
166+
- task: PublishPipelineArtifact@0
167+
inputs:
168+
artifactName: 'LinuxWheels'
169+
targetPath: './dist'
170+
171+
172+
- job: 'PackageMacOS'
173+
displayName: "Build macOS Python packages"
174+
timeoutInMinutes: 0
175+
cancelTimeoutInMinutes: 300
176+
pool:
177+
vmImage: 'macos-10.14'
178+
179+
steps:
180+
- script: |
181+
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/macpython-download-cache-and-build-module-wheels.sh -O
182+
chmod u+x macpython-download-cache-and-build-module-wheels.sh
183+
displayName: 'Fetch build script'
184+
185+
- script: |
186+
export ITK_PACKAGE_VERSION=$(ITKPythonGitTag)
187+
./macpython-download-cache-and-build-module-wheels.sh
188+
displayName: 'Build Python packages'
189+
190+
- task: PublishPipelineArtifact@0
191+
inputs:
192+
artifactName: 'MacOSWheels'
193+
targetPath: './dist'
194+
195+
196+
- job: 'PackageWindows'
197+
displayName: "Build Windows Python packages"
198+
timeoutInMinutes: 0
199+
cancelTimeoutInMinutes: 300
200+
pool:
201+
vmImage: 'vs2017-win2016'
202+
203+
steps:
204+
- script: |
205+
curl -L https://raw.githubusercontent.com/InsightSoftwareConsortium/ITKPythonPackage/master/scripts/windows-download-cache-and-build-module-wheels.ps1 -O
206+
displayName: 'Fetch build script'
207+
208+
- script: |
209+
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
210+
set ITK_PACKAGE_VERSION=$(ITKPythonGitTag)
211+
set CC=cl.exe
212+
set CXX=cl.exe
213+
powershell.exe -file .\windows-download-cache-and-build-module-wheels.ps1
214+
displayName: 'Build Python packages'
215+
216+
- task: PublishPipelineArtifact@0
217+
inputs:
218+
artifactName: 'WindowsWheels'
219+
targetPath: './dist'

0 commit comments

Comments
 (0)