Jenkins Test #16

This commit is contained in:
2025-10-08 18:30:36 +02:00
parent a2dc31f49c
commit 6680e4689b

64
Jenkinsfile vendored
View File

@@ -2,8 +2,8 @@ pipeline {
agent { label 'windows' } agent { label 'windows' }
parameters { parameters {
string(name: 'DISCORD_USER_ID', defaultValue: '378262266723696651', description: 'ID Discord pour les DMs') string(name: 'DISCORD_USER_ID', defaultValue: '378262266723696651', description: 'ID Discord pour recevoir les DMs')
choice(name: 'BUILD_TYPE', choices: ['Both', 'Debug', 'Release'], description: 'Type de build à lancer') choice(name: 'BUILD_TYPE', choices: ['Both', 'Debug', 'Release'], description: 'Type de build à utiliser')
} }
options { options {
@@ -18,29 +18,38 @@ pipeline {
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { checkout scm } steps {
checkout scm
}
} }
stage('Build') { stage('Build') {
when { expression { params.BUILD_TYPE in ['Both','Debug','Release'] } }
parallel { parallel {
stage('Build Debug') { stage('Build Debug') {
when { expression { params.BUILD_TYPE in ['Both','Debug'] } } when { expression { params.BUILD_TYPE in ['Both', 'Debug'] } }
steps { steps {
echo 'Building Debug...'
bat """ bat """
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^
"%WORKSPACE%\\KhaoticEngineReborn.sln" ^ "%WORKSPACE%\\KhaoticEngineReborn.sln" ^
/p:Configuration=Debug /p:Platform=x64 /m /verbosity:minimal /p:Configuration=Debug ^
/p:Platform=x64 ^
/m ^
/verbosity:minimal
""" """
} }
} }
stage('Build Release') { stage('Build Release') {
when { expression { params.BUILD_TYPE in ['Both','Release'] } } when { expression { params.BUILD_TYPE in ['Both', 'Release'] } }
steps { steps {
echo 'Building Release...'
bat """ bat """
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^
"%WORKSPACE%\\KhaoticEngineReborn.sln" ^ "%WORKSPACE%\\KhaoticEngineReborn.sln" ^
/p:Configuration=Release /p:Platform=x64 /m /verbosity:minimal /p:Configuration=Release ^
/p:Platform=x64 ^
/m ^
/verbosity:minimal
""" """
} }
} }
@@ -50,28 +59,22 @@ pipeline {
stage('Package') { stage('Package') {
parallel { parallel {
stage('Package Debug') { stage('Package Debug') {
when { expression { params.BUILD_TYPE in ['Both','Debug'] } } when { expression { params.BUILD_TYPE in ['Both', 'Debug'] } }
steps { steps {
powershell """ echo 'Packaging Debug into ZIP'
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) { bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null bat """
} powershell -Command "Compress-Archive -Path '%WORKSPACE%\\**\\Debug\\*' -DestinationPath '%WORKSPACE%\\builds\\KhaoticEngineReborn_Debug.zip' -Force"
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Debug\\*\" `
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Debug.zip\" `
-Force
""" """
} }
} }
stage('Package Release') { stage('Package Release') {
when { expression { params.BUILD_TYPE in ['Both','Release'] } } when { expression { params.BUILD_TYPE in ['Both', 'Release'] } }
steps { steps {
powershell """ echo 'Packaging Release into ZIP'
if (-Not (Test-Path \"${env.WORKSPACE}\\builds\")) { bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
New-Item -ItemType Directory -Path \"${env.WORKSPACE}\\builds\" | Out-Null bat """
} powershell -Command "Compress-Archive -Path '%WORKSPACE%\\**\\Release\\*' -DestinationPath '%WORKSPACE%\\builds\\KhaoticEngineReborn_Release.zip' -Force"
Compress-Archive -Path \"${env.WORKSPACE}\\**\\Release\\*\" `
-DestinationPath \"${env.WORKSPACE}\\builds\\KhaoticEngineReborn_Release.zip\" `
-Force
""" """
} }
} }
@@ -88,15 +91,14 @@ pipeline {
post { post {
success { success {
script { script {
def urls = [] def urlsList = []
if (params.BUILD_TYPE in ['Both','Debug']) { if (params.BUILD_TYPE in ['Both', 'Debug']) {
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip" urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip"
} }
if (params.BUILD_TYPE in ['Both','Release']) { if (params.BUILD_TYPE in ['Both', 'Release']) {
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip" urlsList << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip"
} }
// Construire le JSON correct pour l'envoi def urlsJson = urlsList.collect { "\"${it}\"" }.join(',')
def urlsJson = urls.collect { "\"${it}\"" }.join(',')
urlsJson = "[${urlsJson}]" urlsJson = "[${urlsJson}]"
bat """ bat """