running tests with dynamic image

This commit is contained in:
Simon Martín
2019-02-12 18:20:32 +01:00
parent 4058d9fbc7
commit 915e0f8483
2 changed files with 8 additions and 44 deletions
+1 -20
View File
@@ -1,23 +1,4 @@
#!/bin/bash
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 run -e "NODEJS_VERSION=${1}" -v `pwd`:/srv carto/nodejs-xenial-pg101:latest bash run_tests_docker.sh && \
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
+7 -24
View File
@@ -1,40 +1,23 @@
#!/bin/bash
usage() {
/etc/init.d/postgresql stop
echo "Usage: $0 [nodejs10|nodejs6]"
exit 1
}
source /src/nodejs-install.sh
echo "$0 $1"
# start PostgreSQL
/etc/init.d/postgresql start
echo "Node.js version:"
echo "Node.js version: "
node -v
# install dependencies
NODEJS_VERSION=${1-nodejs10}
if [ "$NODEJS_VERSION" = "nodejs10" ];
then
echo "npm version on install:"
npm -v
npm ci
npm ls
elif [ "$NODEJS_VERSION" = "nodejs6" ];
if [ "$NODEJS_VERSION" = "6" ];
then
npm install -g yarn@0.27.5
echo "yarn version on install:"
yarn --version
yarn
else
usage
echo "npm version:"
npm -v
npm ci
npm ls
fi
# run tests
echo "npm version on tests:"
npm -v
npm test