2023-04-21 16:44:01 +00:00
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
stages {
|
|
|
|
stage("clean") {
|
|
|
|
steps {
|
|
|
|
sh 'rm -rf ./dist/*'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage("install") {
|
|
|
|
steps {
|
2023-04-28 16:02:15 +00:00
|
|
|
sh 'mamba env update --file environment.yml || mamba env create --force --file environment.yml'
|
2023-04-21 16:44:01 +00:00
|
|
|
sh 'echo "mamba activate bmlsa" >> ~/.bashrc'
|
|
|
|
}
|
|
|
|
}
|
2023-04-28 15:49:07 +00:00
|
|
|
stage("unit tests") {
|
|
|
|
steps {
|
|
|
|
sh "python -m pytest --junitxml=test_results.xml"
|
|
|
|
xunit checksName: '', tools: [JUnit(excludesPattern: '', pattern: 'test_results.xml', stopProcessingIfError: true)]
|
|
|
|
}
|
|
|
|
}
|
2023-04-21 16:44:01 +00:00
|
|
|
stage("build") {
|
|
|
|
steps {
|
|
|
|
sh "python -m build"
|
|
|
|
}
|
|
|
|
}
|
2023-04-28 15:49:07 +00:00
|
|
|
stage("test installation") {
|
2023-04-21 16:44:01 +00:00
|
|
|
steps {
|
2023-04-28 15:49:07 +00:00
|
|
|
sh "pip install dist/*.whl --force-reinstall"
|
2023-04-24 14:40:29 +00:00
|
|
|
sh "bmlsa -h"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage("archive") {
|
|
|
|
steps {
|
2023-04-28 16:14:42 +00:00
|
|
|
archiveArtifacts artifacts: 'dist/*.tar.gz, dist/*.whl', fingerprint: true, followSymlinks: false, onlyIfSuccessful: true
|
2023-04-21 16:44:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage("publish") {
|
|
|
|
when {
|
|
|
|
branch '**/master'
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
withCredentials([usernamePassword(credentialsId: 'rs-git-package-registry-ydeng', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
|
2023-04-21 19:33:26 +00:00
|
|
|
sh returnStatus: true, script: 'python -m twine upload --repository-url https://git.reslate.systems/api/packages/${USER}/pypi -u ${USER} -p ${PASS} --non-interactive --disable-progress-bar --verbose dist/*'
|
2023-04-21 16:44:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|