<commit_before>#!/usr/bin/env bash

set -e
set -x

if [ "$TRAVIS_PULL_REQUEST_BRANCH" != "" ]; then
    BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
else
    BRANCH=$TRAVIS_BRANCH
fi
export BRANCH
docker rm -f qgis || true
docker run -d --name qgis -v /tmp/.X11-unix:/tmp/.X11-unix \
 -v `pwd`/../.:/tests_directory \
 -e DISPLAY=:99 \
 -e OQ_ENGINE_HOST='http://172.17.0.1:8800' \
 -e BRANCH="$BRANCH" \
 qgis/qgis:latest

docker exec -it qgis sh -c "apt update; DEBIAN_FRONTEND=noninteractive apt install -y python3-scipy python3-matplotlib python3-pyqt5.qtwebkit"

# FIXME: let the branch be parametric
docker exec -it qgis sh -c "git clone -q -b $BRANCH --depth=1 https://github.com/gem/oq-engine.git && echo 'Running against oq-engine/$BRANCH'"
# docker exec -it qgis sh -c "git clone -q -b master --depth=1 https://github.com/gem/oq-engine.git && echo 'Running against oq-engine/master'"

docker exec -it qgis sh -c "qgis_setup.sh svir"

docker exec -it qgis sh -c "cd /tests_directory && qgis_testrunner.sh svir.test.integration.test_drive_oq_engine"<commit_msg>Fallback to master if current branch is not found in engine repo<commit_after>#!/usr/bin/env bash

set -e

if [ "$TRAVIS_PULL_REQUEST_BRANCH" != "" ]; then
    BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
else
    BRANCH=$TRAVIS_BRANCH
fi
if [ "$(git ls-remote --heads https://github.com/gem/oq-engine.git ${BRANCH})" == "" ]; then
    BRANCH='master'
fi
export BRANCH

docker rm -f qgis || true
docker run -d --name qgis -v /tmp/.X11-unix:/tmp/.X11-unix \
 -v `pwd`/../.:/tests_directory \
 -e DISPLAY=:99 \
 -e OQ_ENGINE_HOST='http://172.17.0.1:8800' \
 -e BRANCH="$BRANCH" \
 qgis/qgis:latest

docker exec -it qgis sh -c "apt update; DEBIAN_FRONTEND=noninteractive apt install -y python3-scipy python3-matplotlib python3-pyqt5.qtwebkit"

# FIXME: let the branch be parametric
docker exec -it qgis sh -c "git clone -q -b $BRANCH --depth=1 https://github.com/gem/oq-engine.git && echo 'Running against oq-engine/$BRANCH'"
# docker exec -it qgis sh -c "git clone -q -b master --depth=1 https://github.com/gem/oq-engine.git && echo 'Running against oq-engine/master'"

docker exec -it qgis sh -c "qgis_setup.sh svir"

docker exec -it qgis sh -c "cd /tests_directory && qgis_testrunner.sh svir.test.integration.test_drive_oq_engine"
{'fraction_non_alphanumeric': 0.1474330846862659, 'fraction_numerical': 0.020184291355857833, 'mean_word_length': 3.6247464503042597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1189037', 'n_tokens_mistral': 960, 'n_tokens_neox': 915, 'n_words': 235}