update jenkinsfile
This commit is contained in:
parent
43ea8b80c9
commit
130c5fdd57
2
Makefile
2
Makefile
@ -19,7 +19,7 @@ clean:
|
|||||||
cargo llvm-cov clean --workspace
|
cargo llvm-cov clean --workspace
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
cargo llvm-cov --workspace --all-features --html --output-dir target/llvm-cov/html --fail-under-lines 0 --fail-under-functions 0 --fail-under-regions 0
|
cargo llvm-cov --workspace --all-features --html --output-dir target/llvm-cov/html
|
||||||
|
|
||||||
coverage-xml:
|
coverage-xml:
|
||||||
cargo llvm-cov report --cobertura --output-path target/llvm-cov/cobertura.xml
|
cargo llvm-cov report --cobertura --output-path target/llvm-cov/cobertura.xml
|
||||||
|
|||||||
67
files/config/Jenkinsfile
vendored
67
files/config/Jenkinsfile
vendored
@ -3,6 +3,10 @@ pipeline {
|
|||||||
|
|
||||||
environment {
|
environment {
|
||||||
CARGO_TERM_COLOR = 'always'
|
CARGO_TERM_COLOR = 'always'
|
||||||
|
|
||||||
|
MIN_LINES = '0'
|
||||||
|
MIN_FUNCTIONS = '0'
|
||||||
|
MIN_REGIONS = '0'
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
@ -12,22 +16,55 @@ pipeline {
|
|||||||
sh '''
|
sh '''
|
||||||
set -eux
|
set -eux
|
||||||
make ci cobertura
|
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."
|
||||||
'''
|
'''
|
||||||
recordCoverage(
|
// recordCoverage(
|
||||||
tools: [[parser: 'COBERTURA', pattern: 'target/llvm-cov/cobertura.xml']],
|
// tools: [[parser: 'COBERTURA', pattern: 'target/llvm-cov/cobertura.xml']],
|
||||||
sourceCodeRetention: 'LAST_BUILD',
|
// sourceCodeRetention: 'LAST_BUILD',
|
||||||
enabledForFailure: true,
|
// enabledForFailure: true,
|
||||||
failOnError: false,
|
// failOnError: false,
|
||||||
checksAnnotationScope: 'MODIFIED_LINES',
|
// checksAnnotationScope: 'MODIFIED_LINES',
|
||||||
id: 'rust-coverage',
|
// id: 'rust-coverage',
|
||||||
name: 'Rust Coverage',
|
// name: 'Rust Coverage',
|
||||||
checksName: 'Rust Coverage',
|
// checksName: 'Rust Coverage',
|
||||||
qualityGates: [
|
// qualityGates: [
|
||||||
[metric: 'LINE', baseline: 'MODIFIED_LINES', threshold: 0.0],
|
// [metric: 'LINE', baseline: 'MODIFIED_LINES', threshold: 0.0],
|
||||||
[metric: 'LINE', baseline: 'PROJECT', threshold: 0.0],
|
// [metric: 'LINE', baseline: 'PROJECT', threshold: 0.0],
|
||||||
[metric: 'BRANCH', baseline: 'PROJECT', threshold: 0.0]
|
// [metric: 'BRANCH', baseline: 'PROJECT', threshold: 0.0]
|
||||||
]
|
// ]
|
||||||
)
|
// )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Test
|
} // Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user