Enable parallel stages on Jenkins (#476)

This commit is contained in:
David Chavez 2022-06-18 15:43:16 +02:00 committed by GitHub
parent 8d4b15325a
commit 1763d0bfce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

190
Jenkinsfile vendored
View file

@ -7,115 +7,119 @@ pipeline {
} }
stages { stages {
stage ('Build Windows') { stage('Build SoH') {
options { parallel {
timeout(time: 20) stage ('Build Windows') {
} options {
environment { timeout(time: 20)
MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe' }
CONFIG='Release' environment {
OTRPLATFORM='x64' MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe'
PLATFORM='x86' CONFIG='Release'
ZIP='C:\\Program Files\\7-Zip\\7z.exe' OTRPLATFORM='x64'
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe' PLATFORM='x86'
CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe' ZIP='C:\\Program Files\\7-Zip\\7z.exe'
TOOLSET='v142' PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
} CMAKE='C:\\Program Files\\CMake\\bin\\cmake.exe'
agent { TOOLSET='v142'
label "SoH-Builders" }
} agent {
steps { label "SoH-Builders"
checkout([ }
$class: 'GitSCM', steps {
branches: scm.branches, checkout([
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations, $class: 'GitSCM',
extensions: scm.extensions, branches: scm.branches,
userRemoteConfigs: scm.userRemoteConfigs doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
]) extensions: scm.extensions,
userRemoteConfigs: scm.userRemoteConfigs
])
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
bat """ bat """
"${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m "${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m
xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\" xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\"
cd "OTRExporter" cd "OTRExporter"
"${env.PYTHON}" ".\\extract_assets.py" "${env.PYTHON}" ".\\extract_assets.py"
cd "..\\" cd "..\\"
"${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m "${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m
cd OTRGui cd OTRGui
mkdir build mkdir build
cd build cd build
"${env.CMAKE}" .. "${env.CMAKE}" ..
"${env.CMAKE}" --build . --config Release "${env.CMAKE}" --build . --config Release
cd "..\\..\\" cd "..\\..\\"
move "soh\\Release\\soh.exe" ".\\" move "soh\\Release\\soh.exe" ".\\"
move "OTRGui\\build\\assets" ".\\" move "OTRGui\\build\\assets" ".\\"
move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\" move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\"
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\" move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\"
rename README.md readme.txt rename README.md readme.txt
"${env.ZIP}" a soh.7z soh.exe OTRGui.exe assets readme.txt "${env.ZIP}" a soh.7z soh.exe OTRGui.exe assets readme.txt
""" """
archiveArtifacts artifacts: 'soh.7z', followSymlinks: false, onlyIfSuccessful: true archiveArtifacts artifacts: 'soh.7z', followSymlinks: false, onlyIfSuccessful: true
}
}
post {
always {
step([$class: 'WsCleanup']) // Clean workspace
}
}
} }
} stage ('Build Linux') {
post { options {
always { timeout(time: 20)
step([$class: 'WsCleanup']) // Clean workspace }
} agent {
} label "SoH-Linux-Builders"
} }
stage ('Build Linux') { steps {
options { checkout([
timeout(time: 20) $class: 'GitSCM',
} branches: scm.branches,
agent { doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
label "SoH-Linux-Builders" extensions: scm.extensions,
} userRemoteConfigs: scm.userRemoteConfigs
steps { ])
checkout([ catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
$class: 'GitSCM', sh '''
branches: scm.branches,
doGenerateSubmoduleConfigurations: scm.doGenerateSubmoduleConfigurations,
extensions: scm.extensions,
userRemoteConfigs: scm.userRemoteConfigs
])
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh '''
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
docker build . -t soh docker build . -t soh
docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash
cp ../../buildsoh.bash soh cp ../../buildsoh.bash soh
docker exec sohcont soh/buildsoh.bash docker exec sohcont soh/buildsoh.bash
mkdir build mkdir build
mv soh/soh.elf build/ mv soh/soh.elf build/
mv OTRGui/build/OTRGui build/ mv OTRGui/build/OTRGui build/
mv OTRGui/build/assets build/ mv OTRGui/build/assets build/
mv ZAPDTR/ZAPD.out build/assets/extractor/ mv ZAPDTR/ZAPD.out build/assets/extractor/
mv README.md build/readme.txt mv README.md build/readme.txt
cd build cd build
7z a soh-linux.7z soh.elf OTRGui assets readme.txt 7z a soh-linux.7z soh.elf OTRGui assets readme.txt
mv soh-linux.7z ../ mv soh-linux.7z ../
''' '''
} }
sh 'sudo docker container stop sohcont' sh 'sudo docker container stop sohcont'
archiveArtifacts artifacts: 'soh-linux.7z', followSymlinks: false, onlyIfSuccessful: true archiveArtifacts artifacts: 'soh-linux.7z', followSymlinks: false, onlyIfSuccessful: true
} }
post { post {
always { always {
step([$class: 'WsCleanup']) // Clean workspace step([$class: 'WsCleanup']) // Clean workspace
}
}
} }
} }
} }