Jenkins Test #10
This commit is contained in:
41
Jenkinsfile
vendored
41
Jenkinsfile
vendored
@@ -1,7 +1,6 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'windows' }
|
agent { label 'windows' }
|
||||||
|
|
||||||
// 1. Déclare ici tes paramètres
|
|
||||||
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 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 à lancer')
|
||||||
@@ -19,28 +18,30 @@ pipeline {
|
|||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps { checkout scm }
|
||||||
checkout scm
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
when {
|
when { expression { params.BUILD_TYPE in ['Both','Debug','Release'] } }
|
||||||
expression { params.BUILD_TYPE in ['Both','Debug'] }
|
|
||||||
}
|
|
||||||
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" "%WORKSPACE%\\KhaoticEngineReborn.sln" /p:Configuration=Debug /p:Platform=x64 /m /verbosity:minimal'
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^
|
||||||
|
"%WORKSPACE%\\KhaoticEngineReborn.sln" ^
|
||||||
|
/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" "%WORKSPACE%\\KhaoticEngineReborn.sln" /p:Configuration=Release /p:Platform=x64 /m /verbosity:minimal'
|
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\MSBuild\\Current\\Bin\\MSBuild.exe" ^
|
||||||
|
"%WORKSPACE%\\KhaoticEngineReborn.sln" ^
|
||||||
|
/p:Configuration=Release /p:Platform=x64 /m /verbosity:minimal
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,17 +52,23 @@ pipeline {
|
|||||||
stage('Package Debug') {
|
stage('Package Debug') {
|
||||||
when { expression { params.BUILD_TYPE in ['Both','Debug'] } }
|
when { expression { params.BUILD_TYPE in ['Both','Debug'] } }
|
||||||
steps {
|
steps {
|
||||||
echo 'Packaging Debug into ZIP'
|
|
||||||
bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
|
bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
|
||||||
bat 'powershell -Command "Compress-Archive -Path ''%WORKSPACE%\\**\\Debug\\*'' -DestinationPath ''%WORKSPACE%\\builds\\KhaoticEngineReborn_Debug.zip'' -Force"'
|
bat """
|
||||||
|
powershell -Command ^
|
||||||
|
"Compress-Archive -Path \\\"%WORKSPACE%\\\\**\\\\Debug\\\\*\\\" ^
|
||||||
|
-DestinationPath \\\"%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 {
|
||||||
echo 'Packaging Release into ZIP'
|
|
||||||
bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
|
bat 'if not exist "%WORKSPACE%\\builds" mkdir "%WORKSPACE%\\builds"'
|
||||||
bat 'powershell -Command "Compress-Archive -Path ''%WORKSPACE%\\**\\Release\\*'' -DestinationPath ''%WORKSPACE%\\builds\\KhaoticEngineReborn_Release.zip'' -Force"'
|
bat """
|
||||||
|
powershell -Command ^
|
||||||
|
"Compress-Archive -Path \\\"%WORKSPACE%\\\\**\\\\Release\\\\*\\\" ^
|
||||||
|
-DestinationPath \\\"%WORKSPACE%\\\\builds\\\\KhaoticEngineReborn_Release.zip\\\" -Force"
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +84,6 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
script {
|
script {
|
||||||
// Liste les URLs selon le type
|
|
||||||
def urls = []
|
def urls = []
|
||||||
if (params.BUILD_TYPE in ['Both','Debug']) {
|
if (params.BUILD_TYPE in ['Both','Debug']) {
|
||||||
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip"
|
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Debug.zip"
|
||||||
@@ -85,11 +91,10 @@ pipeline {
|
|||||||
if (params.BUILD_TYPE in ['Both','Release']) {
|
if (params.BUILD_TYPE in ['Both','Release']) {
|
||||||
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip"
|
urls << "${env.BUILD_URL}artifact/builds/KhaoticEngineReborn_Release.zip"
|
||||||
}
|
}
|
||||||
// Envoi via ton bot
|
|
||||||
bat """
|
bat """
|
||||||
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
curl -X POST http://192.168.1.131:2500/ci-notify ^
|
||||||
-H "Content-Type: application/json" ^
|
-H "Content-Type: application/json" ^
|
||||||
-d "{\\"userId\\": \\"${params.DISCORD_USER_ID}\\",\\"status\\": \\"success\\",\\"urls\\":${groovy.json.JsonOutput.toJson(urls)}}"
|
-d "{\\"userId\\": \\"${params.DISCORD_USER_ID}\\",\\"status\\": \\"success\\",\\"urls\\":${groovy.json.JsonOutput.toJson(urls)}}"
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user