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.1.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') { 71 steps { 72 sh ''' 73 mkdir build_rel 74 cd build_rel 75 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON -DUNITTEST=ON -DPACKAGE=x64 .. 76 make install package -j4 77 ''' 78 } 79 } 80 stage('Build D') { 81 steps { 82 sh ''' 83 mkdir build_dbg 84 cd build_dbg 85 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_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=all-x86 --test-set Small --test-quality medium 105 ''' 106 dir('build_rel') { 107 sh 'ctest' 108 } 109 } 110 } 111 } 112 } 113 /* Build for Windows on x86-64 using MSVC */ 114 stage('Windows MSVC') { 115 agent { 116 label 'Windows' 117 } 118 stages { 119 stage('Clean') { 120 steps { 121 bat 'git clean -ffdx' 122 } 123 } 124 stage('Build R') { 125 steps { 126 bat ''' 127 call c:\\progra~2\\micros~1\\2019\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 128 mkdir build_rel 129 cd build_rel 130 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64-cl .. 131 nmake install package 132 ''' 133 } 134 } 135 stage('Build D') { 136 steps { 137 bat ''' 138 call c:\\progra~2\\micros~1\\2019\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 139 mkdir build_dbg 140 cd build_dbg 141 cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON .. 142 nmake 143 ''' 144 } 145 } 146 stage('Stash') { 147 steps { 148 dir('build_rel') { 149 stash name: 'astcenc-windows-x64-cl', includes: '*.zip' 150 } 151 } 152 } 153 stage('Test') { 154 steps { 155 bat ''' 156 set Path=c:\\Python38;c:\\Python38\\Scripts;%Path% 157 call python ./Test/astc_test_image.py --test-set Small --test-quality medium 158 ''' 159 } 160 } 161 } 162 } 163 /* Build for Windows on x86-64 using MSVC + ClangCL */ 164 stage('Windows ClangCL') { 165 agent { 166 label 'Windows' 167 } 168 stages { 169 stage('Clean') { 170 steps { 171 bat 'git clean -ffdx' 172 } 173 } 174 stage('Build R') { 175 steps { 176 bat ''' 177 call c:\\progra~2\\micros~1\\2019\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 178 mkdir build_rel 179 cd build_rel 180 cmake -G "Visual Studio 16 2019" -T ClangCL -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64-clangcl .. 181 msbuild astcencoder.sln -property:Configuration=Release 182 msbuild PACKAGE.vcxproj -property:Configuration=Release 183 msbuild INSTALL.vcxproj -property:Configuration=Release 184 ''' 185 } 186 } 187 stage('Build D') { 188 steps { 189 bat ''' 190 call c:\\progra~2\\micros~1\\2019\\buildtools\\vc\\auxiliary\\build\\vcvars64.bat 191 mkdir build_dbg 192 cd build_dbg 193 cmake -G "Visual Studio 16 2019" -T ClangCL -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON .. 194 msbuild astcencoder.sln -property:Configuration=Debug 195 ''' 196 } 197 } 198 stage('Stash') { 199 steps { 200 dir('build_rel') { 201 stash name: 'astcenc-windows-x64-clangcl', includes: '*.zip' 202 } 203 } 204 } 205 stage('Test') { 206 steps { 207 bat ''' 208 set Path=c:\\Python38;c:\\Python38\\Scripts;%Path% 209 call python ./Test/astc_test_image.py --test-set Small --test-quality medium 210 ''' 211 } 212 } 213 } 214 } 215 /* Build for macOS on x86-64 using Clang */ 216 stage('macOS') { 217 agent { 218 label 'mac' 219 } 220 stages { 221 stage('Clean') { 222 steps { 223 sh 'git clean -ffdx' 224 } 225 } 226 stage('Build R') { 227 steps { 228 sh ''' 229 mkdir build_rel 230 cd build_rel 231 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DPACKAGE=x64 .. 232 make install package -j4 233 ''' 234 } 235 } 236 stage('Build D') { 237 steps { 238 sh ''' 239 mkdir build_dbg 240 cd build_dbg 241 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DISA_AVX2=ON -DISA_SSE41=ON -DISA_SSE2=ON -DISA_NONE=ON .. 242 make -j4 243 ''' 244 } 245 } 246 stage('Stash') { 247 steps { 248 dir('build_rel') { 249 stash name: 'astcenc-macos-x64', includes: '*.zip' 250 } 251 } 252 } 253 stage('Test') { 254 steps { 255 sh ''' 256 export PATH=/usr/local/bin:$PATH 257 python3 ./Test/astc_test_image.py --test-set Small --test-quality medium 258 ''' 259 } 260 } 261 } 262 } 263 } 264 } 265 stage('Artifactory') { 266 agent { 267 kubernetes { 268 yaml ''' 269apiVersion: v1 270kind: Pod 271spec: 272 securityContext: 273 runAsUser: 1000 274 runAsGroup: 1000 275 imagePullSecrets: 276 - name: artifactory-ms-docker 277 containers: 278 - name: astcenc 279 image: mobile-studio--docker.eu-west-1.artifactory.aws.arm.com/astcenc:3.0.0 280 command: 281 - sleep 282 args: 283 - infinity 284 resources: 285 requests: 286 cpu: 1 287 memory: 4Gi 288''' 289 defaultContainer 'astcenc' 290 } 291 } 292 options { 293 skipDefaultCheckout true 294 } 295 stages { 296 stage('Unstash') { 297 steps { 298 dir('upload/linux-x64') { 299 unstash 'astcenc-linux-x64' 300 } 301 dir('upload/windows-x64-cl') { 302 unstash 'astcenc-windows-x64-cl' 303 } 304 dir('upload/windows-x64-clangcl') { 305 unstash 'astcenc-windows-x64-clangcl' 306 } 307 dir('upload/macos-x64') { 308 unstash 'astcenc-macos-x64' 309 } 310 } 311 } 312 stage('Upload') { 313 steps { 314 zip zipFile: 'astcenc.zip', dir: 'upload', archive: false 315 cepeArtifactoryUpload(sourcePattern: 'astcenc.zip') 316 } 317 } 318 } 319 post { 320 always { 321 deleteDir() 322 } 323 } 324 } 325 } 326 327 post { 328 failure { 329 script { 330 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' 331 } 332 } 333 } 334} 335