Jenkinsfile: Use the matrix directive
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
		
							parent
							
								
									3cf67d3445
								
							
						
					
					
						commit
						bf1cea3e77
					
				
							
								
								
									
										71
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										71
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							| @ -6,6 +6,7 @@ def buildTarget(String path, String cmake_toolchain = '', boolean should_package | |||||||
|     final String build_directory = "cmake-build-${path}" |     final String build_directory = "cmake-build-${path}" | ||||||
|     final boolean not_packer_compatible = path.contains('riscv') || (path.contains('aarch64') && path.contains('mingw')) |     final boolean not_packer_compatible = path.contains('riscv') || (path.contains('aarch64') && path.contains('mingw')) | ||||||
|     final boolean use_toolchain = cmake_toolchain != '' |     final boolean use_toolchain = cmake_toolchain != '' | ||||||
|  |     catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { | ||||||
|         // Note: CMake 3.20 or higher is needed |         // Note: CMake 3.20 or higher is needed | ||||||
|         cmakeBuild buildDir: build_directory, buildType: 'release', cleanBuild: true, installation: 'Latest', |         cmakeBuild buildDir: build_directory, buildType: 'release', cleanBuild: true, installation: 'Latest', | ||||||
|             cmakeArgs: "--no-warn-unused-cli ${use_toolchain ? "-DCMAKE_TOOLCHAIN_FILE=${cmake_toolchain}" : "-DCMAKE_SYSTEM_NAME=\"${system_name}\" -DCMAKE_SYSTEM_PROCESSOR=\"${path.substring(0, path.indexOf('-'))}\" -DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=${fileExists("${linker}.gold") ? "${linker}.gold" : linker} -DCMAKE_AR=/usr/bin/${path}-ar -DCMAKE_RC_COMPILER=/usr/bin/${path}-windres -DCMAKE_EXE_LINKER_FLAGS=-static"} -DNO_SELF_PACKER=${!(not_packer_compatible || use_toolchain) ? "OFF" : "ON"} -DIGNORE_MINIMAL_COMPILER_VERSION=ON -DNO_CCACHE=ON -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON", |             cmakeArgs: "--no-warn-unused-cli ${use_toolchain ? "-DCMAKE_TOOLCHAIN_FILE=${cmake_toolchain}" : "-DCMAKE_SYSTEM_NAME=\"${system_name}\" -DCMAKE_SYSTEM_PROCESSOR=\"${path.substring(0, path.indexOf('-'))}\" -DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=${fileExists("${linker}.gold") ? "${linker}.gold" : linker} -DCMAKE_AR=/usr/bin/${path}-ar -DCMAKE_RC_COMPILER=/usr/bin/${path}-windres -DCMAKE_EXE_LINKER_FLAGS=-static"} -DNO_SELF_PACKER=${!(not_packer_compatible || use_toolchain) ? "OFF" : "ON"} -DIGNORE_MINIMAL_COMPILER_VERSION=ON -DNO_CCACHE=ON -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON", | ||||||
| @ -14,6 +15,11 @@ def buildTarget(String path, String cmake_toolchain = '', boolean should_package | |||||||
|         if (should_package) { |         if (should_package) { | ||||||
|             cpack installation: 'Latest', workingDir: build_directory |             cpack installation: 'Latest', workingDir: build_directory | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | def upload_archives() { | ||||||
|  |     archiveArtifacts artifacts: 'cmake-build-*/*.deb, cmake-build-*/*.rpm, cmake-build-*/*.tar.gz, cmake-build-*/*.sh, cmake-build-*/*.js, cmake-build-*/*Windows.*.exe, cmake-build-*/*.zip', fingerprint: false | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Required Plugins: | /* Required Plugins: | ||||||
| @ -45,45 +51,52 @@ pipeline { | |||||||
|     } |     } | ||||||
|     stages { |     stages { | ||||||
|         stage('Build') { |         stage('Build') { | ||||||
|  |             matrix { | ||||||
|  |                 agent any | ||||||
|  |                 axes { | ||||||
|  |                     axis { | ||||||
|  |                         name 'TARGET' | ||||||
|  |                         values( | ||||||
|  |                             'x86_64-linux-musl', | ||||||
|  |                             'i686-linux-musl', | ||||||
|  |                             'armel-linux-musleabi', | ||||||
|  |                             'armv7l-linux-musleabihf', | ||||||
|  |                             'aarch64-linux-musl', | ||||||
|  |                             'riscv64-linux-gnu', | ||||||
|  |                             'x86_64-w64-mingw32', | ||||||
|  |                             'i686-w64-mingw32', | ||||||
|  |                             'armv7-w64-mingw32', | ||||||
|  |                             'aarch64-w64-mingw32' | ||||||
|  |                         ) | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 stages { | ||||||
|  |                     stage('Compile and package') { | ||||||
|                         steps { |                         steps { | ||||||
|                 echo "Building the ${env.BRANCH_NAME} branch.." |                             buildTarget("${TARGET}") | ||||||
|                 buildTarget('x86_64-linux-musl') |  | ||||||
|                 buildTarget('i686-linux-musl') |  | ||||||
|                 buildTarget('emscripten', '/usr/share/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake', false) |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         stage('Build for other architectures') { |  | ||||||
|             steps { |  | ||||||
|                 catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { |  | ||||||
|                     buildTarget('armel-linux-musleabi') |  | ||||||
|                     buildTarget('armv7l-linux-musleabihf') |  | ||||||
|                     buildTarget('aarch64-linux-musl') |  | ||||||
|                     buildTarget('riscv64-linux-gnu') |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         stage('Build for other platforms') { |  | ||||||
|             steps { |  | ||||||
|                 catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { |  | ||||||
|                     buildTarget('armv7-w64-mingw32') |  | ||||||
|                     buildTarget('aarch64-w64-mingw32') |  | ||||||
|                 } |  | ||||||
|                 catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { |  | ||||||
|                     buildTarget('x86_64-w64-mingw32') |  | ||||||
|                     buildTarget('i686-w64-mingw32') |  | ||||||
|                 } |  | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                     stage('Deploy') { |                     stage('Deploy') { | ||||||
|                         steps { |                         steps { | ||||||
|                             echo 'Deploying....' |                             echo 'Deploying....' | ||||||
|                 archiveArtifacts artifacts: 'cmake-build-*/*.deb, cmake-build-*/*.rpm, cmake-build-*/*.tar.gz, cmake-build-*/*.sh, cmake-build-*/*.js', fingerprint: false |                             upload_archives() | ||||||
|                 catchError(buildResult: currentBuild.result, stageResult: 'SUCCESS') { |  | ||||||
|                     archiveArtifacts artifacts: 'cmake-build-*/*Windows.*.exe, cmake-build-*/*.zip' |  | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |         } | ||||||
|  |         stage('Build using Emscripten') { | ||||||
|  |             steps { | ||||||
|  |                 buildTarget('emscripten', '/usr/share/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake', false) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         stage('Deploy') { | ||||||
|  |             steps { | ||||||
|  |                 echo 'Deploying....' | ||||||
|  |                 upload_archives() | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     post { |     post { | ||||||
|         always { |         always { | ||||||
|             cleanWs(cleanWhenNotBuilt: false, deleteDirs: true, disableDeferredWipeout: false, notFailBuild: true, skipWhenFailed: false) |             cleanWs(cleanWhenNotBuilt: false, deleteDirs: true, disableDeferredWipeout: false, notFailBuild: true, skipWhenFailed: false) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user