Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitpod/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ fi
# Clone Moodle repository.
cd "${GITPOD_REPO_ROOT}" && git clone ${FASTCLONE} --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle

if [ -d "moodle/public" ];
then
MOODLE_PUBLIC_ROOT="moodle/public"
else
MOODLE_PUBLIC_ROOT="moodle"
fi

# Download the data file (if given). It will be used to generate some data.
if [ -n "$DATAFILE" ];
then
wget -O moodle/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature "${DATAFILE}"
wget -O ${MOODLE_PUBLIC_ROOT}/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature "${DATAFILE}"
fi

# Install adminer.
Expand Down
1 change: 1 addition & 0 deletions bin/moodle-docker-compose
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fi
if [[ -z "$MOODLE_DOCKER_APP_NODE_VERSION" ]] && [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]];
then
appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | sed -E "s/v(([0-9]+\.?)+)/\1/" || true)"
appnodeversion="${appnodeversion//\//-}"

export MOODLE_DOCKER_APP_NODE_VERSION="$appnodeversion"
fi
Expand Down
13 changes: 11 additions & 2 deletions tests/app-setup.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/usr/bin/env bash
set -e
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/init.php"

export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
then
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
else
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
fi

export MOODLE_DOCKER_BROWSER=chrome
export MOODLE_DOCKER_DB=pgsql

initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/init.php"

if [ "$SUITE" = "app-development" ];
then
export MOODLE_DOCKER_APP_PATH="${basedir}/app"
Expand All @@ -19,7 +27,8 @@ then
echo -e "\nunsafe-perm=true" >> $basedir/app/.npmrc
fi

nodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | grep -oP '(\d+\.?)+' || true)"
nodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | sed -E "s/v(([0-9]+\.?)+)/\1/" || true)"
nodeversion="${nodeversion//\//-}"

docker run --volume $basedir/app:/app --workdir /app node:$nodeversion bash -c "npm ci"
elif [ "$SUITE" = "app" ];
Expand Down
9 changes: 8 additions & 1 deletion tests/app-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
export MOODLE_DOCKER_BROWSER=chrome
export MOODLE_DOCKER_DB=pgsql

if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
then
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
else
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
fi

if [ "$SUITE" = "app" ] || [ "$SUITE" = "app-development" ];
then
testcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/run.php --tags=@app&&@moodledocker"
testcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/run.php --tags=@app&&@moodledocker"
else
echo "Error, unknown suite '$SUITE'"
exit 1
Expand Down
9 changes: 8 additions & 1 deletion tests/behat-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"

export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"

if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
then
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
else
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
fi

if [ "$SUITE" = "behat" ];
then
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/init.php"
initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/init.php"
else
echo "Error, unknown suite '$SUITE'"
exit 1
Expand Down
9 changes: 8 additions & 1 deletion tests/behat-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"

export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"

if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
then
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
else
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
fi

if [ "$SUITE" = "behat" ];
then
testcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/run.php --tags=@auth_manual"
testcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/run.php --tags=@auth_manual"
else
echo "Error, unknown suite '$SUITE'"
exit 1
Expand Down
11 changes: 9 additions & 2 deletions tests/phpunit-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"

export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"

if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
then
MOODLE_PHPUNIT_CLI_ROOT="public/admin/tool/phpunit/cli"
else
MOODLE_PHPUNIT_CLI_ROOT="admin/tool/phpunit/cli"
fi

if [ "$SUITE" = "phpunit" ];
then
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/phpunit/cli/init.php"
initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_PHPUNIT_CLI_ROOT}/init.php"
elif [ "$SUITE" = "phpunit-full" ];
then
export MOODLE_DOCKER_PHPUNIT_EXTERNAL_SERVICES=true
export MOODLE_DOCKER_MLBACKEND=true
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/phpunit/cli/init.php"
initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_PHPUNIT_CLI_ROOT}/init.php"
else
echo "Error, unknown suite '$SUITE'"
exit 1
Expand Down
Loading