From ad37ab6283f3ef29421665df38c5748617bd0a4f Mon Sep 17 00:00:00 2001 From: Diana Shkolnikov Date: Fri, 19 Jun 2015 13:37:51 -0400 Subject: [PATCH 1/2] Add acceptance tests to travis-ci scripts --- .travis.yml | 5 ++++- package.json | 4 +++- test/acceptance/remote.sh | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 test/acceptance/remote.sh diff --git a/.travis.yml b/.travis.yml index 82ec939c..c7e97d1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: node_js -script: "npm run unit" +script: + - npm run unit + - if [ "${TRAVIS_BRANCH}" == "production" ]; then npm run acceptance-prod fi; + - if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then npm run acceptance-stage fi; node_js: - "0.10" \ No newline at end of file diff --git a/package.json b/package.json index 4c4c3411..377c750a 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "ciao": "node node_modules/ciao/bin/ciao -c test/ciao.json test/ciao", "coverage": "node_modules/.bin/istanbul cover test/unit/run.js", "audit": "npm shrinkwrap; node node_modules/nsp/bin/nspCLI.js audit-shrinkwrap; rm npm-shrinkwrap.json;", - "docs": "rm -r docs; cd test/ciao; node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs" + "docs": "rm -r docs; cd test/ciao; node ../../node_modules/ciao/bin/ciao -c ../ciao.json . -d ../../docs", + "acceptance-prod": "sh test/acceptance/remote.sh production", + "acceptance-stage": "sh test/acceptance/remote.sh master" }, "repository": { "type": "git", diff --git a/test/acceptance/remote.sh b/test/acceptance/remote.sh new file mode 100644 index 00000000..c31db69a --- /dev/null +++ b/test/acceptance/remote.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -ex + +if [ -d test/acceptance/acceptance-tests ]; then + rm -rf test/acceptance/acceptance-tests +fi + +if [ "$1" == "production" ]; then + git clone -b production --single-branch https://github.com/pelias/acceptance-tests.git test/acceptance/acceptance-tests +else + git clone https://github.com/pelias/acceptance-tests.git test/acceptance/acceptance-tests +fi + +cd test/acceptance/acceptance-tests +npm install + +if [ "$1" == "production" ]; then + node test -e prod +else + node test -e stage +fi + +cd ../../../ && rm -rf test/acceptance/acceptance-tests From 4023c364a44e6752aaadffb806dc4ecead596610 Mon Sep 17 00:00:00 2001 From: Diana Shkolnikov Date: Fri, 19 Jun 2015 16:15:43 -0400 Subject: [PATCH 2/2] booo --- .travis.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7e97d1f..5e0a6679 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,13 @@ language: node_js script: - npm run unit - - if [ "${TRAVIS_BRANCH}" == "production" ]; then npm run acceptance-prod fi; - - if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then npm run acceptance-stage fi; + - > + if [ "${TRAVIS_BRANCH}" == "production" ]; then + npm run acceptance-prod; + fi; + - > + if [ "${TRAVIS_BRANCH}" == "master" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ]; then + npm run acceptance-stage; + fi; node_js: - "0.10" \ No newline at end of file