84 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			84 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
| pipeline {
 | |
|   agent {
 | |
|     dockerfile {
 | |
|       filename 'Dockerfile'
 | |
|       dir 'build'
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   parameters {
 | |
|     booleanParam(name: 'CLEAN', defaultValue: false, description: 'Clean build')
 | |
|     booleanParam(name: 'RUN_TESTS', defaultValue: true, description: 'Run tests')
 | |
|   }
 | |
| 
 | |
|   stages {
 | |
|     stage('Clean') {
 | |
|       when {
 | |
|         expression { params.CLEAN }
 | |
|       }
 | |
|       steps {
 | |
|         sh 'rm -rf cache/*'
 | |
|       }
 | |
|     }
 | |
|     stage('Prepare') {
 | |
|       steps
 | |
|       {
 | |
|         script
 | |
|         {
 | |
|           // generate the compile commands for clang-tidy to work with and update repositories (mijin)
 | |
|           sh 'scons -Q --unity=disable --compiler=clang compile_commands.json --update_repositories'
 | |
|         }
 | |
|       }
 | |
|     }
 | |
|     stage('Clang-Tidy') {
 | |
|       when {
 | |
|         expression { params.RUN_TESTS }
 | |
|       }
 | |
|       steps {
 | |
|         warnError('clang-tidy found problems.') {
 | |
|             sh 'bash build/scripts/clang-tidy.sh'
 | |
|         }
 | |
|       }
 | |
|     }
 | |
|     stage('Build Linux Clang') {
 | |
|       steps {
 | |
|         sh 'scons -j8 --build_type=debug --variant=linux_clang_debug --compiler=clang'
 | |
|         sh 'scons -j8 --build_type=release_debug --variant=linux_clang_release_debug --compiler=clang'
 | |
|         sh 'scons -j8 --build_type=release --variant=linux_clang_release --compiler=clang'
 | |
|       }
 | |
|     }
 | |
|     stage('Build Linux GCC') {
 | |
|       steps {
 | |
|         script {
 | |
|           def config = 'CC="gcc-13"\nCXX="g++-13"'
 | |
|           writeFile file: 'config.py', text: config
 | |
|         }
 | |
|         sh 'scons -j8 --build_type=debug --variant=linux_gcc_debug'
 | |
|         sh 'scons -j8 --build_type=release_debug --variant=linux_gcc_release_debug'
 | |
|         sh 'scons -j8 --build_type=release --variant=linux_gcc_release'
 | |
|       }
 | |
|     }
 | |
|     stage('Archive') {
 | |
|       steps {
 | |
|         archiveArtifacts artifacts: 'bin_*/*',
 | |
|                          fingerprint: true,
 | |
|                          onlyIfSuccessful: true
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   post {
 | |
|     failure {
 | |
|       mail from:     'Jenkins <noreply@mewin.de>',
 | |
|            to:       'buildresult@mewin.de',
 | |
|            cc:       '',
 | |
|            bcc:      '',
 | |
|            subject:  "Jenkins Build Error (${env.JOB_NAME})",
 | |
|            body:     "<b>Build Failure</b><br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> Build URL: ${env.BUILD_URL}",
 | |
|            charset:  'UTF-8',
 | |
|            mimeType: 'text/html',
 | |
|            replyTo:  '';
 | |
|     }
 | |
|   }
 | |
| }
 |