Skip to content

Commit a32b321

Browse files
authored
Merge pull request #122 from NeillM/app
Mobile app support
2 parents 0b3dcfe + da0cde1 commit a32b321

File tree

9 files changed

+49
-0
lines changed

9 files changed

+49
-0
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,17 @@ env:
5555
- "PHP=7.1 DB=mariadb GIT=v3.8.0 SUITE=behat BROWSER=firefox"
5656
- "PHP=7.1 DB=mariadb GIT=v3.7.2 SUITE=behat BROWSER=chrome"
5757
- "PHP=7.0 DB=mariadb GIT=v3.5.8 SUITE=behat BROWSER=firefox"
58+
# Mobile app
59+
- "PHP=7.3 DB=pgsql GIT=master SUITE=app BROWSER=chrome MOBILE=next"
60+
- "PHP=7.3 DB=pgsql GIT=master SUITE=app BROWSER=chrome MOBILE=latest"
5861
install:
5962
- git clone --branch $GIT --depth 1 git://github.com/moodle/moodle $HOME/moodle
6063
- cp config.docker-template.php $HOME/moodle/config.php
6164
- export MOODLE_DOCKER_DB=$DB
6265
- export MOODLE_DOCKER_BROWSER=$BROWSER
6366
- export MOODLE_DOCKER_WWWROOT="$HOME/moodle"
6467
- export MOODLE_DOCKER_PHP_VERSION=$PHP
68+
- export MOODLE_APP_VERSION=$MOBILE
6569
before_script:
6670
- tests/setup.sh
6771
script:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ You can change the configuration of the docker images by setting various environ
134134
| `MOODLE_DOCKER_WEB_HOST` | no | any valid hostname | localhost | The hostname for web |
135135
| `MOODLE_DOCKER_WEB_PORT` | no | any integer value (or bind_ip:integer)| 127.0.0.1:8000| The port number for web. If set to 0, no port is used.<br/>If you want to bind to any host IP different from the default 127.0.0.1, you can specify it with the bind_ip:port format (0.0.0.0 means bind to all) |
136136
| `MOODLE_DOCKER_SELENIUM_VNC_PORT` | no | any integer value (or bind_ip:integer)| not set | If set, the selenium node will expose a vnc session on the port specified. Similar to MOODLE_DOCKER_WEB_PORT, you can optionally define the host IP to bind to. If you just set the port, VNC binds to 127.0.0.1 |
137+
| `MOODLE_APP_VERSION` | no | next, latest, or an app version number| not set | If set will start an instance of the Mmodle app if the chrome browser is selected |
137138

138139
## Advanced usage
139140

bin/moodle-docker-compose

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ if [ -f $filename ]; then
4444
dockercompose="${dockercompose} -f ${filename}"
4545
fi
4646

47+
# Mobile app
48+
if [[ ! -z "$MOODLE_DOCKER_BROWSER" ]] && [[ "$MOODLE_DOCKER_BROWSER" == "chrome" ]] && [[ ! -z "$MOODLE_APP_VERSION" ]];
49+
then
50+
dockercompose="${dockercompose} -f ${basedir}/moodle-app.yml"
51+
fi
52+
4753
# Selenium browser
4854
if [[ ! -z "$MOODLE_DOCKER_BROWSER" ]] && [[ "$MOODLE_DOCKER_BROWSER" != "firefox" ]];
4955
then

bin/moodle-docker-compose.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ if exist %filename% (
3434
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%filename%"
3535
)
3636

37+
IF "%MOODLE_DOCKER_BROWSER%"=="chrome" (
38+
IF NOT "%MOODLE_APP_VERSION%"=="" (
39+
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app.yml"
40+
)
41+
)
42+
3743
IF NOT "%MOODLE_DOCKER_BROWSER%"=="" (
3844
IF NOT "%MOODLE_DOCKER_BROWSER%"=="firefox" (
3945
SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\selenium.%MOODLE_DOCKER_BROWSER%.yml"

bin/moodle-docker-wait-for-app

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5+
6+
if [[ ! -z "$MOODLE_DOCKER_BROWSER" ]] && [[ "$MOODLE_DOCKER_BROWSER" == "chrome" ]] && [[ ! -z "$MOODLE_APP_VERSION" ]];
7+
then
8+
until $basedir/bin/moodle-docker-compose logs moodleapp | grep -q 'dev server running: ';
9+
do
10+
echo 'Waiting for Moodle app to come up...'
11+
sleep 15
12+
done
13+
fi

config.docker-template.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858

5959
define('PHPUNIT_LONGTEST', true);
6060

61+
if (getenv('MOODLE_DOCKER_APP')) {
62+
$CFG->behat_ionic_wwwroot = 'http://moodleapp:8100';
63+
}
64+
6165
if (getenv('MOODLE_DOCKER_PHPUNIT_EXTRAS')) {
6266
define('TEST_SEARCH_SOLR_HOSTNAME', 'solr');
6367
define('TEST_SEARCH_SOLR_INDEXNAME', 'test');

moodle-app.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: "2"
2+
services:
3+
webserver:
4+
environment:
5+
MOODLE_DOCKER_APP: "true"
6+
moodleapp:
7+
image: "moodlehq/moodleapp:${MOODLE_APP_VERSION}"

tests/setup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ elif [ "$SUITE" = "phpunit-full" ];
1212
then
1313
export MOODLE_DOCKER_PHPUNIT_EXTERNAL_SERVICES=true
1414
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/phpunit/cli/init.php"
15+
elif [ "$SUITE" = "app" ];
16+
then
17+
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/init.php"
1518
else
1619
echo "Error, unknown suite '$SUITE'"
1720
exit 1
@@ -23,5 +26,7 @@ echo "Starting up container"
2326
$basedir/bin/moodle-docker-compose up -d
2427
echo "Waiting for DB to come up"
2528
$basedir/bin/moodle-docker-wait-for-db
29+
echo "Waiting for Moodle app to come up"
30+
$basedir/bin/moodle-docker-wait-for-app
2631
echo "Running: $initcmd"
2732
$basedir/$initcmd

tests/test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ then
1212
elif [ "$SUITE" = "phpunit-full" ];
1313
then
1414
testcmd="bin/moodle-docker-compose exec -T webserver vendor/bin/phpunit --verbose"
15+
elif [ "$SUITE" = "app" ];
16+
then
17+
testcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/run.php --tags=@app"
1518
else
1619
echo "Error, unknown suite '$SUITE'"
1720
exit 1

0 commit comments

Comments
 (0)