ci: harden unit test step and junit post
This commit is contained in:
parent
8930161926
commit
a228e063f1
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@ -95,7 +95,7 @@ spec:
|
||||
stage('Unit tests') {
|
||||
steps {
|
||||
container('tester') {
|
||||
sh '''
|
||||
sh(script: '''
|
||||
set -euo pipefail
|
||||
python -m pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt
|
||||
mkdir -p build
|
||||
@ -114,7 +114,7 @@ spec:
|
||||
percent = summary.get("percent_covered")
|
||||
print(f"Coverage summary: {percent:.2f}%" if percent is not None else "Coverage summary unavailable")
|
||||
PY
|
||||
'''
|
||||
'''.stripIndent())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,15 @@ spec:
|
||||
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
if (fileExists('build/junit.xml')) {
|
||||
try {
|
||||
junit allowEmptyResults: true, testResults: 'build/junit.xml'
|
||||
} catch (Throwable err) {
|
||||
echo "junit step unavailable: ${err.class.simpleName}"
|
||||
}
|
||||
}
|
||||
}
|
||||
archiveArtifacts artifacts: 'build/junit.xml,build/coverage.json', allowEmptyArchive: true, fingerprint: true
|
||||
script {
|
||||
def props = fileExists('build.env') ? readProperties(file: 'build.env') : [:]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user