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

218
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') { ])
bat """
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
"${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m bat """
xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\" "${env.MSBUILD}" ".\\OTRExporter\\OTRExporter.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.OTRPLATFORM};PlatformToolset=${env.TOOLSET};RestorePackagesConfig=true /restore /nodeReuse:false /m
cd "OTRExporter" xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\"
"${env.PYTHON}" ".\\extract_assets.py"
cd "..\\" cd "OTRExporter"
"${env.PYTHON}" ".\\extract_assets.py"
"${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m cd "..\\"
cd OTRGui "${env.MSBUILD}" ".\\soh\\soh.sln" -t:build -p:Configuration=${env.CONFIG};Platform=${env.PLATFORM};PlatformToolset=${env.TOOLSET} /nodeReuse:false /m
mkdir build
cd build cd OTRGui
mkdir build
"${env.CMAKE}" .. cd build
"${env.CMAKE}" --build . --config Release
"${env.CMAKE}" ..
cd "..\\..\\" "${env.CMAKE}" --build . --config Release
move "soh\\Release\\soh.exe" ".\\" cd "..\\..\\"
move "OTRGui\\build\\assets" ".\\"
move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\" move "soh\\Release\\soh.exe" ".\\"
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\" move "OTRGui\\build\\assets" ".\\"
rename README.md readme.txt move ".\\OTRExporter\\x64\\Release\\ZAPD.exe" ".\\assets\\extractor\\"
move ".\\OTRGui\\build\\Release\\OTRGui.exe" ".\\"
"${env.ZIP}" a soh.7z soh.exe OTRGui.exe assets readme.txt rename README.md 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, cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
extensions: scm.extensions, docker build . -t soh
userRemoteConfigs: scm.userRemoteConfigs docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash
]) cp ../../buildsoh.bash soh
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { docker exec sohcont soh/buildsoh.bash
sh '''
mkdir build
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64 mv soh/soh.elf build/
docker build . -t soh mv OTRGui/build/OTRGui build/
docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash mv OTRGui/build/assets build/
cp ../../buildsoh.bash soh mv ZAPDTR/ZAPD.out build/assets/extractor/
docker exec sohcont soh/buildsoh.bash mv README.md build/readme.txt
cd build
mkdir build
mv soh/soh.elf build/
mv OTRGui/build/OTRGui build/
mv OTRGui/build/assets build/
mv ZAPDTR/ZAPD.out build/assets/extractor/
mv README.md build/readme.txt
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
}
}
} }
} }
} }