beffroi-tools/Jenkinsfile

59 lines
1.4 KiB
Groovy

pipeline {
agent { label 'rust_no_docker' }
options {
skipDefaultCheckout(true)
timeout(time: 10, unit: 'MINUTES')
}
environment {
PYTHONUNBUFFERED = '1'
PYTHONDONTWRITEBYTECODE = '1'
NO_COLOR = '1'
}
stages {
stage('Checkout') {
steps {
deleteDir()
checkout scm
}
}
stage('Check Python') {
steps {
sh '''
set -eu
if ! command -v python3 >/dev/null 2>&1; then
echo "ERROR: python3 is required on this Jenkins worker." >&2
exit 1
fi
python3 --version
python3 -c 'import sys; sys.exit("Python 3.9 or newer is required." if sys.version_info < (3, 9) else 0)'
'''
}
}
stage('Tests') {
steps {
sh '''
set -eu
python3 -m unittest discover -s tests -v
'''
}
}
}
post {
success {
echo 'All Python unit tests passed. No artifacts were published.'
}
failure {
echo 'Checkout, Python setup, or tests failed. See the build log.'
}
unstable {
echo 'The build is unstable. See the build log.'
}
}
}