File tree Expand file tree Collapse file tree 5 files changed +77
-8
lines changed
Expand file tree Collapse file tree 5 files changed +77
-8
lines changed Original file line number Diff line number Diff line change 1+ node {
2+ def SOURCEDIR = pwd()
3+ try {
4+ stage(" Clean up" ) {
5+ step([$class : ' WsCleanup' ])
6+ }
7+ stage(" Checkout Code" ) {
8+ checkout scm
9+ }
10+ stage(" Test with Docker" ) {
11+ withEnv([" API_KEY=${ env.ROSETTE_API_KEY} " , " ALT_URL=${ env.BINDING_TEST_URL} " ]) {
12+ sh " docker run --rm -e API_KEY=${ API_KEY} -e ALT_URL=${ ALT_URL} -v ${ SOURCEDIR} :/source rosetteapi/docker-nodejs"
13+ }
14+ }
15+ slack(true )
16+ } catch (e) {
17+ currentBuild. result = " FAILED"
18+ slack(false )
19+ throw e
20+ }
21+ }
22+
23+ def slack (boolean success ) {
24+ def color = success ? " #00FF00" : " #FF0000"
25+ def status = success ? " SUCCESSFUL" : " FAILED"
26+ def message = status + " : Job '${ env.JOB_NAME} [${ env.BUILD_NUMBER} ]' (${ env.BUILD_URL} )"
27+ slackSend(color : color, channel : " #rapid" , message : message)
28+ }
Original file line number Diff line number Diff line change 1+ node {
2+ def SOURCEDIR = pwd()
3+ def TEST_CONTAINER = 'examples/nodejs-test'
4+ def DOCKERFILE_DIR = './examples'
5+ try {
6+ stage("Clean up") {
7+ step([$class: 'WsCleanup'])
8+ }
9+ stage("Checkout Code") {
10+ checkout scm
11+ }
12+ stage("Build Dockerfile") {
13+ dir ("${DOCKERFILE_DIR}") {
14+ docker.build("${TEST_CONTAINER}")
15+ }
16+ }
17+ stage("Run Examples") {
18+ withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) {
19+ def examplesDir = "${SOURCEDIR}" + '/examples'
20+ sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${examplesDir}:/source ${TEST_CONTAINER}"
21+ }
22+ }
23+ slack(true)
24+ } catch (e) {
25+ currentBuild.result = "FAILED"
26+ slack(false)
27+ throw e
28+ }
29+ }
30+
31+ def slack(boolean success) {
32+ def color = success ? "#00FF00" : "#FF0000"
33+ def status = success ? "SUCCESSFUL" : "FAILED"
34+ def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})"
35+ slackSend(color: color, channel: "#rapid", message: message)
36+ }
Original file line number Diff line number Diff line change @@ -76,5 +76,8 @@ See [examples](examples).
7676## API Documentation
7777See [ documentation] ( http://rosette-api.github.io/nodejs )
7878
79+ ## Release Notes
80+ See [ wiki] ( https://github.com/rosette-api/nodejs/wiki/Release-Notes )
81+
7982## Additional Information
8083See [ Rosette API site] ( https://developer.rosette.com/ )
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ RUN apt-get -y update && apt-get install -y git && apt-get install -y vim && apt
77ENV API_KEY api_key
88
99# set the working directory
10- RUN mkdir /nodejs-dev
11- WORKDIR /nodejs-dev
10+ RUN mkdir -p /nodejs-dev/examples
11+ WORKDIR /nodejs-dev/examples
1212COPY runAll.sh runAll.sh
1313RUN chmod 0755 runAll.sh
1414
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ function checkAPI() {
2121 if [ ! -z $match ]; then
2222 echo -e " \nInvalid Rosette API Key"
2323 exit 1
24- fi
24+ fi
2525}
2626
2727# add the trailing slash of the alt_url if necessary
@@ -41,7 +41,7 @@ function validateURL() {
4141 if [ " ${match} " = " " ]; then
4242 echo -e " \n${ping_url} server not responding\n"
4343 exit 1
44- fi
44+ fi
4545}
4646
4747function runExample() {
@@ -93,19 +93,21 @@ cp -r -n /source/. .
9393# Run the examples
9494if [ ! -z ${API_KEY} ]; then
9595 checkAPI
96- # Prerequisite
97- cd ./examples
96+ npm install rosette-api
97+ cp -r node_modules/rosette-api/lib ../lib
98+ pushd ../lib
99+ npm install multipart-stream
100+ popd
98101 npm install argparse
99102 npm install temporary
100- npm install multipart-stream
101103 if [ ! -z ${FILENAME} ]; then
102104 runExample ${FILENAME}
103105 else
104106 for file in * .js; do
105107 runExample ${file}
106108 done
107109 fi
108- else
110+ else
109111 HELP
110112fi
111113
You can’t perform that action at this time.
0 commit comments