Skip to content

Commit a443b17

Browse files
authored
Merge pull request #330 from crazyserver/node-version-fix
Check nvmrc node version names
2 parents ac805cd + 34203c6 commit a443b17

File tree

7 files changed

+53
-8
lines changed

7 files changed

+53
-8
lines changed

.gitpod/setup-env.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ fi
1818
# Clone Moodle repository.
1919
cd "${GITPOD_REPO_ROOT}" && git clone ${FASTCLONE} --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle
2020

21+
if [ -d "moodle/public" ];
22+
then
23+
MOODLE_PUBLIC_ROOT="moodle/public"
24+
else
25+
MOODLE_PUBLIC_ROOT="moodle"
26+
fi
27+
2128
# Download the data file (if given). It will be used to generate some data.
2229
if [ -n "$DATAFILE" ];
2330
then
24-
wget -O moodle/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature "${DATAFILE}"
31+
wget -O ${MOODLE_PUBLIC_ROOT}/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature "${DATAFILE}"
2532
fi
2633

2734
# Install adminer.

bin/moodle-docker-compose

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ fi
9898
if [[ -z "$MOODLE_DOCKER_APP_NODE_VERSION" ]] && [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]];
9999
then
100100
appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | sed -E "s/v(([0-9]+\.?)+)/\1/" || true)"
101+
appnodeversion="${appnodeversion//\//-}"
101102

102103
export MOODLE_DOCKER_APP_NODE_VERSION="$appnodeversion"
103104
fi

tests/app-setup.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
#!/usr/bin/env bash
22
set -e
33
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
4-
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/init.php"
54

65
export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
6+
if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
7+
then
8+
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
9+
else
10+
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
11+
fi
12+
713
export MOODLE_DOCKER_BROWSER=chrome
814
export MOODLE_DOCKER_DB=pgsql
915

16+
initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/init.php"
17+
1018
if [ "$SUITE" = "app-development" ];
1119
then
1220
export MOODLE_DOCKER_APP_PATH="${basedir}/app"
@@ -19,7 +27,8 @@ then
1927
echo -e "\nunsafe-perm=true" >> $basedir/app/.npmrc
2028
fi
2129

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

2433
docker run --volume $basedir/app:/app --workdir /app node:$nodeversion bash -c "npm ci"
2534
elif [ "$SUITE" = "app" ];

tests/app-test.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
77
export MOODLE_DOCKER_BROWSER=chrome
88
export MOODLE_DOCKER_DB=pgsql
99

10+
if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
11+
then
12+
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
13+
else
14+
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
15+
fi
16+
1017
if [ "$SUITE" = "app" ] || [ "$SUITE" = "app-development" ];
1118
then
12-
testcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/run.php --tags=@app&&@moodledocker"
19+
testcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/run.php --tags=@app&&@moodledocker"
1320
else
1421
echo "Error, unknown suite '$SUITE'"
1522
exit 1

tests/behat-setup.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
44

55
export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
66

7+
if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
8+
then
9+
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
10+
else
11+
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
12+
fi
13+
714
if [ "$SUITE" = "behat" ];
815
then
9-
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/init.php"
16+
initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/init.php"
1017
else
1118
echo "Error, unknown suite '$SUITE'"
1219
exit 1

tests/behat-test.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
55

66
export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
77

8+
if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
9+
then
10+
MOODLE_BEHAT_CLI_ROOT="public/admin/tool/behat/cli"
11+
else
12+
MOODLE_BEHAT_CLI_ROOT="admin/tool/behat/cli"
13+
fi
14+
815
if [ "$SUITE" = "behat" ];
916
then
10-
testcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/behat/cli/run.php --tags=@auth_manual"
17+
testcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_BEHAT_CLI_ROOT}/run.php --tags=@auth_manual"
1118
else
1219
echo "Error, unknown suite '$SUITE'"
1320
exit 1

tests/phpunit-setup.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
44

55
export MOODLE_DOCKER_WWWROOT="${basedir}/moodle"
66

7+
if [ -d "${MOODLE_DOCKER_WWWROOT}/public" ];
8+
then
9+
MOODLE_PHPUNIT_CLI_ROOT="public/admin/tool/phpunit/cli"
10+
else
11+
MOODLE_PHPUNIT_CLI_ROOT="admin/tool/phpunit/cli"
12+
fi
13+
714
if [ "$SUITE" = "phpunit" ];
815
then
9-
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/phpunit/cli/init.php"
16+
initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_PHPUNIT_CLI_ROOT}/init.php"
1017
elif [ "$SUITE" = "phpunit-full" ];
1118
then
1219
export MOODLE_DOCKER_PHPUNIT_EXTERNAL_SERVICES=true
1320
export MOODLE_DOCKER_MLBACKEND=true
14-
initcmd="bin/moodle-docker-compose exec -T webserver php admin/tool/phpunit/cli/init.php"
21+
initcmd="bin/moodle-docker-compose exec -T webserver php ${MOODLE_PHPUNIT_CLI_ROOT}/init.php"
1522
else
1623
echo "Error, unknown suite '$SUITE'"
1724
exit 1

0 commit comments

Comments
 (0)