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