Skip to content

Commit

Permalink
parallelize
Browse files Browse the repository at this point in the history
  • Loading branch information
carstene1ns committed Dec 3, 2023
1 parent 277b235 commit 33af21c
Showing 1 changed file with 140 additions and 136 deletions.
276 changes: 140 additions & 136 deletions liblcf/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,154 +8,158 @@ pipeline {
}
agent none
stages {
stage('BuildAndPackage') {
matrix {
agent {
label "${PLATFORM}"
}
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == env.PLATFORM }
} }
axes {
axis {
name 'PLATFORM'
values '3DS', 'Switch', 'PSVita', 'Wii', 'WiiU'
}
}
environment {
EASYRPG_BUILDSCRIPTS="${WORKSPACE}/../toolchain-${PLATFORM.toLowerCase()}"
}
stages {
stage('Prepare') {
steps {
dir('lcf') {
git url: 'https://github.com/EasyRPG/liblcf.git'
}
sh "rm -rf build-${PLATFORM}"
stage('Global') {
parallel {
stage('Build Ports') {
matrix {
agent {
label "${PLATFORM}"
}
}
stage('Build') {
steps {
echo "Build for ${PLATFORM}"
/*script {
PRESET = sh(script: "echo ${PLATFORM} | tr '[:upper:]' '[:lower:]'", returnStdout: true).trim()
}*/
sh label: 'cmake', script: """
cmake --preset ${PLATFORM.toLowerCase()}-relwithdebinfo -B build-${PLATFORM} -S lcf \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLIBLCF_WITH_XML=OFF -DLIBLCF_ENABLE_TOOLS=OFF -DLIBLCF_ENABLE_TESTS=OFF
cmake --build build-${PLATFORM}
"""
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == env.PLATFORM }
} }
axes {
axis {
name 'PLATFORM'
values '3DS', 'Switch', 'PSVita', 'Wii', 'WiiU'
}
}
}
stage('Install') {
steps {
echo "Install for ${PLATFORM}"
sh "cmake --install build-${PLATFORM} --prefix ${PLATFORM.toLowerCase()}"
environment {
EASYRPG_BUILDSCRIPTS="${WORKSPACE}/../toolchain-${PLATFORM.toLowerCase()}"
}
}
}
}
}
stage('Build Linux') {
agent any
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == 'Linux' }
} }
environment {
EASYRPG_BUILDSCRIPTS="${WORKSPACE}/../toolchain-linux-static"
}
stages {
stage('Prepare') {
steps {
dir('lcf') {
git url: 'https://github.com/EasyRPG/liblcf.git'
stages {
stage('Prepare') {
steps {
dir('lcf') {
git url: 'https://github.com/EasyRPG/liblcf.git'
}
sh "rm -rf build-${PLATFORM}"
}
}
stage('Build') {
steps {
echo "Build for ${PLATFORM}"
/*script {
PRESET = sh(script: "echo ${PLATFORM} | tr '[:upper:]' '[:lower:]'", returnStdout: true).trim()
}*/
sh label: 'cmake', script: """
cmake --preset ${PLATFORM.toLowerCase()}-relwithdebinfo -B build-${PLATFORM} -S lcf \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLIBLCF_WITH_XML=OFF -DLIBLCF_ENABLE_TOOLS=OFF -DLIBLCF_ENABLE_TESTS=OFF
cmake --build build-${PLATFORM}
"""
}
}
stage('Install') {
steps {
echo "Install for ${PLATFORM}"
sh "cmake --install build-${PLATFORM} --prefix ${PLATFORM.toLowerCase()}"
}
}
}
sh "rm -rf build-linux"
}
}
stage('Build') {
steps {
echo "Build for Linux"
sh label: 'cmake', script: """
cmake --preset linux-relwithdebinfo -B build-linux -S lcf \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLIBLCF_WITH_XML=ON -DLIBLCF_ENABLE_TOOLS=ON -DLIBLCF_ENABLE_TESTS=ON
cmake --build build-linux
"""
}
}
stage('Test') {
steps {
echo "Test for Linux"
sh "cmake --build build-linux --target check"
}
}
stage('Install') {
steps {
echo "Install for Linux"
sh "cmake --install build-linux --prefix linux"
}
}
}
}
stage('Build for Windows') {
matrix {
agent {
label 'Windows'
}
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == "Windows ${env.BITS} bit" }
} }
axes {
axis {
name 'BITS'
values '32', '64'
stage('Build Linux') {
agent any
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == 'Linux' }
} }
environment {
EASYRPG_BUILDSCRIPTS="${WORKSPACE}/../toolchain-linux-static"
}
axis {
name 'CONFIG'
values 'debug', 'release'
}
}
stages {
stage('Prepare') {
steps {
dir('lcf') {
git url: 'https://github.com/EasyRPG/liblcf.git'
stages {
stage('Prepare') {
steps {
dir('lcf') {
git url: 'https://github.com/EasyRPG/liblcf.git'
}
sh "rm -rf build-linux"
}
bat "if exist 'build-${BITS}' rd /S /Q 'build-${BITS}'"
}
}
stage('Build') {
steps {
echo "Build for Windows ${BITS} bit - ${CONFIG}"
bat label: 'cmake', script: """
if ${BITS}==32 (SET arg=amd64_x86) else (SET arg=x64)
call %VCVARSALL2017% %arg%
if ${CONFIG}==debug (SET type=Debug) else (SET type=RelWithDebInfo)
if ${BITS}==32 (SET triplet=x86-windows-static) else (SET triplet=x64-windows-static)
cmake . -GNinja -B${CONFIG} -DCMAKE_BUILD_TYPE=%type% ^
-DSHARED_RUNTIME=OFF -DVCPKG_TARGET_TRIPLET=%triplet%^
-DCMAKE_TOOLCHAIN_FILE="%EASYDEV_VCPKG%\\scripts\\buildsystems\\vcpkg.cmake"^
-DBUILD_SHARED_LIBS=OFF^
-DCMAKE_INSTALL_PREFIX="%CD%\\build-${BITS}"
"""
stage('Build') {
steps {
echo "Build for Linux"
sh label: 'cmake', script: """
cmake --preset linux-relwithdebinfo -B build-linux -S lcf \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLIBLCF_WITH_XML=ON -DLIBLCF_ENABLE_TOOLS=ON -DLIBLCF_ENABLE_TESTS=ON
cmake --build build-linux
"""
}
}
}
stage('Test') {
steps {
echo "Test for Windows ${BITS} bit - ${CONFIG}"
bat "cmake --build ${CONFIG} --target check"
stage('Test') {
steps {
echo "Test for Linux"
sh "cmake --build build-linux --target check"
}
}
stage('Install') {
steps {
echo "Install for Linux"
sh "cmake --install build-linux --prefix linux"
}
}
}
stage('Install') {
steps {
echo "Install for Windows ${BITS} bit - ${CONFIG}"
bat "cmake --build ${CONFIG} --target install"
}
stage('Build for Windows') {
matrix {
agent {
label 'Windows'
}
when { anyOf {
expression { params.PLATFORM_FILTER == 'all' }
expression { params.PLATFORM_FILTER == "Windows ${env.BITS} bit" }
} }
axes {
axis {
name 'BITS'
values '32', '64'
}
axis {
name 'CONFIG'
values 'debug', 'release'
}
}
stages {
stage('Prepare') {
steps {
dir('lcf') {
git url: 'https://github.com/EasyRPG/liblcf.git'
}
bat "if exist 'build-${BITS}' rd /S /Q 'build-${BITS}'"
}
}
stage('Build') {
steps {
echo "Build for Windows ${BITS} bit - ${CONFIG}"
bat label: 'cmake', script: """
if ${BITS}==32 (SET arg=amd64_x86) else (SET arg=x64)
call %VCVARSALL2017% %arg%
if ${CONFIG}==debug (SET type=Debug) else (SET type=RelWithDebInfo)
if ${BITS}==32 (SET triplet=x86-windows-static) else (SET triplet=x64-windows-static)
cmake . -GNinja -B${CONFIG} -DCMAKE_BUILD_TYPE=%type% ^
-DSHARED_RUNTIME=OFF -DVCPKG_TARGET_TRIPLET=%triplet%^
-DCMAKE_TOOLCHAIN_FILE="%EASYDEV_VCPKG%\\scripts\\buildsystems\\vcpkg.cmake"^
-DBUILD_SHARED_LIBS=OFF^
-DCMAKE_INSTALL_PREFIX="%CD%\\build-${BITS}"
"""
}
}
stage('Test') {
steps {
echo "Test for Windows ${BITS} bit - ${CONFIG}"
bat "cmake --build ${CONFIG} --target check"
}
}
stage('Install') {
steps {
echo "Install for Windows ${BITS} bit - ${CONFIG}"
bat "cmake --build ${CONFIG} --target install"
}
}
}
}
}
Expand Down

0 comments on commit 33af21c

Please sign in to comment.