jenkins improvements

This commit is contained in:
2026-04-21 17:37:07 +01:00
parent 401a56a4c6
commit 15e1e2321e
8 changed files with 209 additions and 93 deletions
+3 -40
View File
@@ -6,10 +6,6 @@ pipeline {
CARGO_TARGET_DIR = 'target'
CARGO_TERM_COLOR = 'always'
MIN_LINES = '60'
MIN_FUNCTIONS = '60'
MIN_REGIONS = '60'
}
stages {
@@ -17,45 +13,12 @@ pipeline {
steps {
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)
echo "Coverage summary:"
echo " Lines: ${LINES}%"
echo " Functions: ${FUNCTIONS}%"
echo " Regions: ${REGIONS}%"
FAIL=0
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 !(${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
echo "Coverage gate passed."
make ci-domains
'''
// withChecks(name: 'Test', includeStage: true) {
// sh '''
// set -eux
// make ci cobertura
// make ci-domains
// '''
// recordCoverage(
// tools: [[parser: 'COBERTURA', pattern: 'target/llvm-cov/cobertura.xml']],
@@ -92,4 +55,4 @@ pipeline {
}
} // Reports
}
}
}