Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
619 changes: 619 additions & 0 deletions jdk_17_maven/cs/rest/ohsome-api/CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions jdk_17_maven/cs/rest/ohsome-api/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Code Style

We're using the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) for the source code. With the [exception](https://google.github.io/styleguide/javaguide.html#s5.3-camel-case) that the abbreviations `OSM`, `OSH` and `OSHDB` are allowed to be used in method and class names. For some popular IDEs and code linting tools you can find configuration files of the used code style in the OSHDB repository: [config/ide](https://github.com/GIScience/oshdb/tree/main/config/ide).


# Check Examples

To ensure that the ohsome API runs with a defined set of examples, we collect several examples, in addition to the integrated [unit and API tests](/src/test/java/org/heigit/ohsome/ohsomeapi). These examples are used to test the ohsome API before releases or productive deployments. If you fix a bug or implement a new feature, please think of a few exemplary requests to be added into the [check-ohsome-api repository](https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/helpers/check-ohsome-api/-/issues/new). They can be added as [issue](https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/helpers/check-ohsome-api/-/issues/new) or directly as [merge request](https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/helpers/check-ohsome-api/-/merge_requests/new). More information, see [check-ohsome-api README](https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/helpers/check-ohsome-api/-/blob/master/README.md#add-example).
161 changes: 161 additions & 0 deletions jdk_17_maven/cs/rest/ohsome-api/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
pipeline {
agent {
label 'worker'
}
options {
timeout(time: 30, unit: 'MINUTES')
}
tools {
maven 'Maven 3'
}

environment {
// START CUSTOM ohsome API
MAVEN_TEST_OPTIONS = '-Dport_get=8081 -Dport_post=8082 -Dport_data=8083 -DdbFilePathProperty=--database.db=/data/heidelberg-v1.0-beta.oshdb'
// END CUSTOM ohsome API
// this regex determines which branch is deployed as a snapshot
SNAPSHOT_BRANCH_REGEX = /(^main$)/
RELEASE_REGEX = /^([0-9]+(\.[0-9]+)*)(-(RC|beta-|alpha-)[0-9]+)?$/
RELEASE_DEPLOY = false
SNAPSHOT_DEPLOY = false
}

stages {
stage('Build and Test') {
steps {
// setting up a few basic env variables like REPO_NAME and LATEST_AUTHOR
setup_basic_env()

mavenbuild('clean compile javadoc:jar source:jar verify -P jacoco,sign,git')
}
post {
failure {
rocket_buildfail()
rocket_testfail()
}
}
}

stage('Reports and Statistics') {
steps {
reports_sonar_jacoco()
}
}

stage('Deploy Snapshot') {
when {
expression {
return env.BRANCH_NAME ==~ SNAPSHOT_BRANCH_REGEX && VERSION ==~ /.*-SNAPSHOT$/
}
}
steps {
deploy_snapshot('clean compile javadoc:jar source:jar deploy -P sign,git')
// START CUSTOM ohsome API
script {
SNAPSHOT_DEPLOY = true
}
// END CUSTOM ohsome API
}
post {
failure {
rocket_snapshotdeployfail()
}
}
}

stage('Deploy Release') {
when {
expression {
return VERSION ==~ RELEASE_REGEX && env.TAG_NAME ==~ RELEASE_REGEX
}
}
steps {
deploy_release('clean compile javadoc:jar source:jar deploy -P sign,git')

deploy_release_central('clean compile javadoc:jar source:jar deploy -P sign,git,deploy-central')
// START CUSTOM ohsome API
script {
RELEASE_DEPLOY = true
}
// END CUSTOM ohsome API
}
post {
failure {
rocket_releasedeployfail()
}
}
}

// START CUSTOM ohsome API
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()
}
publish_dir = "/var/lib/jenkins/apidocs/${REPO_NAME}/${API_DOCS_PATH}/"

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

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

# publish
rm -rf ${publish_dir}
mkdir -p ${publish_dir}
cp -r _build/* ${publish_dir}
"""
}
}
post {
failure {
rocket_basicsend("Publishing of API Docs failed on ${env.BRANCH_NAME}")
}
}
}
// END CUSTOM ohsome API

stage('Check Dependencies') {
when {
expression {
if (currentBuild.number > 1) {
return (((currentBuild.getStartTimeInMillis() - currentBuild.previousBuild.getStartTimeInMillis()) > 2592000000) && (env.BRANCH_NAME ==~ SNAPSHOT_BRANCH_REGEX)) //2592000000 30 days in milliseconds
}
return false
}
}
steps {
check_dependencies()
}
}

stage('Wrapping Up') {
steps {
encourage()
status_change()
}
}
}
}
Loading