This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 829
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from matrix-org/bwindels/ci_script
Make tests run on CI environment
- Loading branch information
Showing
13 changed files
with
180 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# run with PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true sh install.sh if chrome is already installed | ||
set -e | ||
./synapse/install.sh | ||
./riot/install.sh | ||
npm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"puppeteer": "^1.5.0" | ||
"puppeteer": "^1.6.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
#!/bin/bash | ||
RIOT_BRANCH=master | ||
|
||
BASE_DIR=$(realpath $(dirname $0)) | ||
pushd $BASE_DIR | ||
BASE_DIR=$(readlink -f $(dirname $0)) | ||
if [ -d $BASE_DIR/riot-web ]; then | ||
echo "riot is already installed" | ||
exit | ||
fi | ||
|
||
cd $BASE_DIR | ||
curl -L /~https://github.com/vector-im/riot-web/archive/${RIOT_BRANCH}.zip --output riot.zip | ||
unzip riot.zip | ||
unzip -q riot.zip | ||
rm riot.zip | ||
mv riot-web-${RIOT_BRANCH} riot-web | ||
cp config-template/config.json riot-web/ | ||
pushd riot-web | ||
cd riot-web | ||
npm install | ||
npm run build | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,51 @@ | ||
BASE_DIR=$(realpath $(dirname $0)) | ||
pushd $BASE_DIR | ||
pushd riot-web/webapp/ | ||
python -m SimpleHTTPServer 8080 & | ||
PID=$! | ||
popd | ||
echo $PID > riot.pid | ||
popd | ||
#!/bin/bash | ||
PORT=5000 | ||
BASE_DIR=$(readlink -f $(dirname $0)) | ||
PIDFILE=$BASE_DIR/riot.pid | ||
CONFIG_BACKUP=config.e2etests_backup.json | ||
|
||
if [ -f $PIDFILE ]; then | ||
exit | ||
fi | ||
|
||
cd $BASE_DIR/ | ||
echo -n "starting riot on http://localhost:$PORT ... " | ||
pushd riot-web/webapp/ > /dev/null | ||
|
||
# backup config file before we copy template | ||
if [ -f config.json ]; then | ||
mv config.json $CONFIG_BACKUP | ||
fi | ||
cp $BASE_DIR/config-template/config.json . | ||
|
||
LOGFILE=$(mktemp) | ||
# run web server in the background, showing output on error | ||
( | ||
python -m SimpleHTTPServer $PORT > $LOGFILE 2>&1 & | ||
PID=$! | ||
echo $PID > $PIDFILE | ||
# wait so subshell does not exit | ||
# otherwise sleep below would not work | ||
wait $PID; RESULT=$? | ||
|
||
# NOT expected SIGTERM (128 + 15) | ||
# from stop.sh? | ||
if [ $RESULT -ne 143 ]; then | ||
echo "failed" | ||
cat $LOGFILE | ||
rm $PIDFILE 2> /dev/null | ||
fi | ||
rm $LOGFILE | ||
exit $RESULT | ||
)& | ||
# to be able to return the exit code for immediate errors (like address already in use) | ||
# we wait for a short amount of time in the background and exit when the first | ||
# child process exists | ||
sleep 0.5 & | ||
# wait the first child process to exit (python or sleep) | ||
wait -n; RESULT=$? | ||
# return exit code of first child to exit | ||
if [ $RESULT -eq 0 ]; then | ||
echo "running" | ||
fi | ||
exit $RESULT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
BASE_DIR=$(realpath $(dirname $0)) | ||
pushd $BASE_DIR > /dev/null | ||
#!/bin/bash | ||
BASE_DIR=$(readlink -f $(dirname $0)) | ||
PIDFILE=riot.pid | ||
kill $(cat $PIDFILE) | ||
rm $PIDFILE | ||
popd > /dev/null | ||
CONFIG_BACKUP=config.e2etests_backup.json | ||
|
||
cd $BASE_DIR | ||
|
||
if [ -f $PIDFILE ]; then | ||
echo "stopping riot server ..." | ||
PID=$(cat $PIDFILE) | ||
rm $PIDFILE | ||
kill $PID | ||
|
||
# revert config file | ||
cd riot-web/webapp | ||
rm config.json | ||
if [ -f $CONFIG_BACKUP ]; then | ||
mv $CONFIG_BACKUP config.json | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
tmux \ | ||
new-session "sh riot/stop.sh; sh synapse/stop.sh; sh synapse/start.sh; sh riot/start.sh; read"\; \ | ||
split-window "sleep 5; node start.js; sh riot/stop.sh; sh synapse/stop.sh; read"\; \ | ||
select-layout even-vertical | ||
#!/bin/bash | ||
|
||
stop_servers() { | ||
./riot/stop.sh | ||
./synapse/stop.sh | ||
} | ||
|
||
handle_error() { | ||
EXIT_CODE=$? | ||
stop_servers | ||
exit $EXIT_CODE | ||
} | ||
|
||
trap 'handle_error' ERR | ||
|
||
./synapse/start.sh | ||
./riot/start.sh | ||
node start.js | ||
stop_servers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
BASE_DIR=$(realpath $(dirname $0)) | ||
pushd $BASE_DIR | ||
pushd installations/consent | ||
#!/bin/bash | ||
BASE_DIR=$(readlink -f $(dirname $0)) | ||
cd $BASE_DIR | ||
cd installations/consent | ||
source env/bin/activate | ||
./synctl start | ||
popd | ||
popd | ||
LOGFILE=$(mktemp) | ||
./synctl start 2> $LOGFILE | ||
EXIT_CODE=$? | ||
if [ $EXIT_CODE -ne 0 ]; then | ||
cat $LOGFILE | ||
fi | ||
exit $EXIT_CODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
BASE_DIR=$(realpath $(dirname $0)) | ||
pushd $BASE_DIR > /dev/null | ||
pushd installations/consent > /dev/null | ||
#!/bin/bash | ||
BASE_DIR=$(readlink -f $(dirname $0)) | ||
cd $BASE_DIR | ||
cd installations/consent | ||
source env/bin/activate | ||
./synctl stop | ||
popd > /dev/null | ||
popd > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters