[ci] Share Generated Assets Across All Platforms (#1074)

This commit is contained in:
David Chavez 2022-08-09 00:02:35 +02:00 committed by GitHub
parent 9afbe42720
commit 9b33827d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 29 deletions

56
Jenkinsfile vendored
View File

@ -8,12 +8,35 @@ pipeline {
} }
stages { stages {
stage('Generate Assets') {
options {
timeout(time: 10)
}
agent {
label "SoH-Mac-Builders"
}
steps {
checkout([
$class: 'GitSCM',
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
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-cmake --target ExtractAssets --config Release
'''
stash includes: 'soh/assets/**/*', name: 'assets'
}
}
}
stage('Build SoH') { stage('Build SoH') {
parallel { parallel {
stage ('Build Windows') { stage ('Build Windows') {
options {
timeout(time: 20)
}
environment { environment {
PLATFORM='x64' PLATFORM='x64'
PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe' PYTHON='C:\\Users\\jenkins\\AppData\\Local\\Programs\\Python\\Python310\\python.exe'
@ -34,12 +57,9 @@ pipeline {
]) ])
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
bat """ unstash 'assets'
bat """
xcopy "..\\..\\ZELOOTD.z64" "OTRExporter\\" "${env.CMAKE}" -S . -B "build\\${env.PLATFORM}" -G "Visual Studio 17 2022" -T ${env.TOOLSET} -A ${env.PLATFORM} -D Python_EXECUTABLE=${env.PYTHON} -D CMAKE_BUILD_TYPE:STRING=Release
"${env.CMAKE}" -S . -B "build\\${env.PLATFORM}" -G "Visual Studio 17 2022" -T ${env.TOOLSET} -A ${env.PLATFORM} -D Python3_EXECUTABLE=${env.PYTHON} -D CMAKE_BUILD_TYPE:STRING=Release
"${env.CMAKE}" --build ".\\build\\${env.PLATFORM}" --target ExtractAssets --config Release
"${env.CMAKE}" --build ".\\build\\${env.PLATFORM}" --config Release "${env.CMAKE}" --build ".\\build\\${env.PLATFORM}" --config Release
cd ".\\build\\${env.PLATFORM}" cd ".\\build\\${env.PLATFORM}"
"${env.CPACK}" -G ZIP "${env.CPACK}" -G ZIP
@ -57,9 +77,6 @@ pipeline {
} }
} }
stage ('Build Linux') { stage ('Build Linux') {
options {
timeout(time: 20)
}
agent { agent {
label "SoH-Linux-Builders" label "SoH-Linux-Builders"
} }
@ -72,9 +89,8 @@ pipeline {
userRemoteConfigs: scm.userRemoteConfigs userRemoteConfigs: scm.userRemoteConfigs
]) ])
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
unstash 'assets'
sh ''' sh '''
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
docker exec sohcont scripts/linux/appimage/build.sh docker exec sohcont scripts/linux/appimage/build.sh
@ -108,11 +124,9 @@ pipeline {
userRemoteConfigs: scm.userRemoteConfigs userRemoteConfigs: scm.userRemoteConfigs
]) ])
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
unstash 'assets'
sh ''' sh '''
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
cmake --build build-cmake --target ExtractAssets --
cmake --build build-cmake --config Release -- cmake --build build-cmake --config Release --
(cd build-cmake && cpack) (cd build-cmake && cpack)
@ -131,9 +145,6 @@ pipeline {
} }
} }
stage ('Build Switch') { stage ('Build Switch') {
options {
timeout(time: 20)
}
agent { agent {
label "SoH-Linux-Builders" label "SoH-Linux-Builders"
} }
@ -146,9 +157,8 @@ pipeline {
userRemoteConfigs: scm.userRemoteConfigs userRemoteConfigs: scm.userRemoteConfigs
]) ])
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') { catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
sh ''' unstash 'assets'
sh '''
cp ../../ZELOOTD.z64 OTRExporter/baserom_non_mq.z64
docker build . -t sohswitch docker build . -t sohswitch
docker run --name sohcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash docker run --name sohcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash
docker exec sohcont scripts/switch/build.sh docker exec sohcont scripts/switch/build.sh

View File

@ -348,11 +348,14 @@ std::string ZResource::GetSourceOutputHeader([[maybe_unused]] const std::string&
str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str()); str += StringHelper::Sprintf("#define d%s \"__OTR__%s/%s\"", name.c_str(), outName.c_str(), nameStr.c_str());
if (nameSet && nameSet->find(name) == nameSet->end()) { if (nameSet && nameSet->find(name) == nameSet->end()) {
str += StringHelper::Sprintf(R"(
#ifdef _WIN32 #ifdef _WIN32
str += StringHelper::Sprintf("\nstatic const __declspec(align(2)) char %s[] = d%s;", name.c_str(), name.c_str()); static const __declspec(align(2)) char %s[] = d%s;
#else #else
str += StringHelper::Sprintf("\nstatic const char %s[] __attribute__((aligned (2))) = d%s;", name.c_str(), name.c_str()); static const char %s[] __attribute__((aligned (2))) = d%s;
#endif #endif
)", name.c_str(), name.c_str(), name.c_str(), name.c_str());
if (nameSet) { if (nameSet) {
nameSet->insert(name); nameSet->insert(name);
} }

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release
cmake --build build-cmake --target ExtractAssets --
cmake --build build-cmake --config Release -- cmake --build build-cmake --config Release --
(cd build-cmake && cpack -G External) (cd build-cmake && cpack -G External)

View File

@ -1,7 +1,4 @@
#!/bin/bash #!/bin/bash
cmake --no-warn-unused-cli -H. -Bbuild-linux -GNinja
cmake --build build-linux --target ExtractAssets
cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
cmake --build build-switch --target soh_nro cmake --build build-switch --target soh_nro