Skip to content

Commit 8c64b4b

Browse files
authored
Merge pull request #124 from WebFuzzing/ohsome-api
Ohsome api starting
2 parents 40d927f + 260f9e8 commit 8c64b4b

File tree

118 files changed

+21272
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+21272
-0
lines changed

jdk_17_maven/cs/rest/ohsome-api/CHANGELOG.md

Lines changed: 619 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Code Style
2+
3+
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).
4+
5+
6+
# Check Examples
7+
8+
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).
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
pipeline {
2+
agent {
3+
label 'worker'
4+
}
5+
options {
6+
timeout(time: 30, unit: 'MINUTES')
7+
}
8+
tools {
9+
maven 'Maven 3'
10+
}
11+
12+
environment {
13+
// START CUSTOM ohsome API
14+
MAVEN_TEST_OPTIONS = '-Dport_get=8081 -Dport_post=8082 -Dport_data=8083 -DdbFilePathProperty=--database.db=/data/heidelberg-v1.0-beta.oshdb'
15+
// END CUSTOM ohsome API
16+
// this regex determines which branch is deployed as a snapshot
17+
SNAPSHOT_BRANCH_REGEX = /(^main$)/
18+
RELEASE_REGEX = /^([0-9]+(\.[0-9]+)*)(-(RC|beta-|alpha-)[0-9]+)?$/
19+
RELEASE_DEPLOY = false
20+
SNAPSHOT_DEPLOY = false
21+
}
22+
23+
stages {
24+
stage('Build and Test') {
25+
steps {
26+
// setting up a few basic env variables like REPO_NAME and LATEST_AUTHOR
27+
setup_basic_env()
28+
29+
mavenbuild('clean compile javadoc:jar source:jar verify -P jacoco,sign,git')
30+
}
31+
post {
32+
failure {
33+
rocket_buildfail()
34+
rocket_testfail()
35+
}
36+
}
37+
}
38+
39+
stage('Reports and Statistics') {
40+
steps {
41+
reports_sonar_jacoco()
42+
}
43+
}
44+
45+
stage('Deploy Snapshot') {
46+
when {
47+
expression {
48+
return env.BRANCH_NAME ==~ SNAPSHOT_BRANCH_REGEX && VERSION ==~ /.*-SNAPSHOT$/
49+
}
50+
}
51+
steps {
52+
deploy_snapshot('clean compile javadoc:jar source:jar deploy -P sign,git')
53+
// START CUSTOM ohsome API
54+
script {
55+
SNAPSHOT_DEPLOY = true
56+
}
57+
// END CUSTOM ohsome API
58+
}
59+
post {
60+
failure {
61+
rocket_snapshotdeployfail()
62+
}
63+
}
64+
}
65+
66+
stage('Deploy Release') {
67+
when {
68+
expression {
69+
return VERSION ==~ RELEASE_REGEX && env.TAG_NAME ==~ RELEASE_REGEX
70+
}
71+
}
72+
steps {
73+
deploy_release('clean compile javadoc:jar source:jar deploy -P sign,git')
74+
75+
deploy_release_central('clean compile javadoc:jar source:jar deploy -P sign,git,deploy-central')
76+
// START CUSTOM ohsome API
77+
script {
78+
RELEASE_DEPLOY = true
79+
}
80+
// END CUSTOM ohsome API
81+
}
82+
post {
83+
failure {
84+
rocket_releasedeployfail()
85+
}
86+
}
87+
}
88+
89+
// START CUSTOM ohsome API
90+
stage('Publish API Docs') {
91+
when {
92+
anyOf {
93+
equals expected: true, actual: RELEASE_DEPLOY
94+
equals expected: true, actual: SNAPSHOT_DEPLOY
95+
}
96+
}
97+
agent {
98+
label 'builtin'
99+
}
100+
steps {
101+
script {
102+
DOC_RELEASE_REGEX = /^([0-9]+(\.[0-9]+)*)$/
103+
DOCS_DEPLOYMENT = 'development'
104+
API_DOCS_PATH = 'development'
105+
if (VERSION ==~ DOC_RELEASE_REGEX) {
106+
DOCS_DEPLOYMENT = 'release'
107+
API_DOCS_PATH = sh(returnStdout: true, script: 'cd docs && python3 get_pom_metadata.py | awk \'/^Path:/{ print $2 }\'').trim()
108+
}
109+
publish_dir = "/var/lib/jenkins/apidocs/${REPO_NAME}/${API_DOCS_PATH}/"
110+
111+
if (!fileExists('venv')) {
112+
sh 'python3 -m venv venv'
113+
}
114+
115+
sh """
116+
# activate venv and install dependencies
117+
. venv/bin/activate
118+
venv/bin/pip install --upgrade pip
119+
venv/bin/pip install -r docs/requirements.txt
120+
cd docs
121+
122+
# compile
123+
../venv/bin/sphinx-build -b html . _build
124+
125+
# publish
126+
rm -rf ${publish_dir}
127+
mkdir -p ${publish_dir}
128+
cp -r _build/* ${publish_dir}
129+
"""
130+
}
131+
}
132+
post {
133+
failure {
134+
rocket_basicsend("Publishing of API Docs failed on ${env.BRANCH_NAME}")
135+
}
136+
}
137+
}
138+
// END CUSTOM ohsome API
139+
140+
stage('Check Dependencies') {
141+
when {
142+
expression {
143+
if (currentBuild.number > 1) {
144+
return (((currentBuild.getStartTimeInMillis() - currentBuild.previousBuild.getStartTimeInMillis()) > 2592000000) && (env.BRANCH_NAME ==~ SNAPSHOT_BRANCH_REGEX)) //2592000000 30 days in milliseconds
145+
}
146+
return false
147+
}
148+
}
149+
steps {
150+
check_dependencies()
151+
}
152+
}
153+
154+
stage('Wrapping Up') {
155+
steps {
156+
encourage()
157+
status_change()
158+
}
159+
}
160+
}
161+
}

0 commit comments

Comments
 (0)