Files
cpp-build-system/src/.jenkins_builds
Scott E. Graves 668970f573
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
fix test script
2025-10-17 19:16:14 -05:00

89 lines
2.5 KiB
Groovy

#!groovy
pipeline {
agent none
environment {
PROJECT_TEST_CONFIG_DIR = "/.ci/%PROJECT_NAME%/test"
}
options {
disableConcurrentBuilds()
skipDefaultCheckout()
timestamps()
}
stages {
stage('Build • Test • Deliver') {
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('linux_x86_64') {
steps { script { retryWithBackoff(2, 5) { sh 'scripts/make_unix.sh' } } }
}
stage('mingw64') {
steps { script { retryWithBackoff(2, 5) { sh 'scripts/make_win32.sh' } } }
}
stage('linux_aarch64') {
steps { script { retryWithBackoff(2, 5) { sh 'scripts/make_unix.sh aarch64' } } }
}
stage('test') {
steps {
script {
retryWithBackoff(2, 5) { sh 'scripts/run_tests.sh' }
retryWithBackoff(2, 5) { sh 'scripts/run_tests.sh "" "" "" "" 1 1' }
retryWithBackoff(2, 5) { sh 'scripts/run_tests.sh aarch64' }
}
}
}
stage('deliver') {
steps {
script {
retryWithBackoff(3, 10) { sh 'scripts/deliver.sh /mnt/%PROJECT_NAME% "" "" "" "" 1 1' }
retryWithBackoff(3, 10) { sh 'scripts/deliver.sh /mnt/%PROJECT_NAME% "" aarch64' }
retryWithBackoff(3, 10) { sh 'scripts/deliver.sh /mnt/%PROJECT_NAME%' }
}
}
}
}
}
}
}
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'
}
}
}