From b7b5f031f35ba2550bdfbddfa2a7e2b3f7e652c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Wed, 31 Oct 2018 17:20:25 +0100 Subject: [PATCH] Update docker test scripts to support Node.js 6 and 10 buildings --- .travis.yml | 6 ++++-- docker-test.sh | 21 ++++++++++++++++++++- run_tests_docker.sh | 29 +++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 575a1bd3..1b1fb959 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,17 +3,19 @@ jobs: - sudo: required services: - docker + language: node_js node_js: - "6" before_install: docker pull carto/nodejs6-xenial-pg101:postgis-2.4.4.5 - script: npm run docker-test -- nodejs6-xenial-pg101:postgis-2.4.4.5 + script: npm run docker-test -- nodejs6 - sudo: required services: - docker + language: node_js node_js: - "10" before_install: docker pull carto/nodejs10-xenial-pg101:postgis-2.4.4.5 - script: npm run docker-test -- nodejs10-xenial-pg101:postgis-2.4.4.5 + script: npm run docker-test -- nodejs10 - dist: precise addons: postgresql: "9.5" diff --git a/docker-test.sh b/docker-test.sh index e0e94749..2242ef76 100755 --- a/docker-test.sh +++ b/docker-test.sh @@ -1,4 +1,23 @@ #!/bin/bash -docker run -v `pwd`:/srv carto/${1:-nodejs10-xenial-pg101:postgis-2.4.4.5} bash run_tests_docker.sh && \ +usage() { + echo "Usage: $0 [nodejs6|nodejs10]" + exit 1 +} + +echo "$0 $1" + +NODEJS_VERSION=${1-nodejs10} + +if [ "$NODEJS_VERSION" = "nodejs10" ]; +then + DOCKER='nodejs10-xenial-pg101:postgis-2.4.4.5' +elif [ "$NODEJS_VERSION" = "nodejs6" ]; +then + DOCKER='nodejs6-xenial-pg101:postgis-2.4.4.5' +else + usage +fi + +docker run -v `pwd`:/srv carto/${DOCKER} bash run_tests_docker.sh ${NODEJS_VERSION} && \ docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v diff --git a/run_tests_docker.sh b/run_tests_docker.sh index 87b3e2fb..74f84cc0 100644 --- a/run_tests_docker.sh +++ b/run_tests_docker.sh @@ -1,9 +1,34 @@ +#!/bin/bash + +usage() { + /etc/init.d/postgresql stop + echo "Usage: $0 [nodejs10|nodejs6]" + exit 1 +} + +echo "$0 $1" + # start PostgreSQL /etc/init.d/postgresql start +echo "Node.js version:" +node -v + # install dependencies -npm install -g yarn@0.27.5 -yarn +NODEJS_VERSION=${1-nodejs10} + +if [ "$NODEJS_VERSION" = "nodejs10" ]; +then + echo "Node.js version:" + npm -v + npm install +elif [ "$NODEJS_VERSION" = "nodejs6" ]; +then + npm install -g yarn@0.27.5 + yarn +else + usage +fi # run tests npm test