Skip to content

Commit

Permalink
Attempt to support restructured directories
Browse files Browse the repository at this point in the history
TODO: Bats tests
  • Loading branch information
andrewnicols committed Oct 14, 2024
1 parent 3114715 commit 2ac2122
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
9 changes: 6 additions & 3 deletions runner/main/jobtypes/behat/behat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ function behat_to_env_file() {
SELENIUMURL_10

WEBSERVER
APACHE_DOCUMENT_ROOT
PUBLICROOT

IONICURL

Expand Down Expand Up @@ -144,6 +146,7 @@ function behat_check() {
# Behat job type init.
function behat_config() {
# Apply some defaults.
PUBLICROOT="${PUBLICROOT:-}"
RUNCOUNT="${RUNCOUNT:-1}"
BEHAT_SUITE="${BEHAT_SUITE:-}"
BEHAT_TAGS="${BEHAT_TAGS:-}"
Expand Down Expand Up @@ -229,7 +232,7 @@ function behat_initcmd() {

# Build the complete init command.
cmd=(
php admin/tool/behat/cli/init.php
php ${PUBLICROOT}admin/tool/behat/cli/init.php
"${initsuite}"
-j="${BEHAT_PARALLEL}"
--axe
Expand Down Expand Up @@ -451,7 +454,7 @@ function behat_main_command() {

# Let's build the complete behat command for the 1st (parallel) run.
_cmd=(
php admin/tool/behat/cli/run.php
php ${PUBLICROOT}admin/tool/behat/cli/run.php
)

# Add the options and profile.
Expand Down Expand Up @@ -527,7 +530,7 @@ function behat_rerun_command() {
# and, also, it automatically handles the file system links for the web server.
# (output is a little bit uglier, but consistent with the main run).
_reruncmd=(
php admin/tool/behat/cli/run.php --rerun
php ${PUBLICROOT}admin/tool/behat/cli/run.php --rerun
)

# Add the config, options and profile.
Expand Down
4 changes: 3 additions & 1 deletion runner/main/jobtypes/phpunit/phpunit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# PHPUnit needed variables to go to the env file.
function phpunit_to_env_file() {
local env=(
PUBLICROOT

DBTYPE
DBTAG
DBHOST
Expand Down Expand Up @@ -157,7 +159,7 @@ function phpunit_initcmd() {
local -n cmd=$1
cmd=(
php
admin/tool/phpunit/cli/init.php
${PUBLICROOT}admin/tool/phpunit/cli/init.php
)
}

Expand Down
6 changes: 5 additions & 1 deletion runner/main/modules/moodle-core-copy/moodle-core-copy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function moodle-core-copy_check() {
# Moodle core copy module config.
function moodle-core-copy_config() {
# Get the Moodle branch from code, so we can make decisions based on it.
MOODLE_BRANCH=$(grep "\$branch" "${CODEDIR}"/version.php | sed "s/';.*//" | sed "s/^\$.*'//")
if [[ -d "${CODEDIR}/public" ]]; then
MOODLE_BRANCH=$(grep "\$branch" "${CODEDIR}"/public/version.php | sed "s/';.*//" | sed "s/^\$.*'//")
else
MOODLE_BRANCH=$(grep "\$branch" "${CODEDIR}"/version.php | sed "s/';.*//" | sed "s/^\$.*'//")
fi
}

# Moodle core copy module setup.
Expand Down
4 changes: 3 additions & 1 deletion runner/main/modules/summary/summary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ function summary_setup() {
echo "== Build Id: ${BUILD_ID}"
echo "== Workspace: ${WORKSPACE}"
echo "== Code directory: ${CODEDIR}"
echo "== Public directory: ${PUBLICROOT}"
echo "== Shared directory: ${SHAREDDIR}"
echo "== APACHE_DOCUMENT_ROOT: ${APACHE_DOCUMENT_ROOT}"
echo "== UUID / Container suffix: ${UUID}"
echo "== Environment: ${ENVIROPATH}"
echo "== GIT commit: ${GIT_COMMIT}"

# Add all the summary information that the job type wants to add.
get_job_to_summary "${JOBTYPE}"
echo "============================================================================"
}
}
6 changes: 6 additions & 0 deletions runner/main/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ fi

# Base directory where the code is located.
CODEDIR="${CODEDIR:-${WORKSPACE}/moodle}"
APACHE_DOCUMENT_ROOT="${APACHE_DOCUMENT_ROOT:-/var/www/html}"
PUBLICROOT="${PUBLICROOT:-}"
if [[ -d "${CODEDIR}/public" ]]; then
PUBLICROOT="public/"
APACHE_DOCUMENT_ROOT="/var/www/html/public"
fi

# Fail if CODEDIR does not exist.
if [[ ! -d ${CODEDIR} ]]; then
Expand Down

0 comments on commit 2ac2122

Please sign in to comment.