feat: add package validator to CI

This commit is contained in:
Ruben Taelman 2020-09-01 11:15:00 +02:00 committed by Joachim Van Herwegen
parent ab8289a668
commit 7fae3203d5
2 changed files with 32 additions and 0 deletions

View File

@ -9,6 +9,7 @@ script:
- npm run lint - npm run lint
- npm run validate - npm run validate
- npm run test - npm run test
- .travis/validate-package.sh
after_success: after_success:
- npm run coveralls - npm run coveralls
cache: npm cache: npm

31
.travis/validate-package.sh Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Script to validate our packed package
npm pack
tar -xzf solid-community-server-*.tgz
pushd package
# Check if our server can start at a given port
node bin/server.js -p 8888 &
pid=$!
i=0
EXITCODE=0
until curl -s localhost:8888; do
sleep 1
# Try for at most 10 seconds, assume failure otherwise
let i++
if [ $i -gt 10 ]; then
echo "Server start timeout"
echo " Server may have failed to start, or is running at an unexpected port."
kill -9 $pid
EXITCODE=1
break;
fi
done > /dev/null
kill -9 $pid
popd
rm -r package
rm solid-community-server-*.tgz
exit $EXITCODE