Skip to content

Commit

Permalink
Merge pull request #317 from GIScience/fix-jenkins
Browse files Browse the repository at this point in the history
Jenkins/ci: fix API docs build and README badge
  • Loading branch information
ConstantinNicolai authored Oct 31, 2023
2 parents bcf4dd8 + af3e6f3 commit 88b7167
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 33 deletions.
47 changes: 15 additions & 32 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,68 +87,51 @@ pipeline {
}

// START CUSTOM ohsome API
stage('Compile API Docs') {
stage('Publish API Docs') {
when {
anyOf {
equals expected: true, actual: RELEASE_DEPLOY
equals expected: true, actual: SNAPSHOT_DEPLOY
}
}
agent {
label 'builtin'
}
steps {
script {
DOC_RELEASE_REGEX = /^([0-9]+(\.[0-9]+)*)$/
DOCS_DEPLOYMENT = 'development'
API_DOCS_PATH = 'development'
if (VERSION ==~ DOC_RELEASE_REGEX) {
DOCS_DEPLOYMENT = 'release'
API_DOCS_PATH = sh(returnStdout: true, script: 'cd docs && python3 get_pom_metadata.py | awk \'/^Path:/{ print $2 }\'').trim()
DOCS_DEPLOYMENT = 'release'
API_DOCS_PATH = sh(returnStdout: true, script: 'cd docs && python3 get_pom_metadata.py | awk \'/^Path:/{ print $2 }\'').trim()
}
publish_dir = "/var/lib/jenkins/apidocs/${REPO_NAME}/${API_DOCS_PATH}/"

if (!fileExists('venv')) {
sh 'python3 -m venv venv'
sh 'python3 -m venv venv'
}

sh '''
sh """
# activate venv and install dependencies
. venv/bin/activate
venv/bin/pip install --upgrade pip
venv/bin/pip install -r docs/requirements.txt
cd docs
# compile
../venv/bin/sphinx-build -b html . _build
'''
sh 'rm -rf venv'
}
}
post {
failure {
rocket_basicsend('Compile of API Docs failed on ${env.BRANCH_NAME}')
}
}
}
stage('Publish API Docs') {
when {
anyOf {
equals expected: true, actual: RELEASE_DEPLOY
equals expected: true, actual: SNAPSHOT_DEPLOY
}
}
agent {
label 'builtin'
}
steps {
script {
working_dir = sh(returnStdout: true, script: 'basename $(pwd)').trim()
publish_dir = "/var/lib/jenkins/apidocs/${REPO_NAME}/${API_DOCS_PATH}/"
sh """
# publish
rm -rf ${publish_dir}
mkdir -p ${publish_dir}
cp -r /var/lib/jenkins/workspace/${working_dir}/docs/_build/* ${publish_dir}
cp -r _build/* ${publish_dir}
"""
}
}
post {
failure {
rocket_basicsend('Publishing of API Docs failed on ${env.BRANCH_NAME}')
rocket_basicsend("Publishing of API Docs failed on ${env.BRANCH_NAME}")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ohsome API

[![Build Status](http://jenkins.ohsome.org/buildStatus/icon?job=ohsome-api/master)](http://jenkins.ohsome.org/blue/organizations/jenkins/ohsome-api/activity)
[![Build Status](https://jenkins.heigit.org/buildStatus/icon?job=ohsome%20api/master)](https://jenkins.heigit.org/job/ohsome%20api/job/master/)
[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=org.heigit.ohsome:ohsome-api&metric=alert_status)](https://sonarcloud.io/dashboard?id=org.heigit.ohsome:ohsome-api)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.heigit.ohsome/ohsome-api/badge.svg)](https://search.maven.org/artifact/org.heigit.ohsome/ohsome-api)
[![LICENSE](https://img.shields.io/github/license/GIScience/ohsome-api)](LICENSE)
Expand Down

0 comments on commit 88b7167

Please sign in to comment.