From a84efdb8be869c548eef3e78123c54a928f37463 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Fri, 16 Jun 2017 21:11:54 +0200 Subject: [PATCH] Test npm deployment in CI --- .gitignore | 2 ++ .travis.yml | 3 +- .../{check_services.sh => check-services.sh} | 0 scripts/npm-deployment-test.sh | 35 +++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) rename scripts/{check_services.sh => check-services.sh} (100%) create mode 100755 scripts/npm-deployment-test.sh diff --git a/.gitignore b/.gitignore index a8d1d2b9..e9fe0ab2 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ notifications/ dist/ .nyc_output/ + +*.tgz diff --git a/.travis.yml b/.travis.yml index c60b10a5..a0ec104f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,9 @@ script: - docker-compose build - docker-compose up -d - sleep 5 -- ./scripts/check_services.sh +- ./scripts/check-services.sh - npm run int-test +- ./scripts/npm-deployment-test.sh after_success: - ./scripts/docker-publish.sh diff --git a/scripts/check_services.sh b/scripts/check-services.sh similarity index 100% rename from scripts/check_services.sh rename to scripts/check-services.sh diff --git a/scripts/npm-deployment-test.sh b/scripts/npm-deployment-test.sh new file mode 100755 index 00000000..868fb2b4 --- /dev/null +++ b/scripts/npm-deployment-test.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +NPM_UNPACK_DIR=/tmp/npm-unpack/test + +echo "Packing npm package into a tarball" +npm pack + +AUTHELIA_PACKAGE=`ls | grep "authelia-\([0-9]\+.\)\{2\}[0-9]\+.tgz"` +echo "Authelia package is ${AUTHELIA_PACKAGE}" + +echo "Copy package into "${NPM_UNPACK_DIR}" to test unpacking" +mkdir -p ${NPM_UNPACK_DIR} +cp ${AUTHELIA_PACKAGE} ${NPM_UNPACK_DIR} + +pushd ${NPM_UNPACK_DIR} + +echo "Test unpacking..." +npm install ${AUTHELIA_PACKAGE} + +RET_CODE=$? +# echo ${RET_CODE} + +popd + +if [ "$RET_CODE" != "0" ] +then + echo "Unpacking failed..." + exit 1 +else + echo "Unpacking succeeded" + exit 0 +fi + + +