From a4b00067452b0c41c0b985fbc1c683d2abc413e6 Mon Sep 17 00:00:00 2001 From: bQUARKz Date: Wed, 8 Apr 2026 09:13:46 +0100 Subject: [PATCH] improve jenkins --- files/config/Jenkinsfile | 85 ++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/files/config/Jenkinsfile b/files/config/Jenkinsfile index 9ab8e21f..cd2c0915 100644 --- a/files/config/Jenkinsfile +++ b/files/config/Jenkinsfile @@ -2,6 +2,9 @@ pipeline { agent any environment { + CARGO_HOME = '/var/jenkins_home/.cargo' + CARGO_TARGET_DIR = 'target' + CARGO_TERM_COLOR = 'always' MIN_LINES = '60' @@ -12,45 +15,43 @@ pipeline { stages { stage('Build') { steps { - script { - sh ''' - set -eux - make ci cobertura + sh ''' + set -eux + make ci cobertura - LINES=$(jq -r '.data[0].totals.lines.percent' target/llvm-cov/summary.json) - FUNCTIONS=$(jq -r '.data[0].totals.functions.percent' target/llvm-cov/summary.json) - REGIONS=$(jq -r '.data[0].totals.regions.percent' target/llvm-cov/summary.json) + LINES=$(jq -r '.data[0].totals.lines.percent' target/llvm-cov/summary.json) + FUNCTIONS=$(jq -r '.data[0].totals.functions.percent' target/llvm-cov/summary.json) + REGIONS=$(jq -r '.data[0].totals.regions.percent' target/llvm-cov/summary.json) - echo "Coverage summary:" - echo " Lines: ${LINES}%" - echo " Functions: ${FUNCTIONS}%" - echo " Regions: ${REGIONS}%" + echo "Coverage summary:" + echo " Lines: ${LINES}%" + echo " Functions: ${FUNCTIONS}%" + echo " Regions: ${REGIONS}%" - FAIL=0 + FAIL=0 - awk "BEGIN { exit !(${LINES} < ${MIN_LINES}) }" && { - echo "Lines coverage ${LINES}% is below minimum ${MIN_LINES}%" - FAIL=1 - } || true + awk "BEGIN { exit !(${LINES} < ${MIN_LINES}) }" && { + echo "Lines coverage ${LINES}% is below minimum ${MIN_LINES}%" + FAIL=1 + } || true - awk "BEGIN { exit !(${FUNCTIONS} < ${MIN_FUNCTIONS}) }" && { - echo "Functions coverage ${FUNCTIONS}% is below minimum ${MIN_FUNCTIONS}%" - FAIL=1 - } || true + awk "BEGIN { exit !(${FUNCTIONS} < ${MIN_FUNCTIONS}) }" && { + echo "Functions coverage ${FUNCTIONS}% is below minimum ${MIN_FUNCTIONS}%" + FAIL=1 + } || true - awk "BEGIN { exit !(${REGIONS} < ${MIN_REGIONS}) }" && { - echo "Regions coverage ${REGIONS}% is below minimum ${MIN_REGIONS}%" - FAIL=1 - } || true + awk "BEGIN { exit !(${REGIONS} < ${MIN_REGIONS}) }" && { + echo "Regions coverage ${REGIONS}% is below minimum ${MIN_REGIONS}%" + FAIL=1 + } || true - if [ "$FAIL" -ne 0 ]; then - echo "Coverage gate failed." - exit 1 - fi + if [ "$FAIL" -ne 0 ]; then + echo "Coverage gate failed." + exit 1 + fi - echo "Coverage gate passed." - ''' - } + echo "Coverage gate passed." + ''' // withChecks(name: 'Test', includeStage: true) { // sh ''' // set -eux @@ -77,17 +78,17 @@ pipeline { stage('Reports') { steps { - script { - publishHTML(target: [ - allowMissing: false, - alwaysLinkToLastBuild: true, - keepAll: true, - reportDir: 'target/llvm-cov/html', - reportFiles: 'index.html', - reportName: 'Rust Coverage HTML', - reportTitles: 'Coverage Report' - ]) - } + publishHTML(target: [ + allowMissing: false, + alwaysLinkToLastBuild: true, + keepAll: true, + reportDir: 'target/llvm-cov/html', + reportFiles: 'index.html', + reportName: 'Rust Coverage HTML', + reportTitles: 'Coverage Report' + ]) + + archiveArtifacts artifacts: 'target/llvm-cov/**', fingerprint: true } } // Reports }