Skip to content

Commit 0decdff

Browse files
authored
Merge pull request #117 from InsightSoftwareConsortium/azure-pipelines
Set up CI with Azure Pipelines
2 parents ff807b9 + f4fa8f8 commit 0decdff

File tree

1 file changed

+213
-0
lines changed

1 file changed

+213
-0
lines changed

azure-pipelines.yml

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

0 commit comments

Comments
 (0)