bot-base/Jenkinsfile
Suwako Moriya aa30652a5a
Some checks failed
Gitsokyo/bot-base/pipeline/pr-master There was a failure building this commit
Trying to get the skip to work
2020-04-26 21:09:55 +02:00

85 lines
2.6 KiB
Groovy

pipeline {
agent {
dockerfile {
args '-u root -v $HOME/docker_volumes/.cache/:/root/.cache/'
}
}
environment {
SPHINXOPTS = '-w sphinx-build.log'
DEPLOY_HOST = 'docs@172.17.0.1'
DEPLOY_PATH = 'www/docs/bot-base/'
}
stages {
stage('Install Dependencies') {
steps {
sh 'pipenv sync --sequential --dev'
}
}
stage('Run Tests') {
steps {
sh '''export PYTHONPATH=$(pwd)/python
cd src
pipenv run pytest -p no:warnings --junit-xml test-reports/results.xml'''
}
post {
always {
junit 'src/test-reports/results.xml'
}
}
}
stage('Build Documentation') {
steps {
sh '''export PYTHONPATH=$(pwd)/python
cd doc
rm -f sphinx-build.log
pipenv run make html'''
}
post {
failure {
sh 'cat doc/sphinx-build.log'
}
}
}
stage('Deploy Documentation') {
when {
anyOf {
branch 'stable'
branch 'unstable'
buildingTag()
}
}
steps {
sshagent(credentials: ['1cf72f47-b70c-4f90-a958-020956099d19']) {
scipt {
def SUB_PATH = """${sh(
returnStdout: true,
script: 'echo "${GIT_BRANCH#*/}"'
)}""".trim()
if (buildingTag()) {
SUB_PATH="${env.TAG_NAME}"
}
withEnv(["SUB_PATH=${SUB_PATH}"]) {
sh '''cd doc
rm -f rsync.log
ssh -o StrictHostKeyChecking=no -o BatchMode=yes ${DEPLOY_HOST} mkdir -p ${DEPLOY_PATH}${SUB_PATH}/
rsync -aze 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes' \
--log-file=rsync.log \
--delete \
./build/html/ ${DEPLOY_HOST}:${DEPLOY_PATH}${SUB_PATH}/'''
}
}
}
}
post {
failure {
sh 'cat doc/rsync.log'
}
}
}
}
}