Add Windows MSYS2 Jenkins build and testing support #1
All checks were successful
sgraves/cpp-build-system/pipeline/head This commit looks good
sgraves/cpp-build-system_mac/pipeline/head This commit looks good

This commit is contained in:
2025-10-18 11:26:39 -05:00
parent fe16d78ded
commit 60eec05fab
6 changed files with 302 additions and 1 deletions

77
src/.jenkins_msys2 Normal file
View File

@@ -0,0 +1,77 @@
#!groovy
pipeline {
agent none
environment {
PROJECT_TEST_CONFIG_DIR = "c:\\.ci\\%PROJECT_NAME%\\test"
}
options {
disableConcurrentBuilds()
skipDefaultCheckout()
timestamps()
}
stages {
// stage('Build • Test • Deliver')
stage('Build • Test') {
agent any
stages {
stage('Checkout') {
steps {
script {
int maxAttempts = 6
int baseDelay = 10
for (int attempt = 1; attempt <= maxAttempts; attempt++) {
try {
checkout scm
break
} catch (err) {
if (attempt == maxAttempts) { throw err }
int waitSec = baseDelay * (1 << (attempt - 1))
echo "Checkout failed (attempt ${attempt}/${maxAttempts}). Waiting ${waitSec}s before retry..."
sleep time: waitSec, unit: 'SECONDS'
}
}
}
}
}
stage('msys2_x86_64') {
steps { script { retryWithBackoff(2, 5) { cmd 'scripts\\make_win32.cmd x86_64' } } }
}
stage('test') {
steps {
script {
retryWithBackoff(2, 5) { cmd 'scripts\\run_tests.cmd x86_64' }
}
}
}
// stage('deliver') {
// steps {
// script {
// retryWithBackoff(3, 10) { cmd 'scripts\\deliver.cmd C:\\deliver\\%PROJECT_NAME% "" x86_64' }
// }
// }
// }
}
}
}
}
def retryWithBackoff(int maxAttempts, int baseDelaySeconds, Closure body) {
for (int attempt = 1; attempt <= maxAttempts; attempt++) {
try {
body()
return
} catch (err) {
if (attempt == maxAttempts) { throw err }
int waitSec = baseDelaySeconds * (1 << (attempt - 1))
echo "Step failed (attempt ${attempt}/${maxAttempts}). Waiting ${waitSec}s before retry..."
sleep time: waitSec, unit: 'SECONDS'
}
}
}