Skip to content

Commit

Permalink
run tests by travis, hopefully fix apidoc build
Browse files Browse the repository at this point in the history
  • Loading branch information
ubergesundheit committed Feb 21, 2018
1 parent d3e3968 commit 0116f6a
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ version.js
*.log
.github
tests
apidoc
apidoc.json
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ mongo-data
.env
doc/
version.js

apidoc
apidoc.json
9 changes: 5 additions & 4 deletions .scripts/deploy-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
set -euo pipefail
IFS=$'\n\t'

currentBranch=$(git branch | grep -e "^*" | cut -d' ' -f 2)

if [ "$currentBranch" != "master" ]; then
echo "Docs can only be built from 'master' branch"
if [[ -n "${TRAVIS_TAG}" ]]; then
echo "Docs can only be built from tags"
exit 0
fi

Expand All @@ -16,6 +14,9 @@ cd "$TRAVIS_BUILD_DIR"
# install apidocs
npm install -g [email protected]

# append the current version
sed -i "1 s|$| ${TRAVIS_TAG}|" apidoc/introduction.md

# run apidoc
apidoc -i . -f js -e node_modules

Expand Down
4 changes: 2 additions & 2 deletions .scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ case "$cmd" in
esac

mailer_tag=$(git rev-parse --abbrev-ref HEAD)
if [[ "$mailer_tag" == "master" || "$mailer_tag" == "development" ]]; then
export SENSEBOX_MAILER_TAG="$mailer_tag"
if [[ "$mailer_tag" == "master" ]]; then
export SENSEBOX_MAILER_TAG="latest"
else
export SENSEBOX_MAILER_TAG="development"
fi
Expand Down
18 changes: 11 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
sudo: false
sudo: required

services:
- docker

git:
depth: 1

language: node_js
node_js:
- "6"
- "8"

install: true
script: ./.scripts/deploy-docs.sh
script:
- ./.scripts/run-tests.sh
- ./.scripts/deploy-docs.sh

env:
global:
- GITHUB_REPO: "sensebox/openSenseMap-API"
- secure: "B1S19gMUgYsGSDcQGu9iXyC2Gv/I0Saw64cthMPXck4Scbog6vAQ4b8Zp2LvgcnfYGv+714KCrv1AunF0xdt/7CNi4426cyvmB8uNV5fZRaSrCq6iWOzqI616OLY7jwJ7Fu21PL7RgwZjoe4JKxY8XoSqnoDdZgclblL96ALfSY="

branches:
only:
- master
25 changes: 25 additions & 0 deletions apidoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "",
"title": "openSenseMap API documentation",
"url": "https://api.opensensemap.org",
"order": [
"register",
"getBox",
"getBoxes",
"postNewBox",
"updateBox",
"deleteBox",
"getScript",
"postNewMeasurement",
"getMeasurements",
"getData",
"calculateIdw"
],
"template": {
"withCompare": false
},
"header": {
"title": "Introduction",
"filename": "apidoc/introduction.md"
}
}
32 changes: 32 additions & 0 deletions apidoc/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
![openSenseMap API](https://raw.githubusercontent.com/sensebox/resources/master/images/openSenseMap_API_github.png)

<br />Documentation of the routes and methods to manage [users](#api-Users), [stations (also called boxes or senseBoxes)](#api-Boxes), and [measurements](#api-Measurements) in the openSenseMap API.
You can find the API running at [https://api.opensensemap.org/](https://api.opensensemap.org/).

## Timestamps

Please note that the API handles every timestamp in [Coordinated universal time (UTC)](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) time zone. Timestamps in parameters should be in RFC 3339 notation.

Timestamp without Milliseconds:

2018-02-01T23:18:02Z

Timestamp with Milliseconds:

2018-02-01T23:18:02.412Z

## IDs

All stations and sensors of stations receive a unique public identifier. These identifiers are exactly 24 character long and only contain digits and characters a to f.

Example:

5a8d1c25bc2d41001927a265

## Source code and Licenses

You can find the whole source code of the API at GitHub in the [sensebox/openSenseMap-API](https://github.com/sensebox/openSenseMap-API) repository. You can obtain the code under the MIT License.

The data obtainable through the openSenseMap API at [https://api.opensensemap.org/](https://api.opensensemap.org/) is licensed under the [Public Domain Dedication and License 1.0](https://opendatacommons.org/licenses/pddl/summary/).

If you there is something unclear or there is a mistake in this documentation please open an [issue](https://github.com/sensebox/openSenseMap-API/issues/new) in the GitHub repository.
21 changes: 0 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,5 @@
"mocha": "^5.0.0",
"mqtt": "^2.15.1",
"randomgeojson": "^1.0.0"
},
"apidoc": {
"name": "openSenseMap API documentation",
"description": "methods to manage senseBoxes and get/post measurements",
"title": "openSenseMap API documentation",
"url": "https://api.opensensemap.org",
"order": [
"getBox",
"getBoxes",
"postNewBox",
"updateBox",
"deleteBox",
"getScript",
"postNewMeasurement",
"getMeasurements",
"getData",
"calculateIdw"
],
"template": {
"withCompare": false
}
}
}

0 comments on commit 0116f6a

Please sign in to comment.