1/* This pipeline is used for post-commit testing, so it runs frequently. 2 * 3 * Test objectives for this pipeline are: 4 * 5 * - Run the entire pipeline in less than 10 minutes. 6 * - Test builds on all supported operating systems. 7 * - Test builds on all supported compilers. 8 * - Test release and debug build variants. 9 * - Run functional smoke tests. 10 * - Run image quality smoke tests. 11 * 12 * The test matrix is not fully covered; e.g. we can assume compilers behave 13 * similarly on different operating systems, so we test one compiler per OS. 14 */ 15 16@Library('hive-infra-library@changes/86/295486/1') _ 17 18pipeline { 19 agent none 20 21 options { 22 ansiColor('xterm') 23 timestamps() 24 } 25 26 stages { 27 stage('Build All') { 28 parallel { 29 /* Build for Linux on x86-64 using GCC */ 30 stage('Linux') { 31 agent { 32 kubernetes { 33 yaml '''\ 34 apiVersion: v1 35 kind: Pod 36 spec: 37 securityContext: 38 runAsUser: 1000 39 runAsGroup: 1000 40 imagePullSecrets: 41 - name: artifactory-ms-docker 42 containers: 43 - name: astcenc 44 image: mobile-studio--docker.eu-west-1.artifactory.aws.arm.com/astcenc:3.2.0 45 command: 46 - sleep 47 args: 48 - infinity 49 resources: 50 requests: 51 cpu: 4 52 memory: 8Gi 53 limits: 54 cpu: 8 55 memory: 16Gi 56 '''.stripIndent() 57 defaultContainer 'astcenc' 58 } 59 } 60 stages { 61 stage('Clean') { 62 steps { 63 sh ''' 64 git clean -ffdx 65 git submodule init 66 git submodule update 67 ''' 68 } 69 } 70 stage('Build R x64') { 71 steps { 72 sh ''' 73 mkdir build_rel 74 cd build_rel 75 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON -DASTCENC_UNITTEST=ON -DASTCENC_PACKAGE=x64 .. 76 make install package -j4 77 ''' 78 } 79 } 80 stage('Build D x64') { 81 steps { 82 sh ''' 83 mkdir build_dbg 84 cd build_dbg 85 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON .. 86 make -j4 87 ''' 88 } 89 } 90 stage('Stash') { 91 steps { 92 dir('build_rel') { 93 stash name: 'astcenc-linux-x64', includes: '*.zip' 94 } 95 } 96 } 97 stage('Test') { 98 steps { 99 sh ''' 100 python3 ./Test/astc_test_functional.py --encoder=none 101 python3 ./Test/astc_test_functional.py --encoder=sse2 102 python3 ./Test/astc_test_functional.py --encoder=sse4.1 103 python3 ./Test/astc_test_functional.py --encoder=avx2 104 python3 ./Test/astc_test_image.py --encoder=none --test-set Small --test-quality medium 105 python3 ./Test/astc_test_image.py --encoder=all-x86 --test-set Small --test-quality medium 106 ''' 107 dir('build_rel') { 108 sh 'ctest' 109 } 110 } 111 } 112 } 113 } 114 /* Build for Windows on x86-64 using MSVC */ 115 stage('Windows MSVC') { 116 agent { 117 label 'Windows' 118 } 119 stages { 120 stage('Clean') { 121 steps { 122 bat 'git clean -ffdx' 123 } 124 } 125 stage('Build R x64') { 126 steps { 127 bat ''' 128 call c:\\progra~2\\micros~1\\2022\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 129 mkdir build_rel 130 cd build_rel 131 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64-cl .. 132 nmake install package 133 ''' 134 } 135 } 136 stage('Build D x64') { 137 steps { 138 bat ''' 139 call c:\\progra~2\\micros~1\\2022\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 140 mkdir build_dbg 141 cd build_dbg 142 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON .. 143 nmake 144 ''' 145 } 146 } 147 stage('Stash') { 148 steps { 149 dir('build_rel') { 150 stash name: 'astcenc-windows-x64-cl', includes: '*.zip' 151 } 152 } 153 } 154 stage('Test') { 155 steps { 156 bat ''' 157 set Path=c:\\Python3;c:\\Python3\\Scripts;%Path% 158 call python ./Test/astc_test_image.py --test-set Small --test-quality medium 159 ''' 160 } 161 } 162 } 163 } 164 /* Build for Windows on x86-64 using MSVC + ClangCL */ 165 stage('Windows ClangCL') { 166 agent { 167 label 'Windows' 168 } 169 stages { 170 stage('Clean') { 171 steps { 172 bat 'git clean -ffdx' 173 } 174 } 175 stage('Build R x64') { 176 steps { 177 bat ''' 178 call c:\\progra~2\\micros~1\\2022\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 179 mkdir build_rel 180 cd build_rel 181 cmake -G "Visual Studio 17 2022" -T ClangCL -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64-clangcl .. 182 msbuild astcencoder.sln -property:Configuration=Release 183 msbuild PACKAGE.vcxproj -property:Configuration=Release 184 msbuild INSTALL.vcxproj -property:Configuration=Release 185 ''' 186 } 187 } 188 stage('Build D x64') { 189 steps { 190 bat ''' 191 call c:\\progra~2\\micros~1\\2022\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 192 mkdir build_dbg 193 cd build_dbg 194 cmake -G "Visual Studio 17 2022" -T ClangCL -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON .. 195 msbuild astcencoder.sln -property:Configuration=Debug 196 ''' 197 } 198 } 199 stage('Build R Arm64') { 200 steps { 201 bat ''' 202 call c:\\progra~2\\micros~1\\2022\\buildtools\\vc\\auxiliary\\build\\vcvarsall.bat x64_arm64 203 mkdir build_rel_arm64 204 cd build_rel_arm64 205 cmake -G "Visual Studio 17 2022" -A ARM64 -T ClangCL -DASTCENC_ISA_NEON=ON -DASTCENC_PACKAGE=arm64-clangcl .. 206 msbuild astcencoder.sln -property:Configuration=Release 207 msbuild PACKAGE.vcxproj -property:Configuration=Release 208 msbuild INSTALL.vcxproj -property:Configuration=Release 209 ''' 210 } 211 } 212 stage('Build D Arm64') { 213 steps { 214 bat ''' 215 call c:\\progra~2\\micros~1\\2022\\buildtools\\vc\\auxiliary\\build\\vcvarsall.bat x64_arm64 216 mkdir build_dbg_arm64 217 cd build_dbg_arm64 218 cmake -G "Visual Studio 17 2022" -A ARM64 -T ClangCL -DASTCENC_ISA_NEON=ON .. 219 msbuild astcencoder.sln -property:Configuration=Debug 220 ''' 221 } 222 } 223 stage('Stash') { 224 steps { 225 dir('build_rel') { 226 stash name: 'astcenc-windows-x64-clangcl', includes: '*.zip' 227 } 228 dir('build_rel_arm64') { 229 stash name: 'astcenc-windows-arm64-clangcl', includes: '*.zip' 230 } 231 } 232 } 233 stage('Test') { 234 steps { 235 bat ''' 236 set Path=c:\\Python3;c:\\Python3\\Scripts;%Path% 237 call python ./Test/astc_test_image.py --test-set Small --test-quality medium 238 ''' 239 } 240 } 241 } 242 } 243 /* Build for macOS on x86-64 using Clang */ 244 stage('macOS') { 245 agent { 246 label 'mac && x86_64' 247 } 248 stages { 249 stage('Clean') { 250 steps { 251 sh 'git clean -ffdx' 252 } 253 } 254 stage('Build R') { 255 steps { 256 sh ''' 257 mkdir build_rel 258 cd build_rel 259 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64 .. 260 make install package -j4 261 ''' 262 } 263 } 264 stage('Build D') { 265 steps { 266 sh ''' 267 mkdir build_dbg 268 cd build_dbg 269 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DASTCENC_UNIVERSAL_BUILD=OFF -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_ISA_NONE=ON .. 270 make -j4 271 ''' 272 } 273 } 274 stage('Stash') { 275 steps { 276 dir('build_rel') { 277 stash name: 'astcenc-macos-x64', includes: '*.zip' 278 } 279 } 280 } 281 stage('Test') { 282 steps { 283 sh ''' 284 export PATH=/usr/local/bin:$PATH 285 python3 ./Test/astc_test_image.py --test-set Small --test-quality medium 286 ''' 287 } 288 } 289 } 290 } 291 } 292 } 293 stage('Artifactory') { 294 agent { 295 kubernetes { 296 yaml ''' 297apiVersion: v1 298kind: Pod 299spec: 300 securityContext: 301 runAsUser: 1000 302 runAsGroup: 1000 303 imagePullSecrets: 304 - name: artifactory-ms-docker 305 containers: 306 - name: astcenc 307 image: mobile-studio--docker.eu-west-1.artifactory.aws.arm.com/astcenc:3.0.0 308 command: 309 - sleep 310 args: 311 - infinity 312 resources: 313 requests: 314 cpu: 1 315 memory: 4Gi 316''' 317 defaultContainer 'astcenc' 318 } 319 } 320 options { 321 skipDefaultCheckout true 322 } 323 stages { 324 stage('Unstash') { 325 steps { 326 dir('upload/linux-x64') { 327 unstash 'astcenc-linux-x64' 328 } 329 dir('upload/windows-x64-cl') { 330 unstash 'astcenc-windows-x64-cl' 331 } 332 dir('upload/windows-x64-clangcl') { 333 unstash 'astcenc-windows-x64-clangcl' 334 } 335 dir('upload/windows-arm64-clangcl') { 336 unstash 'astcenc-windows-arm64-clangcl' 337 } 338 dir('upload/macos-x64') { 339 unstash 'astcenc-macos-x64' 340 } 341 } 342 } 343 stage('Upload') { 344 steps { 345 zip zipFile: 'astcenc.zip', dir: 'upload', archive: false 346 cepeArtifactoryUpload(sourcePattern: 'astcenc.zip') 347 } 348 } 349 } 350 post { 351 always { 352 deleteDir() 353 } 354 } 355 } 356 } 357 358 post { 359 failure { 360 script { 361 slackSend channel: '#dsg-eng-astcenc', color: 'danger', message: "Build ${JOB_NAME} ${BUILD_NUMBER} failed. (<${BUILD_URL}|Open>)", teamDomain: 'arm-dsg', tokenCredentialId: 'jenkins-slack', username: 'jenkins' 362 } 363 } 364 } 365} 366