From 57369d6f3c3b12d3761455817ab007f5a501a493 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Fri, 26 Jan 2024 19:33:56 +0100 Subject: [PATCH 01/27] Bump to actions/checkout@v4 actions/checkout@v3 uses nodejs 16 that is deprecated --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6653c5ce9f..998488a1861 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,10 +9,10 @@ jobs: steps: - name: Checking out moodle-docker - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checking out moodle - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: moodle/moodle path: moodle @@ -93,10 +93,10 @@ jobs: steps: - name: Checking out moodle-docker - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checking out moodle - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: moodle/moodle path: moodle @@ -184,10 +184,10 @@ jobs: steps: - name: Checking out moodle-docker - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checking out moodle - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: moodle/moodle path: moodle @@ -245,10 +245,10 @@ jobs: steps: - name: Checking out moodle-docker - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checking out moodle - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: moodle/moodle path: moodle From 3208eac30c92e9c30af2fe1bbd949c9fa6c1bd45 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 20 Feb 2024 15:01:36 +0100 Subject: [PATCH 02/27] Remove deprecated app variables --- bin/moodle-docker-compose | 11 ----------- bin/moodle-docker-compose.cmd | 8 -------- bin/moodle-docker-wait-for-app | 2 +- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index 5ae1bafaac0..107f9c6d97e 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -64,17 +64,6 @@ then fi fi -# Fix mobile app deprecated variables -if [ ! -z "$MOODLE_APP_VERSION" ]; -then - echo 'Warning: $MOODLE_APP_VERSION is deprecated, use $MOODLE_DOCKER_APP_VERSION instead' - - if [ -z "$MOODLE_DOCKER_APP_VERSION" ]; - then - export MOODLE_DOCKER_APP_VERSION="$MOODLE_APP_VERSION" - fi -fi - # Guess mobile app runtime if [ -z "$MOODLE_DOCKER_APP_RUNTIME" ]; then diff --git a/bin/moodle-docker-compose.cmd b/bin/moodle-docker-compose.cmd index 6db20cc944d..59aab4faad1 100644 --- a/bin/moodle-docker-compose.cmd +++ b/bin/moodle-docker-compose.cmd @@ -52,14 +52,6 @@ IF "%MOODLE_DOCKER_DB_PORT%"=="" ( ) ) -IF NOT "%MOODLE_APP_VERSION%"=="" ( - ECHO Warning: MOODLE_APP_VERSION is deprecated, use MOODLE_DOCKER_APP_VERSION instead - - IF "%MOODLE_DOCKER_APP_VERSION%"=="" ( - SET MOODLE_DOCKER_APP_VERSION=%MOODLE_APP_VERSION% - ) -) - IF "%MOODLE_DOCKER_APP_RUNTIME%"=="" ( SET MOODLE_DOCKER_APP_RUNTIME=ionic5 ) diff --git a/bin/moodle-docker-wait-for-app b/bin/moodle-docker-wait-for-app index 2ec82806148..0fabc4b692d 100755 --- a/bin/moodle-docker-wait-for-app +++ b/bin/moodle-docker-wait-for-app @@ -4,7 +4,7 @@ set -e thisfile=$( readlink "${BASH_SOURCE[0]}" ) || thisfile="${BASH_SOURCE[0]}" basedir="$( cd "$( dirname "$thisfile" )/../" && pwd -P )" -if [[ ! -z "$MOODLE_DOCKER_BROWSER" ]] && [[ "$MOODLE_DOCKER_BROWSER" == "chrome" ]] && ([[ ! -z "$MOODLE_DOCKER_APP_PATH" ]] || [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]] || [[ ! -z "$MOODLE_APP_VERSION" ]]); +if [[ ! -z "$MOODLE_DOCKER_BROWSER" ]] && [[ "$MOODLE_DOCKER_BROWSER" == "chrome" ]] && ([[ ! -z "$MOODLE_DOCKER_APP_PATH" ]] || [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]]); then until $basedir/bin/moodle-docker-compose logs moodleapp | grep -q -E 'dev server running: |Angular Live Development Server is listening|Configuration complete; ready for start up'; do From cb73fdd54d75e73a9ca79dd91ce972ce436d9ae4 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 20 Feb 2024 15:09:24 +0100 Subject: [PATCH 03/27] Remove selenium suffix for newer versions The -debug suffix has been deprecated in selenium v4 images --- bin/moodle-docker-compose | 6 +++++- bin/moodle-docker-compose.cmd | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index 107f9c6d97e..9e23b1212c4 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -154,7 +154,11 @@ fi export MOODLE_DOCKER_SELENIUM_SUFFIX="" if [[ $MOODLE_DOCKER_SELENIUM_VNC_PORT == *":"* ]] || [[ $MOODLE_DOCKER_SELENIUM_VNC_PORT -gt 0 ]] then - export MOODLE_DOCKER_SELENIUM_SUFFIX="-debug" + if [[ $(echo $MOODLE_DOCKER_BROWSER_TAG | sed 's/[^0-9].*//g') -lt 4 ]] + then + export MOODLE_DOCKER_SELENIUM_SUFFIX="-debug" + fi + # If no bind ip has been configured (bind_ip:port), default to 127.0.0.1 if [[ ! $MOODLE_DOCKER_SELENIUM_VNC_PORT == *":"* ]] then diff --git a/bin/moodle-docker-compose.cmd b/bin/moodle-docker-compose.cmd index 59aab4faad1..212820b1324 100644 --- a/bin/moodle-docker-compose.cmd +++ b/bin/moodle-docker-compose.cmd @@ -152,7 +152,9 @@ IF "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="" ( IF NOT "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="%MOODLE_DOCKER_SELENIUM_VNC_PORT::=%" SET TRUE=1 IF NOT "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="0" SET TRUE=1 IF DEFINED TRUE ( - SET MOODLE_DOCKER_SELENIUM_SUFFIX=-debug + IF "%MOODLE_DOCKER_BROWSER_TAG%"=="3" ( + SET MOODLE_DOCKER_SELENIUM_SUFFIX=-debug + ) SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\selenium.debug.yml" REM If no bind ip has been configured (bind_ip:port), default to 127.0.0.1 IF "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="%MOODLE_DOCKER_SELENIUM_VNC_PORT::=%" ( From 943997f7ca02f48481b053a8617394a80b0859c7 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 20 Feb 2024 15:32:37 +0100 Subject: [PATCH 04/27] Prepare app config for 4.4.0 The 4.4.0 release of the app changes some things that need to be updated in the Docker images. In particular, moving away from WebSQL (MOBILE-4304) introduced a requirement to run the application in a secure context; and the app will run with the https:// protocol on port 443 by default. The app also needs to run in a newer version of Chrome now; so when the app is being used it will default to version 120.0. These changes will be applied for the ionic7 runtime, which also changed in this release. This update to moodle-docker removes all the code related with the ionic3 runtime, which hasn't been used in the app since version 3.9.4 (December 2020). Given that this should work out of the box now, the documentation for the MOODLE_DOCKER_APP_RUNTIME and MOODLE_DOCKER_APP_NODE_VERSION variables has been removed. --- .github/workflows/ci.yml | 37 ++++++------- README.md | 8 ++- bin/moodle-docker-compose | 54 ++++++++++++------- bin/moodle-docker-compose.cmd | 50 ++++++++++++----- config.docker-template.php | 8 ++- moodle-app-dev-ionic5.yml | 19 ------- ...e-app-dev-ionic3.yml => moodle-app-dev.yml | 5 +- moodle-app-ionic3.yml | 7 --- moodle-app-ionic5.yml => moodle-app.yml | 5 +- tests/app-setup.sh | 19 +++---- tests/app-teardown.sh | 5 +- tests/app-test.sh | 2 + 12 files changed, 117 insertions(+), 102 deletions(-) delete mode 100644 moodle-app-dev-ionic5.yml rename moodle-app-dev-ionic3.yml => moodle-app-dev.yml (57%) delete mode 100644 moodle-app-ionic3.yml rename moodle-app-ionic5.yml => moodle-app.yml (51%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 998488a1861..d3a6c655179 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -224,24 +224,24 @@ jobs: include: # PostgreSQL (highest, lowest php supported) # First tests are for app developers. - - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, runtime: ionic5, suite: app-development, app-version: "latest"} - - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, runtime: ionic5, suite: app-development, app-version: "latest"} - - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, runtime: ionic5, suite: app-development, app-version: "main" } - - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, runtime: ionic5, suite: app-development, app-version: "main" } + - { branch: MOODLE_403_STABLE, php: "8.2", suite: app-development, app-version: "latest" } + - { branch: MOODLE_403_STABLE, php: "8.0", suite: app-development, app-version: "latest" } + - { branch: MOODLE_403_STABLE, php: "8.2", suite: app-development, app-version: "main" } + - { branch: MOODLE_403_STABLE, php: "8.0", suite: app-development, app-version: "main" } # Tests for Moodle plugin developers who want to test against the next version of the app. - - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, runtime: ionic5, suite: app, app-version: "next-dev"} - - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, runtime: ionic5, suite: app, app-version: "next-dev"} + - { branch: MOODLE_403_STABLE, php: "8.2", suite: app, app-version: "next-test" } + - { branch: MOODLE_403_STABLE, php: "8.0", suite: app, app-version: "next-test" } # Tests for Moodle plugin developers testing against all supported versions of Moodle. - - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_402_STABLE, php: "8.2", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_402_STABLE, php: "8.0", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_401_STABLE, php: "8.1", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_401_STABLE, php: "7.4", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_400_STABLE, php: "8.0", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_400_STABLE, php: "7.3", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_311_STABLE, php: "8.0", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} - - { branch: MOODLE_311_STABLE, php: "7.3", database: pgsql, runtime: ionic5, suite: app, app-version: "latest-dev"} + - { branch: MOODLE_403_STABLE, php: "8.2", suite: app, app-version: "latest-test" } + - { branch: MOODLE_403_STABLE, php: "8.0", suite: app, app-version: "latest-test" } + - { branch: MOODLE_402_STABLE, php: "8.2", suite: app, app-version: "latest-test" } + - { branch: MOODLE_402_STABLE, php: "8.0", suite: app, app-version: "latest-test" } + - { branch: MOODLE_401_STABLE, php: "8.1", suite: app, app-version: "latest-test" } + - { branch: MOODLE_401_STABLE, php: "7.4", suite: app, app-version: "latest-test" } + - { branch: MOODLE_400_STABLE, php: "8.0", suite: app, app-version: "latest-test" } + - { branch: MOODLE_400_STABLE, php: "7.3", suite: app, app-version: "latest-test" } + - { branch: MOODLE_311_STABLE, php: "8.0", suite: app, app-version: "latest-test" } + - { branch: MOODLE_311_STABLE, php: "7.3", suite: app, app-version: "latest-test" } steps: - name: Checking out moodle-docker @@ -257,22 +257,19 @@ jobs: - name: Prepare moodle-docker environment run: | cp config.docker-template.php moodle/config.php - export MOODLE_DOCKER_DB="${{ matrix.database }}" export MOODLE_DOCKER_PHP_VERSION="${{ matrix.php }}" export SUITE="${{ matrix.suite }}" - export RUNTIME="${{ matrix.runtime }}" export MOODLE_DOCKER_APP_VERSION="${{ matrix.app-version }}" tests/app-setup.sh - name: Run moodle-docker tests run: | - export MOODLE_DOCKER_DB="${{ matrix.database }}" + export MOODLE_DOCKER_APP_VERSION="${{ matrix.app-version }}" export SUITE="${{ matrix.suite }}" tests/app-test.sh - name: Stop moodle-docker run: | - export MOODLE_DOCKER_DB="${{ matrix.database }}" export SUITE="${{ matrix.suite }}" export MOODLE_DOCKER_APP_VERSION="${{ matrix.app-version }}" tests/app-teardown.sh diff --git a/README.md b/README.md index 4e8e0e4f7db..62f059f50ee 100644 --- a/README.md +++ b/README.md @@ -141,9 +141,9 @@ In order to run Behat tests for the Moodle App, you need to install the [local_m The Behat tests will be run against a container serving the mobile application, you have two options here: -1. Use a Docker image that includes the application code. You need to specify the `MOODLE_DOCKER_APP_VERSION` env variable and the [moodlehq/moodleapp](https://hub.docker.com/r/moodlehq/moodleapp) image will be downloaded from Docker Hub. You can read about the available images in [Moodle App Docker Images](https://docs.moodle.org/dev/Moodle_App_Docker_Images) (for Behat, you'll want to run the ones with the `-test` suffix). +1. Use a Docker image that includes the application code. You need to specify the `MOODLE_DOCKER_APP_VERSION` env variable and the [moodlehq/moodleapp](https://hub.docker.com/r/moodlehq/moodleapp) image will be downloaded from Docker Hub. You can read about the available images in [Moodle App Docker Images](https://moodledev.io/general/app/development/setup/docker-images) (for Behat, you'll want to run the ones with the `-test` suffix). -2. Use a local copy of the application code and serve it through Docker, similar to how the Moodle site is being served. Set the `MOODLE_DOCKER_APP_PATH` env variable to the codebase in you file system. This will assume that you've already initialized the app calling `npm install` and `npm run setup` locally. +2. Use a local copy of the application code and serve it through Docker, similar to how the Moodle site is being served. Set the `MOODLE_DOCKER_APP_PATH` env variable to the codebase in you file system. This will assume that you've already initialized the app calling `npm install` locally. For both options, you also need to set `MOODLE_DOCKER_BROWSER` to "chrome". @@ -175,7 +175,7 @@ If you are going with the second option, this *can* be used for local developmen By all means, if you don't want to have npm installed locally you can go full Docker executing the following commands before starting the containers: ``` -docker run --volume $MOODLE_DOCKER_APP_PATH:/app --workdir /app bash -c "npm install npm@7 -g && npm ci" +docker run --volume $MOODLE_DOCKER_APP_PATH:/app --workdir /app bash -c "npm install" ``` You can learn more about writing tests for the app in [Acceptance testing for the Moodle App](https://moodledev.io/general/app/development/testing/acceptance-testing). @@ -223,8 +223,6 @@ When you change them, use `bin/moodle-docker-compose down && bin/moodle-docker-c | `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 | | `MOODLE_DOCKER_APP_PATH` | no | path on your file system | not set | If set and the chrome browser is selected, it will start an instance of the Moodle app from your local codebase | | `MOODLE_DOCKER_APP_VERSION` | no | a valid [app docker image version](https://docs.moodle.org/dev/Moodle_App_Docker_images) | not set | If set will start an instance of the Moodle app if the chrome browser is selected | -| `MOODLE_DOCKER_APP_RUNTIME` | no | 'ionic3' or 'ionic5' | not set | Set this to indicate the runtime being used in the Moodle app. In most cases, this can be ignored because the runtime is guessed automatically (except on Windows using the `.cmd` binary). In case you need to set it manually and you're not sure which one it is, versions 3.9.5 and later should be using Ionic 5. | -| `MOODLE_DOCKER_APP_NODE_VERSION` | no | [node](https://hub.docker.com/_/node) image version tag | not set | Node version to run the app. In most cases, this can be ignored because the version is parsed from the project's `.nvmrc` file. This will only be used when the runtime is `ionic5` and the app is running from the local filesystem. | ## Local customisations diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index 9e23b1212c4..28a9e40192b 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -81,33 +81,46 @@ then then appmajorversion="$(echo $appversion | grep -oP '\d(?=\.\d\.\d{1,2})')" appminorversion="$(echo $appversion | grep -oP '\d\.\K\d(?=\.\d{1,2})')" - apppatchversion="$(echo $appversion | grep -oP '\d\.\d\.\K\d{1,2}')" - if (( $appmajorversion > 3 )); + if (( $appmajorversion > 4 || $appminorversion > 3)); then - export MOODLE_DOCKER_APP_RUNTIME="ionic5" - elif (( $appminorversion != 9)); - then - export MOODLE_DOCKER_APP_RUNTIME="ionic3" - elif (( $apppatchversion < 5 )); - then - export MOODLE_DOCKER_APP_RUNTIME="ionic3" + export MOODLE_DOCKER_APP_RUNTIME="ionic7" else export MOODLE_DOCKER_APP_RUNTIME="ionic5" fi else - export MOODLE_DOCKER_APP_RUNTIME="ionic5" + export MOODLE_DOCKER_APP_RUNTIME="ionic7" fi fi fi -# Guess mobile app node version -if [[ -z "$MOODLE_DOCKER_APP_NODE_VERSION" ]] && [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]] && [[ "$MOODLE_DOCKER_APP_RUNTIME" == "ionic5" ]]; +# Guess mobile app node version (only for local app development) +if [[ -z "$MOODLE_DOCKER_APP_NODE_VERSION" ]] && [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]]; +then + appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | grep -oP '(\d+\.?)+' || true)" + + export MOODLE_DOCKER_APP_NODE_VERSION="$appnodeversion" +fi + +# Guess mobile app port (only when using Docker app images) +if [[ -z "$MOODLE_DOCKER_APP_PORT" ]] && [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]]; then - if [ -f "$MOODLE_DOCKER_APP_PATH/.nvmrc" ]; then - appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | grep -oP '(\d+\.?)+' || true)" + if [[ "$MOODLE_DOCKER_APP_RUNTIME" = "ionic5" ]]; + then + export MOODLE_DOCKER_APP_PORT="80" + else + export MOODLE_DOCKER_APP_PORT="443" + fi +fi - export MOODLE_DOCKER_APP_NODE_VERSION="$appnodeversion" +# Guess mobile app protocol +if [[ -z "$MOODLE_DOCKER_APP_PROTOCOL" ]]; +then + if [[ "$MOODLE_DOCKER_APP_RUNTIME" = "ionic5" ]]; + then + export MOODLE_DOCKER_APP_PROTOCOL="http" + else + export MOODLE_DOCKER_APP_PROTOCOL="https" fi fi @@ -128,7 +141,12 @@ then MOODLE_DOCKER_BROWSER_TAG=3 elif [[ "$MOODLE_DOCKER_BROWSER_NAME" = "chrome" ]]; then - MOODLE_DOCKER_BROWSER_TAG=3 + if [[ "$MOODLE_DOCKER_APP_RUNTIME" = "ionic5" ]]; + then + MOODLE_DOCKER_BROWSER_TAG=3 + else + MOODLE_DOCKER_BROWSER_TAG="120.0" + fi fi fi @@ -137,11 +155,11 @@ if [[ "$MOODLE_DOCKER_BROWSER_NAME" == "chrome" ]]; then if [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]]; then - dockercompose="${dockercompose} -f ${basedir}/moodle-app-dev-$MOODLE_DOCKER_APP_RUNTIME.yml" + dockercompose="${dockercompose} -f ${basedir}/moodle-app-dev.yml" elif [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]]; then # Mobile app using a docker image - dockercompose="${dockercompose} -f ${basedir}/moodle-app-$MOODLE_DOCKER_APP_RUNTIME.yml" + dockercompose="${dockercompose} -f ${basedir}/moodle-app.yml" fi fi diff --git a/bin/moodle-docker-compose.cmd b/bin/moodle-docker-compose.cmd index 212820b1324..7754c6af65d 100644 --- a/bin/moodle-docker-compose.cmd +++ b/bin/moodle-docker-compose.cmd @@ -53,26 +53,44 @@ IF "%MOODLE_DOCKER_DB_PORT%"=="" ( ) IF "%MOODLE_DOCKER_APP_RUNTIME%"=="" ( - SET MOODLE_DOCKER_APP_RUNTIME=ionic5 + SET MOODLE_DOCKER_APP_RUNTIME=ionic7 ) -REM Guess mobile app node version +REM Guess mobile app node version (only for local app development) IF "%MOODLE_DOCKER_APP_NODE_VERSION%"=="" ( IF NOT "%MOODLE_DOCKER_APP_PATH%"=="" ( - IF "%MOODLE_DOCKER_APP_RUNTIME%"=="ionic5" ( - SET filenvmrc=%MOODLE_DOCKER_APP_PATH%\.nvmrc - IF EXIST "%filenvmrc%" ( - SET /p NODE_VERSION=< "%filenvmrc%" - SET NODE_VERSION=%NODE_VERSION:v=% - ECHO %NODE_VERSION% | FINDSTR /r "[0-9.]*" >nul 2>&1 - IF ERRORLEVEL 0 ( - SET MOODLE_DOCKER_APP_NODE_VERSION=%NODE_VERSION% - ) + SET filenvmrc=%MOODLE_DOCKER_APP_PATH%\.nvmrc + IF EXIST "%filenvmrc%" ( + SET /p NODE_VERSION=< "%filenvmrc%" + SET NODE_VERSION=%NODE_VERSION:v=% + ECHO %NODE_VERSION% | FINDSTR /r "[0-9.]*" >nul 2>&1 + IF ERRORLEVEL 0 ( + SET MOODLE_DOCKER_APP_NODE_VERSION=%NODE_VERSION% ) ) ) ) +REM Guess mobile app port (only when using Docker app images) +IF "%MOODLE_DOCKER_APP_PORT%"=="" ( + IF NOT "%MOODLE_DOCKER_APP_VERSION%"=="" ( + IF "%MOODLE_DOCKER_APP_RUNTIME%"=="ionic5" ( + SET MOODLE_DOCKER_APP_PORT=80 + ) ELSE ( + SET MOODLE_DOCKER_APP_PORT=443 + ) + ) +) + +REM Guess mobile app protocol +IF "%MOODLE_DOCKER_APP_PROTOCOL%"=="" ( + if "%MOODLE_DOCKER_APP_RUNTIME%"=="ionic5" ( + SET MOODLE_DOCKER_APP_PROTOCOL=http + ) ELSE ( + SET MOODLE_DOCKER_APP_PROTOCOL=https + ) +) + IF NOT "%MOODLE_DOCKER_BROWSER%"=="" ( REM Split MOODLE_DOCKER_BROWSER by : to get selenium tag if sepecified FOR /f "tokens=1,2 delims=:" %%i in ("%MOODLE_DOCKER_BROWSER%") do ( @@ -90,15 +108,19 @@ IF "%MOODLE_DOCKER_BROWSER_TAG%"=="" ( SET MOODLE_DOCKER_BROWSER_TAG=3 ) IF "%MOODLE_DOCKER_BROWSER_NAME%"=="chrome" ( - SET MOODLE_DOCKER_BROWSER_TAG=3 + IF "%MOODLE_DOCKER_APP_RUNTIME%"=="ionic5" ( + SET MOODLE_DOCKER_BROWSER_TAG=3 + ) ELSE ( + SET MOODLE_DOCKER_BROWSER_TAG=120.0 + ) ) ) IF "%MOODLE_DOCKER_BROWSER_NAME%"=="chrome" ( IF NOT "%MOODLE_DOCKER_APP_PATH%"=="" ( - SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app-dev-%MOODLE_DOCKER_APP_RUNTIME%.yml" + SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app-dev.yml" ) ELSE IF NOT "%MOODLE_DOCKER_APP_VERSION%"=="" ( - SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app-%MOODLE_DOCKER_APP_RUNTIME%.yml" + SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\moodle-app.yml" ) ) diff --git a/config.docker-template.php b/config.docker-template.php index 00efa0ca014..ebed286f824 100644 --- a/config.docker-template.php +++ b/config.docker-template.php @@ -85,8 +85,14 @@ if (getenv('MOODLE_DOCKER_APP')) { $appport = getenv('MOODLE_DOCKER_APP_PORT') ?: 8100; + $protocol = getenv('MOODLE_DOCKER_APP_PROTOCOL') ?: 'https'; - $CFG->behat_ionic_wwwroot = "http://moodleapp:$appport"; + $CFG->behat_ionic_wwwroot = "$protocol://moodleapp:$appport"; + $CFG->behat_profiles['default']['capabilities'] = [ + 'extra_capabilities' => [ + 'chromeOptions' => ['args' => ['--ignore-certificate-errors', '--allow-running-insecure-content']], + ], + ]; } if (getenv('MOODLE_DOCKER_PHPUNIT_EXTRAS')) { diff --git a/moodle-app-dev-ionic5.yml b/moodle-app-dev-ionic5.yml deleted file mode 100644 index 43cb7ff1727..00000000000 --- a/moodle-app-dev-ionic5.yml +++ /dev/null @@ -1,19 +0,0 @@ -version: "2" -services: - webserver: - environment: - MOODLE_DOCKER_APP: "true" - moodleapp: - image: node:${MOODLE_DOCKER_APP_NODE_VERSION:-14} - working_dir: /app - command: npm start -- --host 0.0.0.0 - volumes: - - "${MOODLE_DOCKER_APP_PATH}:/app" - expose: - - 8100 - - 35729 - - 53703 - ports: - - "8100:8100" - - "35729:35729" - - "53703:53703" diff --git a/moodle-app-dev-ionic3.yml b/moodle-app-dev.yml similarity index 57% rename from moodle-app-dev-ionic3.yml rename to moodle-app-dev.yml index 7fd566a5d24..7875350da0b 100644 --- a/moodle-app-dev-ionic3.yml +++ b/moodle-app-dev.yml @@ -3,10 +3,11 @@ services: webserver: environment: MOODLE_DOCKER_APP: "true" + MOODLE_DOCKER_APP_PROTOCOL: ${MOODLE_DOCKER_APP_PROTOCOL} moodleapp: - image: node:11 + image: node:${MOODLE_DOCKER_APP_NODE_VERSION} working_dir: /app - command: npm run ionic:serve + command: [ "bash", "-c", "git config --global --add safe.directory /app && npm start -- --host 0.0.0.0"] volumes: - "${MOODLE_DOCKER_APP_PATH}:/app" expose: diff --git a/moodle-app-ionic3.yml b/moodle-app-ionic3.yml deleted file mode 100644 index cbadebb1c06..00000000000 --- a/moodle-app-ionic3.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: "2" -services: - webserver: - environment: - MOODLE_DOCKER_APP: "true" - moodleapp: - image: "moodlehq/moodleapp:${MOODLE_DOCKER_APP_VERSION}" diff --git a/moodle-app-ionic5.yml b/moodle-app.yml similarity index 51% rename from moodle-app-ionic5.yml rename to moodle-app.yml index b18c1928ef7..30a4d910be8 100644 --- a/moodle-app-ionic5.yml +++ b/moodle-app.yml @@ -3,8 +3,9 @@ services: webserver: environment: MOODLE_DOCKER_APP: "true" - MOODLE_DOCKER_APP_PORT: 80 + MOODLE_DOCKER_APP_PORT: ${MOODLE_DOCKER_APP_PORT} + MOODLE_DOCKER_APP_PROTOCOL: ${MOODLE_DOCKER_APP_PROTOCOL} moodleapp: image: "moodlehq/moodleapp:${MOODLE_DOCKER_APP_VERSION}" ports: - - "8100:80" + - "8100:$MOODLE_DOCKER_APP_PORT" diff --git a/tests/app-setup.sh b/tests/app-setup.sh index 9e16f3fdd82..6245dadd5e6 100755 --- a/tests/app-setup.sh +++ b/tests/app-setup.sh @@ -4,7 +4,8 @@ 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" -export MOODLE_DOCKER_BROWSER="chrome" +export MOODLE_DOCKER_BROWSER=chrome +export MOODLE_DOCKER_DB=pgsql if [ "$SUITE" = "app-development" ]; then @@ -13,18 +14,14 @@ then git clone --branch "$MOODLE_DOCKER_APP_VERSION" --depth 1 https://github.com/moodlehq/moodleapp $basedir/app git clone --branch "$MOODLE_DOCKER_APP_VERSION" --depth 1 https://github.com/moodlehq/moodle-local_moodleappbehat $basedir/moodle/local/moodleappbehat - if [[ $RUNTIME = ionic5 ]]; + if [[ ! -f $basedir/app/.npmrc || -z "$(cat $basedir/app/.npmrc | grep unsafe-perm)" ]]; then - if [[ ! -f $basedir/app/.npmrc || -z "$(cat $basedir/app/.npmrc | grep unsafe-perm)" ]]; - then - echo -e "\nunsafe-perm=true" >> $basedir/app/.npmrc - fi - - docker run --volume $basedir/app:/app --workdir /app node:14 bash -c "npm ci" - else - docker run --volume $basedir/app:/app --workdir /app node:11 npm run setup - docker run --volume $basedir/app:/app --workdir /app node:11 npm ci + echo -e "\nunsafe-perm=true" >> $basedir/app/.npmrc fi + + nodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | grep -oP '(\d+\.?)+' || true)" + + docker run --volume $basedir/app:/app --workdir /app node:$nodeversion bash -c "npm ci" elif [ "$SUITE" = "app" ]; then isdevelop=`echo $MOODLE_DOCKER_APP_VERSION | grep -E -o "(next)|(latest)"` diff --git a/tests/app-teardown.sh b/tests/app-teardown.sh index c06960e1a09..06f40ce3f93 100755 --- a/tests/app-teardown.sh +++ b/tests/app-teardown.sh @@ -4,14 +4,13 @@ basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" export MOODLE_DOCKER_WWWROOT="${basedir}/moodle" export MOODLE_DOCKER_BROWSER="chrome" +export MOODLE_DOCKER_DB=pgsql if [ "$SUITE" = "app-development" ]; then export MOODLE_DOCKER_APP_PATH="${basedir}/app" -elif [ "$SUITE" = "app" ]; +elif [ "$SUITE" != "app" ]; then - echo -else echo "Error, unknown suite '$SUITE'" exit 1 fi diff --git a/tests/app-test.sh b/tests/app-test.sh index e778998959f..a0189b1dd31 100755 --- a/tests/app-test.sh +++ b/tests/app-test.sh @@ -4,6 +4,8 @@ set -e basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" export MOODLE_DOCKER_WWWROOT="${basedir}/moodle" +export MOODLE_DOCKER_BROWSER=chrome +export MOODLE_DOCKER_DB=pgsql if [ "$SUITE" = "app" ] || [ "$SUITE" = "app-development" ]; then From 33022b620ce79614601e6d470e73a1bacc91d354 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 20 Feb 2024 15:33:53 +0100 Subject: [PATCH 05/27] Use ionic5 runtime in the interim before 4.4.0 --- bin/moodle-docker-compose | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index 28a9e40192b..d1e831faa89 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -89,7 +89,13 @@ then export MOODLE_DOCKER_APP_RUNTIME="ionic5" fi else - export MOODLE_DOCKER_APP_RUNTIME="ionic7" + # TODO always default to ionic7 after 4.4.0 release + if [[ $appversion = "latest"* ]]; + then + export MOODLE_DOCKER_APP_RUNTIME="ionic5" + else + export MOODLE_DOCKER_APP_RUNTIME="ionic7" + fi fi fi fi From fb86296ffaba59f10e3d7e7aa9ffe6a59fb98ed2 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Tue, 12 Mar 2024 11:59:07 +0100 Subject: [PATCH 06/27] #188 Fix scripts in MacOS `grep -P` is not supported in MacOS, replacing it with `sed` should work everywhere. --- bin/moodle-docker-compose | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index d1e831faa89..ee0078ce855 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -69,7 +69,7 @@ if [ -z "$MOODLE_DOCKER_APP_RUNTIME" ]; then if [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]]; then - appversion="$(cat $MOODLE_DOCKER_APP_PATH/package.json | grep -oP '"version": "\K\d\.\d\.\d{1,2}(-\w+)?(?=")')" + appversion="$(cat $MOODLE_DOCKER_APP_PATH/package.json | sed -n -E 's/\s*"version": "([0-9]+\.[0-9]+\.[0-9]+)(.*)?",/\1/p')" elif [[ ! -z "$MOODLE_DOCKER_APP_VERSION" ]]; then appversion=$MOODLE_DOCKER_APP_VERSION @@ -77,10 +77,10 @@ then if [[ ! -z $appversion ]]; then - if [[ ! -z "$(echo $appversion | grep -oP '\d\.\d\.\d{1,2}')" ]]; + if [[ ! -z "$(echo $appversion | sed -n -E 's/([0-9]+\.[0-9]+\.[0-9]+)/\1/p')" ]]; then - appmajorversion="$(echo $appversion | grep -oP '\d(?=\.\d\.\d{1,2})')" - appminorversion="$(echo $appversion | grep -oP '\d\.\K\d(?=\.\d{1,2})')" + appmajorversion="$(echo $appversion | sed -n -E 's/([0-9]+)\.[0-9]+\.[0-9]+/\1/p')" + appminorversion="$(echo $appversion | sed -n -E 's/[0-9]+\.([0-9]+)\.[0-9]+/\1/p')" if (( $appmajorversion > 4 || $appminorversion > 3)); then @@ -103,7 +103,7 @@ fi # Guess mobile app node version (only for local app development) if [[ -z "$MOODLE_DOCKER_APP_NODE_VERSION" ]] && [[ ! -z "$MOODLE_DOCKER_APP_PATH" ]]; then - appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | grep -oP '(\d+\.?)+' || true)" + appnodeversion="$(cat $MOODLE_DOCKER_APP_PATH/.nvmrc | sed -E "s/v(([0-9]+\.?)+)/\1/" || true)" export MOODLE_DOCKER_APP_NODE_VERSION="$appnodeversion" fi From 059ab56ef9ac0fe8b82f87cf803b1d6b071a35f9 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 13 Mar 2024 10:56:55 +0100 Subject: [PATCH 07/27] Bump main jobs to php 8.3, now supported This is part of the PHP 8.3 Epic: MDL-76426 --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3a6c655179..b04febe2a6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: matrix: include: # PostgreSQL (highest, lowest php supported) - - { branch: main, php: "8.2", database: pgsql, suite: phpunit-full } # Full run only for main. + - { branch: main, php: "8.3", database: pgsql, suite: phpunit-full } # Full run only for main. - { branch: main, php: "8.1", database: pgsql, suite: phpunit-full } - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, suite: phpunit } # Other branches, quicker run. - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, suite: phpunit } @@ -66,7 +66,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.2", database: mariadb, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.2", database: mariadb, suite: phpunit } # Other databases (highest php supported) - - { branch: main, php: "8.2", database: mssql, suite: phpunit } + - { branch: main, php: "8.3", database: mssql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: mssql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: mssql, suite: phpunit } - { branch: MOODLE_401_STABLE, php: "8.1", database: mssql, suite: phpunit } @@ -74,7 +74,7 @@ jobs: - { branch: MOODLE_311_STABLE, php: "8.0", database: mssql, suite: phpunit } - { branch: MOODLE_310_STABLE, php: "7.4", database: mssql, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.4", database: mssql, suite: phpunit } - - { branch: main, php: "8.2", database: mysql, suite: phpunit } + - { branch: main, php: "8.3", database: mysql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: mysql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: mysql, suite: phpunit } - { branch: MOODLE_401_STABLE, php: "8.1", database: mysql, suite: phpunit } @@ -82,7 +82,7 @@ jobs: - { branch: MOODLE_311_STABLE, php: "8.0", database: mysql, suite: phpunit } - { branch: MOODLE_310_STABLE, php: "7.4", database: mysql, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.4", database: mysql, suite: phpunit } - - { branch: main, php: "8.2", database: oracle, suite: phpunit } + - { branch: main, php: "8.3", database: oracle, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: oracle, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: oracle, suite: phpunit } - { branch: MOODLE_401_STABLE, php: "8.1", database: oracle, suite: phpunit } @@ -131,7 +131,7 @@ jobs: matrix: include: # PostgreSQL (highest, lowest php supported) - - { branch: main, php: "8.2", database: pgsql, browser: chrome, suite: behat } + - { branch: main, php: "8.3", database: pgsql, browser: chrome, suite: behat } - { branch: main, php: "8.1", database: pgsql, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, browser: chrome, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, browser: firefox, suite: behat } @@ -157,7 +157,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.2", database: mariadb, browser: firefox, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.2", database: mariadb, browser: chrome, suite: behat } # Other databases (highest php supported") - - { branch: main, php: "8.2", database: mssql, browser: firefox, suite: behat } + - { branch: main, php: "8.3", database: mssql, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_401_STABLE, php: "8.1", database: mssql, browser: firefox, suite: behat } @@ -165,7 +165,7 @@ jobs: - { branch: MOODLE_311_STABLE, php: "8.0", database: mssql, browser: firefox, suite: behat } - { branch: MOODLE_310_STABLE, php: "7.4", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.4", database: mssql, browser: firefox, suite: behat } - - { branch: main, php: "8.2", database: mysql, browser: chrome, suite: behat } + - { branch: main, php: "8.3", database: mysql, browser: chrome, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_401_STABLE, php: "8.1", database: mysql, browser: chrome, suite: behat } @@ -173,7 +173,7 @@ jobs: - { branch: MOODLE_311_STABLE, php: "8.0", database: mysql, browser: chrome, suite: behat } - { branch: MOODLE_310_STABLE, php: "7.4", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.4", database: mysql, browser: chrome, suite: behat } - - { branch: main, php: "8.2", database: oracle, browser: firefox, suite: behat } + - { branch: main, php: "8.3", database: oracle, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_401_STABLE, php: "8.1", database: oracle, browser: firefox, suite: behat } From 3b1683c20df3d1fb8fa3f5ce4f6eb003a7544d80 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 20 Mar 2024 11:56:23 +0000 Subject: [PATCH 08/27] Remove obsolete version attribute from compose files. `WARN[0000] : `version` is obsolete` --- base.yml | 1 - bbb-mock.yml | 1 - behat-faildump.yml | 1 - db.mariadb.port.yml | 1 - db.mariadb.yml | 1 - db.mssql.port.yml | 1 - db.mssql.yml | 1 - db.mysql.5.6.yml | 1 - db.mysql.5.7.yml | 1 - db.mysql.port.yml | 1 - db.mysql.yml | 1 - db.oracle.port.yml | 1 - db.oracle.yml | 1 - db.pgsql.port.yml | 1 - db.pgsql.yml | 1 - matrix-mock.yml | 1 - moodle-app-dev.yml | 1 - moodle-app.yml | 1 - phpunit-external-services.yml | 1 - selenium.chrome.yml | 1 - selenium.debug.yml | 1 - service.mail.yml | 1 - volumes-cached.yml | 1 - webserver.port.yml | 1 - 24 files changed, 24 deletions(-) diff --git a/base.yml b/base.yml index f736b8fe7e5..28414bdf641 100644 --- a/base.yml +++ b/base.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: image: "moodlehq/moodle-php-apache:${MOODLE_DOCKER_PHP_VERSION}" diff --git a/bbb-mock.yml b/bbb-mock.yml index dbc5c134665..5488a84cf01 100644 --- a/bbb-mock.yml +++ b/bbb-mock.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/behat-faildump.yml b/behat-faildump.yml index ee315d59fe4..d70e23a7d79 100644 --- a/behat-faildump.yml +++ b/behat-faildump.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: volumes: diff --git a/db.mariadb.port.yml b/db.mariadb.port.yml index a6b6242e305..076d2e6470a 100644 --- a/db.mariadb.port.yml +++ b/db.mariadb.port.yml @@ -1,4 +1,3 @@ -version: "2" services: db: ports: diff --git a/db.mariadb.yml b/db.mariadb.yml index d463011e6a6..b355dee9049 100644 --- a/db.mariadb.yml +++ b/db.mariadb.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/db.mssql.port.yml b/db.mssql.port.yml index 5b5be0b1b24..799bd320bfb 100644 --- a/db.mssql.port.yml +++ b/db.mssql.port.yml @@ -1,4 +1,3 @@ -version: "2" services: db: ports: diff --git a/db.mssql.yml b/db.mssql.yml index 08437ac598a..f863d19ebac 100644 --- a/db.mssql.yml +++ b/db.mssql.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/db.mysql.5.6.yml b/db.mysql.5.6.yml index 9ed145e4f90..2738b1867b8 100644 --- a/db.mysql.5.6.yml +++ b/db.mysql.5.6.yml @@ -1,4 +1,3 @@ -version: "2" services: db: image: mysql:${MOODLE_DOCKER_DB_VERSION:-5.6} diff --git a/db.mysql.5.7.yml b/db.mysql.5.7.yml index 2acc0d59503..db939bb58ea 100644 --- a/db.mysql.5.7.yml +++ b/db.mysql.5.7.yml @@ -1,4 +1,3 @@ -version: "2" services: db: image: mysql:${MOODLE_DOCKER_DB_VERSION:-5.7} diff --git a/db.mysql.port.yml b/db.mysql.port.yml index a6b6242e305..076d2e6470a 100644 --- a/db.mysql.port.yml +++ b/db.mysql.port.yml @@ -1,4 +1,3 @@ -version: "2" services: db: ports: diff --git a/db.mysql.yml b/db.mysql.yml index 45854f2d718..d0f49e9b02c 100644 --- a/db.mysql.yml +++ b/db.mysql.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/db.oracle.port.yml b/db.oracle.port.yml index c2f9ea7ce75..cefd3d271ea 100644 --- a/db.oracle.port.yml +++ b/db.oracle.port.yml @@ -1,4 +1,3 @@ -version: "2" services: db: ports: diff --git a/db.oracle.yml b/db.oracle.yml index 348d4eabc5a..83a6f040ab0 100644 --- a/db.oracle.yml +++ b/db.oracle.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/db.pgsql.port.yml b/db.pgsql.port.yml index 0bec6b5ec4f..90c8e4a037c 100644 --- a/db.pgsql.port.yml +++ b/db.pgsql.port.yml @@ -1,4 +1,3 @@ -version: "2" services: db: ports: diff --git a/db.pgsql.yml b/db.pgsql.yml index f5fa6057c09..4986f38006e 100644 --- a/db.pgsql.yml +++ b/db.pgsql.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/matrix-mock.yml b/matrix-mock.yml index 2040132d632..8bf9e6b5bd5 100644 --- a/matrix-mock.yml +++ b/matrix-mock.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/moodle-app-dev.yml b/moodle-app-dev.yml index 7875350da0b..98daf958885 100644 --- a/moodle-app-dev.yml +++ b/moodle-app-dev.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/moodle-app.yml b/moodle-app.yml index 30a4d910be8..8808d9d660d 100644 --- a/moodle-app.yml +++ b/moodle-app.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/phpunit-external-services.yml b/phpunit-external-services.yml index 1ca2f264c51..f9400052b21 100644 --- a/phpunit-external-services.yml +++ b/phpunit-external-services.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/selenium.chrome.yml b/selenium.chrome.yml index 775671c2b96..a51872e5005 100644 --- a/selenium.chrome.yml +++ b/selenium.chrome.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: diff --git a/selenium.debug.yml b/selenium.debug.yml index 828fd2c4c8a..e2a18730633 100644 --- a/selenium.debug.yml +++ b/selenium.debug.yml @@ -1,4 +1,3 @@ -version: "2" services: selenium: ports: diff --git a/service.mail.yml b/service.mail.yml index 5b91ddd1431..fd4245e8f4b 100644 --- a/service.mail.yml +++ b/service.mail.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: volumes: diff --git a/volumes-cached.yml b/volumes-cached.yml index dedeb9e8352..e30abe4e290 100644 --- a/volumes-cached.yml +++ b/volumes-cached.yml @@ -1,6 +1,5 @@ # Here we support https://docs.docker.com/docker-for-mac/osxfs-caching/ # for improved performance on mac -version: "2" services: webserver: volumes: diff --git a/webserver.port.yml b/webserver.port.yml index bff93e6331b..f355ff2dee8 100644 --- a/webserver.port.yml +++ b/webserver.port.yml @@ -1,4 +1,3 @@ -version: "2" services: webserver: environment: From 1dc68259d65a53b49e08997a3f883b6ee149c3c1 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Thu, 21 Mar 2024 17:21:56 +0000 Subject: [PATCH 09/27] Propose minimum Docker/Compose version requirements. Fixes #243 (thanks Eloy!). Co-authored-by: Eloy Lafuente --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 62f059f50ee..cf5fc281b88 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ This repository contains Docker configuration aimed at Moodle developers and tes ## Prerequisites * [Docker](https://docs.docker.com) and [Docker Compose](https://docs.docker.com/compose/cli-command/#installing-compose-v2) installed if your Docker CLI version does not support `docker compose` command. +* It's recommended to always run the latest versions of each, but at the minimum Docker v20.10.15 and Docker Compose v2.5.0 should be used. * 3.25GB of RAM (if you choose [Microsoft SQL Server](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup#prerequisites) as db server) ## Quick start From 575597a8bb5916034c75fea023429dbfa6815a8d Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Thu, 21 Mar 2024 18:29:36 +0100 Subject: [PATCH 10/27] Set PRs author automatically --- .github/workflows/auto-author-assign.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/auto-author-assign.yml diff --git a/.github/workflows/auto-author-assign.yml b/.github/workflows/auto-author-assign.yml new file mode 100644 index 00000000000..406f25fb22f --- /dev/null +++ b/.github/workflows/auto-author-assign.yml @@ -0,0 +1,15 @@ +name: Auto Author Assign + +on: + pull_request_target: + types: [ opened, reopened ] + +permissions: + pull-requests: write + +jobs: + assign-author: + name: Auto assign PR + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@v2.1.0 From db517faf70ab64dcb4d21f8159ce742c22a4bb71 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Mon, 8 Apr 2024 23:18:52 +0200 Subject: [PATCH 11/27] Fix GHA badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf5fc281b88..ac6d6fe814f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # moodle-docker: Docker Containers for Moodle Developers -[![Build Status](https://github.com/moodlehq/moodle-docker/workflows/moodle-docker%20CI/badge.svg?branch=main)](https://github.com/moodlehq/moodle-docker/actions/workflows/ci.yml?query=branch%3Amain) +[![moodle-docker CI](https://github.com/moodlehq/moodle-docker/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/moodlehq/moodle-docker/actions/workflows/ci.yml) This repository contains Docker configuration aimed at Moodle developers and testers to easily deploy a testing environment for Moodle. From 2b27c433718b08f30a2148f8b82b82a374d059ab Mon Sep 17 00:00:00 2001 From: William Entriken Date: Tue, 9 Apr 2024 13:09:01 -0400 Subject: [PATCH 12/27] More complete quick start (#286) * More complete quick start * Clone to the correct directory * Say /path/to/moodle --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ac6d6fe814f..3a0e8baaf40 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,15 @@ This repository contains Docker configuration aimed at Moodle developers and tes ## Quick start ```bash -# Set up path to Moodle code -export MOODLE_DOCKER_WWWROOT=/path/to/moodle/code +# Change ./moodle to your /path/to/moodle if you already have it checked out +export MOODLE_DOCKER_WWWROOT=./moodle + # Choose a db server (Currently supported: pgsql, mariadb, mysql, mssql, oracle) export MOODLE_DOCKER_DB=pgsql +# Get Moodle code, you could select another version branch (skip this if you already got the code) +git clone -b MOODLE_403_STABLE git://git.moodle.org/moodle.git $MOODLE_DOCKER_WWWROOT + # Ensure customized config.php for the Docker containers is in place cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php From 47a589221601361b845d1c7a80fbb5a31046e567 Mon Sep 17 00:00:00 2001 From: Ruslan Kabalin Date: Tue, 9 Apr 2024 20:34:49 +0100 Subject: [PATCH 13/27] Add MOODLE_DOCKER_RUNNING env variable to flag moodle-docker container run. MOODLE_DOCKER_RUNNING=1 is available inside webserver continer, this can be used to conditionally load test configuration. Closes #285 --- README.md | 13 +++++++++++++ base.yml | 1 + 2 files changed, 14 insertions(+) diff --git a/README.md b/README.md index cf5fc281b88..4ab268d2707 100644 --- a/README.md +++ b/README.md @@ -225,6 +225,19 @@ When you change them, use `bin/moodle-docker-compose down && bin/moodle-docker-c | `MOODLE_DOCKER_APP_PATH` | no | path on your file system | not set | If set and the chrome browser is selected, it will start an instance of the Moodle app from your local codebase | | `MOODLE_DOCKER_APP_VERSION` | no | a valid [app docker image version](https://docs.moodle.org/dev/Moodle_App_Docker_images) | not set | If set will start an instance of the Moodle app if the chrome browser is selected | +In addition to that, `MOODLE_DOCKER_RUNNING=1` env variable is defined and available +in the webserver container to flag being run by `moodle-docker`. Developer +can use this to conditionally make changes in `config.php`. The common case is +to load test-specific configuration: +``` +// Load moodle-docker config file if we are in moodle-docker environment +if (getenv('MOODLE_DOCKER_RUNNING')) { + require_once($CFG->dirroot . '/config.docker-template.php'); +} + +require_once($CFG->dirroot . '/lib/setup.php'); // Do not edit. +``` + ## Local customisations In some situations you may wish to add local customisations, such as including additional containers, or changing existing containers. diff --git a/base.yml b/base.yml index 28414bdf641..2ce15ba073a 100644 --- a/base.yml +++ b/base.yml @@ -7,6 +7,7 @@ services: - "${MOODLE_DOCKER_WWWROOT}:/var/www/html" - "${ASSETDIR}/web/apache2_faildumps.conf:/etc/apache2/conf-enabled/apache2_faildumps.conf" environment: + MOODLE_DOCKER_RUNNING: 1 MOODLE_DOCKER_DBNAME: moodle MOODLE_DOCKER_DBUSER: moodle MOODLE_DOCKER_DBPASS: "m@0dl3ing" From 9861fbb6d69ee8ff4a98a6cf0525dfe0756a3728 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 19 Apr 2024 13:29:47 +0100 Subject: [PATCH 14/27] Fix docs related to loading custom Docker configuration file. They cause a fatal error. See #285. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 963a0244362..02228ffd6cc 100644 --- a/README.md +++ b/README.md @@ -236,10 +236,10 @@ to load test-specific configuration: ``` // Load moodle-docker config file if we are in moodle-docker environment if (getenv('MOODLE_DOCKER_RUNNING')) { - require_once($CFG->dirroot . '/config.docker-template.php'); + require_once(__DIR__ . '/config.docker-template.php'); } -require_once($CFG->dirroot . '/lib/setup.php'); // Do not edit. +require_once(__DIR__ . '/lib/setup.php'); // Do not edit. ``` ## Local customisations From c4506af179464847962797a199d22453f6dc8cc4 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Mon, 22 Apr 2024 10:23:35 +0200 Subject: [PATCH 15/27] Add MOODLE_404_STABLE GHA tests Basically, duplicate all 403 entries to 404 and amend the highest/lowest PHP versions for all the new ones. But for the app tests, where we (agreed with the apps team) just replace the previous (403) with 404 in the first 2 groups of tests, and add in the 3rd group. --- .github/workflows/ci.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b04febe2a6e..5e34bf5bf1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,8 @@ jobs: # PostgreSQL (highest, lowest php supported) - { branch: main, php: "8.3", database: pgsql, suite: phpunit-full } # Full run only for main. - { branch: main, php: "8.1", database: pgsql, suite: phpunit-full } + - { branch: MOODLE_404_STABLE, php: "8.3", database: pgsql, suite: phpunit } # Other branches, quicker run. + - { branch: MOODLE_404_STABLE, php: "8.1", database: pgsql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, suite: phpunit } # Other branches, quicker run. - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: pgsql, suite: phpunit } @@ -58,6 +60,7 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.2", database: pgsql, suite: phpunit } # MariaDB (lowest php supported) - { branch: main, php: "8.1", database: mariadb, suite: phpunit } + - { branch: MOODLE_404_STABLE, php: "8.1", database: mariadb, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.0", database: mariadb, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.0", database: mariadb, suite: phpunit } - { branch: MOODLE_401_STABLE, php: "7.4", database: mariadb, suite: phpunit } @@ -67,6 +70,7 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.2", database: mariadb, suite: phpunit } # Other databases (highest php supported) - { branch: main, php: "8.3", database: mssql, suite: phpunit } + - { branch: MOODLE_404_STABLE, php: "8.3", database: mssql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: mssql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: mssql, suite: phpunit } - { branch: MOODLE_401_STABLE, php: "8.1", database: mssql, suite: phpunit } @@ -75,6 +79,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mssql, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.4", database: mssql, suite: phpunit } - { branch: main, php: "8.3", database: mysql, suite: phpunit } + - { branch: MOODLE_404_STABLE, php: "8.3", database: mysql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: mysql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: mysql, suite: phpunit } - { branch: MOODLE_401_STABLE, php: "8.1", database: mysql, suite: phpunit } @@ -83,6 +88,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mysql, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.4", database: mysql, suite: phpunit } - { branch: main, php: "8.3", database: oracle, suite: phpunit } + - { branch: MOODLE_404_STABLE, php: "8.3", database: oracle, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: oracle, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: oracle, suite: phpunit } - { branch: MOODLE_401_STABLE, php: "8.1", database: oracle, suite: phpunit } @@ -133,6 +139,8 @@ jobs: # PostgreSQL (highest, lowest php supported) - { branch: main, php: "8.3", database: pgsql, browser: chrome, suite: behat } - { branch: main, php: "8.1", database: pgsql, browser: firefox, suite: behat } + - { branch: MOODLE_404_STABLE, php: "8.3", database: pgsql, browser: chrome, suite: behat } + - { branch: MOODLE_404_STABLE, php: "8.1", database: pgsql, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, browser: chrome, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, browser: firefox, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: pgsql, browser: chrome, suite: behat } @@ -149,6 +157,7 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.2", database: pgsql, browser: firefox, suite: behat } # MariaDB (lowest php supported) - { branch: main, php: "8.1", database: mariadb, browser: chrome, suite: behat } + - { branch: MOODLE_404_STABLE, php: "8.1", database: mariadb, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.0", database: mariadb, browser: firefox, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.0", database: mariadb, browser: firefox, suite: behat } - { branch: MOODLE_401_STABLE, php: "7.4", database: mariadb, browser: chrome, suite: behat } @@ -158,6 +167,7 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.2", database: mariadb, browser: chrome, suite: behat } # Other databases (highest php supported") - { branch: main, php: "8.3", database: mssql, browser: firefox, suite: behat } + - { branch: MOODLE_404_STABLE, php: "8.3", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_401_STABLE, php: "8.1", database: mssql, browser: firefox, suite: behat } @@ -166,6 +176,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.4", database: mssql, browser: firefox, suite: behat } - { branch: main, php: "8.3", database: mysql, browser: chrome, suite: behat } + - { branch: MOODLE_404_STABLE, php: "8.3", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_401_STABLE, php: "8.1", database: mysql, browser: chrome, suite: behat } @@ -174,6 +185,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.4", database: mysql, browser: chrome, suite: behat } - { branch: main, php: "8.3", database: oracle, browser: firefox, suite: behat } + - { branch: MOODLE_404_STABLE, php: "8.3", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_401_STABLE, php: "8.1", database: oracle, browser: firefox, suite: behat } @@ -224,14 +236,16 @@ jobs: include: # PostgreSQL (highest, lowest php supported) # First tests are for app developers. - - { branch: MOODLE_403_STABLE, php: "8.2", suite: app-development, app-version: "latest" } - - { branch: MOODLE_403_STABLE, php: "8.0", suite: app-development, app-version: "latest" } - - { branch: MOODLE_403_STABLE, php: "8.2", suite: app-development, app-version: "main" } - - { branch: MOODLE_403_STABLE, php: "8.0", suite: app-development, app-version: "main" } + - { branch: MOODLE_404_STABLE, php: "8.3", suite: app-development, app-version: "latest" } + - { branch: MOODLE_404_STABLE, php: "8.1", suite: app-development, app-version: "latest" } + - { branch: MOODLE_404_STABLE, php: "8.3", suite: app-development, app-version: "main" } + - { branch: MOODLE_404_STABLE, php: "8.1", suite: app-development, app-version: "main" } # Tests for Moodle plugin developers who want to test against the next version of the app. - - { branch: MOODLE_403_STABLE, php: "8.2", suite: app, app-version: "next-test" } - - { branch: MOODLE_403_STABLE, php: "8.0", suite: app, app-version: "next-test" } + - { branch: MOODLE_404_STABLE, php: "8.3", suite: app, app-version: "next-test" } + - { branch: MOODLE_404_STABLE, php: "8.1", suite: app, app-version: "next-test" } # Tests for Moodle plugin developers testing against all supported versions of Moodle. + - { branch: MOODLE_404_STABLE, php: "8.3", suite: app, app-version: "latest-test" } + - { branch: MOODLE_404_STABLE, php: "8.1", suite: app, app-version: "latest-test" } - { branch: MOODLE_403_STABLE, php: "8.2", suite: app, app-version: "latest-test" } - { branch: MOODLE_403_STABLE, php: "8.0", suite: app, app-version: "latest-test" } - { branch: MOODLE_402_STABLE, php: "8.2", suite: app, app-version: "latest-test" } From 4ef9fe590cb6dcc9277322acd63a58c5923af512 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Mon, 6 May 2024 15:54:42 +0200 Subject: [PATCH 16/27] Set gitpod permission to install plugins --- .gitpod.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 450144660d0..ccbfd47f3fc 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -30,6 +30,9 @@ tasks: # Open Moodle site in browser. gp ports await 8000 && gp preview $(gp url 8000) + # Change permissions to allow installation of plugins. + bin/moodle-docker-compose exec webserver bash -c 'chmod -R 777 .' + command: | # Update the patch to the latest version. cd moodle From ccfd87fbd2e66898b7fb0e841612e703e846c7fb Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Mon, 6 May 2024 15:55:55 +0200 Subject: [PATCH 17/27] Initialise gitpod with data when DATAFILE is given --- .gitpod.yml | 6 ++++++ .gitpod/setup-env.sh | 6 ++++++ README.md | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index ccbfd47f3fc..41837089f79 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -33,6 +33,12 @@ tasks: # Change permissions to allow installation of plugins. bin/moodle-docker-compose exec webserver bash -c 'chmod -R 777 .' + # Add some data if the file exists. + if [ -r "moodle/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature" ]; + then + bin/moodle-docker-compose exec webserver php admin/tool/generator/cli/runtestscenario.php --feature=./../tests/fixtures/gitpod-basic-scenario.feature + fi + command: | # Update the patch to the latest version. cd moodle diff --git a/.gitpod/setup-env.sh b/.gitpod/setup-env.sh index b2048953e9c..96e2a1c5e74 100755 --- a/.gitpod/setup-env.sh +++ b/.gitpod/setup-env.sh @@ -10,3 +10,9 @@ fi # Clone Moodle repository. cd "${GITPOD_REPO_ROOT}" && git clone --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle + +# 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}" +fi diff --git a/README.md b/README.md index 02228ffd6cc..ef491757d66 100644 --- a/README.md +++ b/README.md @@ -341,8 +341,9 @@ The Moodle Gitpod template supports the following environment variables: * `MOODLE_REPOSITORY`. The Moodle repository to be cloned. The value should be URL encoded. If left undefined, the default repository `https://github.com/moodle/moodle.git` is used. * `MOODLE_BRANCH`. The Moodle branch to be cloned. If left undefined, the default branch `main` is employed. +* `DATAFILE`. When specified, this feature URL initializes the Moodle site with essential data. The value should be URL encoded. The content of this file adheres to the [Behat generators format](https://moodledev.io/general/development/tools/generator#create-a-testing-scenario-using-behat-generators) for creating testing scenarios. -For a practical demonstration, launch a Gitpod workspace with the 'main' branch patch for [MDL-79912](https://tracker.moodle.org/browse/MDL-79912). Simply open the following URL in your web browser (note that MOODLE_REPOSITORY should be URL encoded). The password for the admin user is **test**: +For a practical demonstration, launch a Gitpod workspace with the 'main' branch patch for [MDL-79912](https://tracker.moodle.org/browse/MDL-79912). Simply open the following URL in your web browser (note that MOODLE_REPOSITORY should be URL encoded). The password for the **admin** user is **test**: ``` https://gitpod.io/#MOODLE_REPOSITORY=https%3A%2F%2Fgithub.com%2Fsarjona%2Fmoodle.git,MOODLE_BRANCH=MDL-79912-main/https://github.com/moodlehq/moodle-docker From 84522b248b335bc81ff66549485f26accfc1bf9d Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Mon, 6 May 2024 16:57:06 +0200 Subject: [PATCH 18/27] Add adminer to gitpod --- .gitpod/setup-env.sh | 16 ++++++++++++++++ README.md | 1 + 2 files changed, 17 insertions(+) diff --git a/.gitpod/setup-env.sh b/.gitpod/setup-env.sh index 96e2a1c5e74..4b344f6b23b 100755 --- a/.gitpod/setup-env.sh +++ b/.gitpod/setup-env.sh @@ -16,3 +16,19 @@ if [ -n "$DATAFILE" ]; then wget -O moodle/admin/tool/generator/tests/fixtures/gitpod-basic-scenario.feature "${DATAFILE}" fi + +# Install adminer. +if [ -n "$INSTALLADMINER" ]; +then +cat << EOF > local.yml +services: + + adminer: + image: adminer:latest + restart: always + ports: + - 8080:8080 + depends_on: + - "db" +EOF +fi diff --git a/README.md b/README.md index ef491757d66..730f4d4ab17 100644 --- a/README.md +++ b/README.md @@ -342,6 +342,7 @@ The Moodle Gitpod template supports the following environment variables: * `MOODLE_REPOSITORY`. The Moodle repository to be cloned. The value should be URL encoded. If left undefined, the default repository `https://github.com/moodle/moodle.git` is used. * `MOODLE_BRANCH`. The Moodle branch to be cloned. If left undefined, the default branch `main` is employed. * `DATAFILE`. When specified, this feature URL initializes the Moodle site with essential data. The value should be URL encoded. The content of this file adheres to the [Behat generators format](https://moodledev.io/general/development/tools/generator#create-a-testing-scenario-using-behat-generators) for creating testing scenarios. +* `INSTALLADMINER`. Add this variable, set to any value, to install [adminer](https://www.adminer.org/). For a practical demonstration, launch a Gitpod workspace with the 'main' branch patch for [MDL-79912](https://tracker.moodle.org/browse/MDL-79912). Simply open the following URL in your web browser (note that MOODLE_REPOSITORY should be URL encoded). The password for the **admin** user is **test**: From 20dad07db9db07ccdc082c2de786e902db644ee0 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Mon, 6 May 2024 17:16:58 +0200 Subject: [PATCH 19/27] Add parameter to speed gitpod clone --- .gitpod/setup-env.sh | 9 ++++++++- README.md | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitpod/setup-env.sh b/.gitpod/setup-env.sh index 4b344f6b23b..37a3b906914 100755 --- a/.gitpod/setup-env.sh +++ b/.gitpod/setup-env.sh @@ -8,8 +8,15 @@ then export MOODLE_BRANCH=main fi +if [ -z "$CLONEALL" ]; +then + FASTCLONE='--depth 1' +else + FASTCLONE="" +fi + # Clone Moodle repository. -cd "${GITPOD_REPO_ROOT}" && git clone --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle +cd "${GITPOD_REPO_ROOT}" && git clone ${FASTCLONE} --branch "${MOODLE_BRANCH}" --single-branch "${MOODLE_REPOSITORY}" moodle # Download the data file (if given). It will be used to generate some data. if [ -n "$DATAFILE" ]; diff --git a/README.md b/README.md index 730f4d4ab17..295f7ece98a 100644 --- a/README.md +++ b/README.md @@ -343,6 +343,7 @@ The Moodle Gitpod template supports the following environment variables: * `MOODLE_BRANCH`. The Moodle branch to be cloned. If left undefined, the default branch `main` is employed. * `DATAFILE`. When specified, this feature URL initializes the Moodle site with essential data. The value should be URL encoded. The content of this file adheres to the [Behat generators format](https://moodledev.io/general/development/tools/generator#create-a-testing-scenario-using-behat-generators) for creating testing scenarios. * `INSTALLADMINER`. Add this variable, set to any value, to install [adminer](https://www.adminer.org/). +* `CLONEALL`. If not set, a shallow clone is created, truncating the history to reduce the clone size. Set to `1` for a full clone. For a practical demonstration, launch a Gitpod workspace with the 'main' branch patch for [MDL-79912](https://tracker.moodle.org/browse/MDL-79912). Simply open the following URL in your web browser (note that MOODLE_REPOSITORY should be URL encoded). The password for the **admin** user is **test**: From 03c7de89bd3bf0cd4e2d48869a8acdb04e3bb551 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Fri, 10 May 2024 13:47:31 +0200 Subject: [PATCH 20/27] Gitpod: Improve git performance --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index 41837089f79..3ce2828194f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -42,7 +42,7 @@ tasks: command: | # Update the patch to the latest version. cd moodle - git fetch + git fetch $(git rev-parse --symbolic-full-name --abbrev-ref @{upstream} | sed 's!/! !') git reset --hard cd .. From d59e070a599e5a5da4b2a1f0d45c9f0524521c80 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 1 Jul 2024 09:10:23 +0200 Subject: [PATCH 21/27] Fall back to ionic7 app runtime --- bin/moodle-docker-compose | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index ee0078ce855..72950a8a8a2 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -89,13 +89,7 @@ then export MOODLE_DOCKER_APP_RUNTIME="ionic5" fi else - # TODO always default to ionic7 after 4.4.0 release - if [[ $appversion = "latest"* ]]; - then - export MOODLE_DOCKER_APP_RUNTIME="ionic5" - else - export MOODLE_DOCKER_APP_RUNTIME="ionic7" - fi + export MOODLE_DOCKER_APP_RUNTIME="ionic7" fi fi fi From 16fbaa905d47db9289ad5f237e4e17d55fed9174 Mon Sep 17 00:00:00 2001 From: Noel De Martin Date: Mon, 1 Jul 2024 10:54:29 +0200 Subject: [PATCH 22/27] Update app version for legacy tests Older versions of the LMS won't work with the app because they need the patch introduced in MDL-80784 --- .github/workflows/ci.yml | 8 ++++---- tests/app-setup.sh | 8 +++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e34bf5bf1f..48f58ed5975 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -252,10 +252,10 @@ jobs: - { branch: MOODLE_402_STABLE, php: "8.0", suite: app, app-version: "latest-test" } - { branch: MOODLE_401_STABLE, php: "8.1", suite: app, app-version: "latest-test" } - { branch: MOODLE_401_STABLE, php: "7.4", suite: app, app-version: "latest-test" } - - { branch: MOODLE_400_STABLE, php: "8.0", suite: app, app-version: "latest-test" } - - { branch: MOODLE_400_STABLE, php: "7.3", suite: app, app-version: "latest-test" } - - { branch: MOODLE_311_STABLE, php: "8.0", suite: app, app-version: "latest-test" } - - { branch: MOODLE_311_STABLE, php: "7.3", suite: app, app-version: "latest-test" } + - { branch: MOODLE_400_STABLE, php: "8.0", suite: app, app-version: "4.3.0-test" } + - { branch: MOODLE_400_STABLE, php: "7.3", suite: app, app-version: "4.3.0-test" } + - { branch: MOODLE_311_STABLE, php: "8.0", suite: app, app-version: "4.3.0-test" } + - { branch: MOODLE_311_STABLE, php: "7.3", suite: app, app-version: "4.3.0-test" } steps: - name: Checking out moodle-docker diff --git a/tests/app-setup.sh b/tests/app-setup.sh index 6245dadd5e6..50ae964d5ce 100755 --- a/tests/app-setup.sh +++ b/tests/app-setup.sh @@ -24,12 +24,14 @@ then docker run --volume $basedir/app:/app --workdir /app node:$nodeversion bash -c "npm ci" elif [ "$SUITE" = "app" ]; then - isdevelop=`echo $MOODLE_DOCKER_APP_VERSION | grep -E -o "(next)|(latest)"` + branch=`echo $MOODLE_DOCKER_APP_VERSION | grep -P -o "next|latest|\d\.\d\.\d"` - branch="latest" - if [ "$isdevelop" = "next" ]; + if [ "$branch" = "next" ]; then branch="main" + elif [ "$branch" != "latest" ]; + then + branch="v$branch" fi git clone --branch "$branch" --depth 1 https://github.com/moodlehq/moodle-local_moodleappbehat $basedir/moodle/local/moodleappbehat From 90c02887d077b752790b570c57e1354b7c475b35 Mon Sep 17 00:00:00 2001 From: Neill Magill Date: Mon, 11 Nov 2019 09:20:24 +0000 Subject: [PATCH 23/27] Allow the Behat timeout factor to be configured --- README.md | 1 + base.yml | 1 + bin/moodle-docker-compose | 2 ++ bin/moodle-docker-compose.cmd | 3 +++ config.docker-template.php | 1 + 5 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 295f7ece98a..cdab2cfa602 100644 --- a/README.md +++ b/README.md @@ -228,6 +228,7 @@ When you change them, use `bin/moodle-docker-compose down && bin/moodle-docker-c | `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 | | `MOODLE_DOCKER_APP_PATH` | no | path on your file system | not set | If set and the chrome browser is selected, it will start an instance of the Moodle app from your local codebase | | `MOODLE_DOCKER_APP_VERSION` | no | a valid [app docker image version](https://docs.moodle.org/dev/Moodle_App_Docker_images) | not set | If set will start an instance of the Moodle app if the chrome browser is selected | +| `MOODLE_DOCKER_TIMEOUT_FACTOR` | no | any integer value | 1 | If set the timeouts in behat will be multiplied by the factor | In addition to that, `MOODLE_DOCKER_RUNNING=1` env variable is defined and available in the webserver container to flag being run by `moodle-docker`. Developer diff --git a/base.yml b/base.yml index 2ce15ba073a..a20f3620df6 100644 --- a/base.yml +++ b/base.yml @@ -13,6 +13,7 @@ services: MOODLE_DOCKER_DBPASS: "m@0dl3ing" MOODLE_DOCKER_BROWSER: firefox MOODLE_DOCKER_WEB_HOST: "${MOODLE_DOCKER_WEB_HOST}" + MOODLE_DOCKER_TIMEOUT_FACTOR: "${MOODLE_DOCKER_TIMEOUT_FACTOR}" exttests: image: moodlehq/moodle-exttests volumes: diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index 72950a8a8a2..473b06cd6ff 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -229,6 +229,8 @@ then dockercompose="${dockercompose} -f ${basedir}/webserver.port.yml" fi +# Behat test timeout factor +export MOODLE_DOCKER_TIMEOUT_FACTOR=${MOODLE_DOCKER_TIMEOUT_FACTOR:-1} # Mac OS Compatbility if [[ "$(uname)" == "Darwin" ]]; then diff --git a/bin/moodle-docker-compose.cmd b/bin/moodle-docker-compose.cmd index 7754c6af65d..a51c49756ea 100644 --- a/bin/moodle-docker-compose.cmd +++ b/bin/moodle-docker-compose.cmd @@ -185,6 +185,9 @@ IF "%MOODLE_DOCKER_SELENIUM_VNC_PORT%"=="" ( ) ) +IF "%MOODLE_DOCKER_TIMEOUT_FACTOR%"=="" ( + SET MOODLE_DOCKER_TIMEOUT_FACTOR=1 +) REM Apply local customisations if a local.yml is found. REM Note: This must be the final modification before the docker-compose command is called. diff --git a/config.docker-template.php b/config.docker-template.php index ebed286f824..78d6d8cd37c 100644 --- a/config.docker-template.php +++ b/config.docker-template.php @@ -80,6 +80,7 @@ ), ); $CFG->behat_faildump_path = '/var/www/behatfaildumps'; +$CFG->behat_increasetimeout = getenv('MOODLE_DOCKER_TIMEOUT_FACTOR'); define('PHPUNIT_LONGTEST', true); From 3a4e5905f7082dbee1254fa106caa552757fe323 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Tue, 3 Sep 2024 14:11:40 +0800 Subject: [PATCH 24/27] Bump redis to version 5 --- phpunit-external-services.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit-external-services.yml b/phpunit-external-services.yml index f9400052b21..912ac6479a0 100644 --- a/phpunit-external-services.yml +++ b/phpunit-external-services.yml @@ -9,7 +9,7 @@ services: mongo: image: mongo:4.0 redis: - image: redis:3 + image: redis:5 solr: image: solr:6.5 entrypoint: From d8285b38adad23929e7f922e235d663163d57f8e Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Mon, 2 Dec 2024 16:38:32 +0100 Subject: [PATCH 25/27] Increase Moodle 5.0 requirements 5.0 agreed environment requirements: - PHP 8.2 - PostgreSQL 14 - MySQL 8.4 - MariaDB 10.11.0 Apart from this, the Moodle 4.5 branch has also been added to GHA. --- .github/workflows/ci.yml | 10 ++++++++-- README.md | 2 +- bin/moodle-docker-compose | 2 +- bin/moodle-docker-compose.cmd | 2 +- db.mariadb.yml | 2 +- db.mysql.yml | 2 +- db.pgsql.yml | 2 +- 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48f58ed5975..68041229920 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,7 +138,9 @@ jobs: include: # PostgreSQL (highest, lowest php supported) - { branch: main, php: "8.3", database: pgsql, browser: chrome, suite: behat } - - { branch: main, php: "8.1", database: pgsql, browser: firefox, suite: behat } + - { branch: main, php: "8.2", database: pgsql, browser: firefox, suite: behat } + - { branch: MOODLE_405_STABLE, php: "8.3", database: pgsql, browser: chrome, suite: behat } + - { branch: MOODLE_405_STABLE, php: "8.1", database: pgsql, browser: firefox, suite: behat } - { branch: MOODLE_404_STABLE, php: "8.3", database: pgsql, browser: chrome, suite: behat } - { branch: MOODLE_404_STABLE, php: "8.1", database: pgsql, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, browser: chrome, suite: behat } @@ -156,7 +158,8 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.4", database: pgsql, browser: chrome, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.2", database: pgsql, browser: firefox, suite: behat } # MariaDB (lowest php supported) - - { branch: main, php: "8.1", database: mariadb, browser: chrome, suite: behat } + - { branch: main, php: "8.2", database: mariadb, browser: chrome, suite: behat } + - { branch: MOODLE_405_STABLE, php: "8.1", database: mariadb, browser: firefox, suite: behat } - { branch: MOODLE_404_STABLE, php: "8.1", database: mariadb, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.0", database: mariadb, browser: firefox, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.0", database: mariadb, browser: firefox, suite: behat } @@ -167,6 +170,7 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.2", database: mariadb, browser: chrome, suite: behat } # Other databases (highest php supported") - { branch: main, php: "8.3", database: mssql, browser: firefox, suite: behat } + - { branch: MOODLE_405_STABLE, php: "8.3", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_404_STABLE, php: "8.3", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: mssql, browser: chrome, suite: behat } @@ -176,6 +180,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mssql, browser: chrome, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.4", database: mssql, browser: firefox, suite: behat } - { branch: main, php: "8.3", database: mysql, browser: chrome, suite: behat } + - { branch: MOODLE_405_STABLE, php: "8.3", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_404_STABLE, php: "8.3", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: mysql, browser: firefox, suite: behat } @@ -185,6 +190,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mysql, browser: firefox, suite: behat } - { branch: MOODLE_39_STABLE, php: "7.4", database: mysql, browser: chrome, suite: behat } - { branch: main, php: "8.3", database: oracle, browser: firefox, suite: behat } + - { branch: MOODLE_405_STABLE, php: "8.3", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_404_STABLE, php: "8.3", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_403_STABLE, php: "8.2", database: oracle, browser: chrome, suite: behat } - { branch: MOODLE_402_STABLE, php: "8.2", database: oracle, browser: chrome, suite: behat } diff --git a/README.md b/README.md index cdab2cfa602..7545da8769e 100644 --- a/README.md +++ b/README.md @@ -216,7 +216,7 @@ When you change them, use `bin/moodle-docker-compose down && bin/moodle-docker-c | `MOODLE_DOCKER_DB` | yes | pgsql, mariadb, mysql, mssql, oracle | none | The database server to run against | | `MOODLE_DOCKER_WWWROOT` | yes | path on your file system | none | The path to the Moodle codebase you intend to test | | `MOODLE_DOCKER_DB_VERSION` | no | Docker tag - see relevant database page on docker-hub | mysql: 8.0
pgsql: 13
mariadb: 10.7
mssql: 2017-latest
oracle: 21| The database server docker image tag | -| `MOODLE_DOCKER_PHP_VERSION` | no | 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6| 8.1 | The php version to use | +| `MOODLE_DOCKER_PHP_VERSION` | no | 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, 7.0, 5.6| 8.2 | The php version to use | | `MOODLE_DOCKER_BROWSER` | no | firefox, chrome, firefox:<tag>, chrome:<tag> | firefox:3 | The browser to run Behat against. Supports a colon notation to specify a specific Selenium docker image version to use. e.g. firefox:2.53.1 can be used to run with older versions of Moodle (<3.5) | | `MOODLE_DOCKER_PHPUNIT_EXTERNAL_SERVICES` | no | any value | not set | If set, dependencies for memcached, redis, solr, and openldap are added | | `MOODLE_DOCKER_BBB_MOCK` | no | any value | not set | If set the BigBlueButton mock image is started and configured | diff --git a/bin/moodle-docker-compose b/bin/moodle-docker-compose index 473b06cd6ff..716965b7373 100755 --- a/bin/moodle-docker-compose +++ b/bin/moodle-docker-compose @@ -33,7 +33,7 @@ dockercompose="${dockercompose} -f ${basedir}/base.yml" dockercompose="${dockercompose} -f ${basedir}/service.mail.yml" # PHP Version. -export MOODLE_DOCKER_PHP_VERSION=${MOODLE_DOCKER_PHP_VERSION:-8.1} +export MOODLE_DOCKER_PHP_VERSION=${MOODLE_DOCKER_PHP_VERSION:-8.2} # Database flavour. dockercompose="${dockercompose} -f ${basedir}/db.${MOODLE_DOCKER_DB}.yml" diff --git a/bin/moodle-docker-compose.cmd b/bin/moodle-docker-compose.cmd index a51c49756ea..8ee7df306fc 100644 --- a/bin/moodle-docker-compose.cmd +++ b/bin/moodle-docker-compose.cmd @@ -22,7 +22,7 @@ SET DOCKERCOMPOSE=docker-compose -f "%BASEDIR%\base.yml" SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\service.mail.yml" IF "%MOODLE_DOCKER_PHP_VERSION%"=="" ( - SET MOODLE_DOCKER_PHP_VERSION=8.1 + SET MOODLE_DOCKER_PHP_VERSION=8.2 ) SET DOCKERCOMPOSE=%DOCKERCOMPOSE% -f "%BASEDIR%\db.%MOODLE_DOCKER_DB%.yml" diff --git a/db.mariadb.yml b/db.mariadb.yml index b355dee9049..ecfa12d80df 100644 --- a/db.mariadb.yml +++ b/db.mariadb.yml @@ -4,7 +4,7 @@ services: MOODLE_DOCKER_DBTYPE: mariadb MOODLE_DOCKER_DBCOLLATION: utf8mb4_bin db: - image: mariadb:${MOODLE_DOCKER_DB_VERSION:-10.7} + image: mariadb:${MOODLE_DOCKER_DB_VERSION:-10.11} command: > --character-set-server=utf8mb4 --collation-server=utf8mb4_bin diff --git a/db.mysql.yml b/db.mysql.yml index d0f49e9b02c..da38330065a 100644 --- a/db.mysql.yml +++ b/db.mysql.yml @@ -4,7 +4,7 @@ services: MOODLE_DOCKER_DBTYPE: mysqli MOODLE_DOCKER_DBCOLLATION: utf8mb4_bin db: - image: mysql:${MOODLE_DOCKER_DB_VERSION:-8.0} + image: mysql:${MOODLE_DOCKER_DB_VERSION:-8.4} command: > --character-set-server=utf8mb4 --collation-server=utf8mb4_bin diff --git a/db.pgsql.yml b/db.pgsql.yml index 4986f38006e..69338fdd4c8 100644 --- a/db.pgsql.yml +++ b/db.pgsql.yml @@ -3,7 +3,7 @@ services: environment: MOODLE_DOCKER_DBTYPE: pgsql db: - image: postgres:${MOODLE_DOCKER_DB_VERSION:-13} + image: postgres:${MOODLE_DOCKER_DB_VERSION:-14} environment: POSTGRES_USER: moodle POSTGRES_PASSWORD: "m@0dl3ing" From 28a5ab435927199f71b38863e87c34f2bece67a4 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Mon, 2 Dec 2024 17:06:03 +0100 Subject: [PATCH 26/27] Increase Moodle 5.0 requirements for PHPUnit too This commit adds missing values in the phpunit matrix (missed in the last commit and raised by the GHA). 5.0 agreed environment requirements: - PHP 8.2 - PostgreSQL 14 - MySQL 8.4 - MariaDB 10.11.0 Apart from this, the Moodle 4.5 branch has also been added to GHA. --- .github/workflows/ci.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68041229920..aee6c9c9d8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,10 +41,12 @@ jobs: include: # PostgreSQL (highest, lowest php supported) - { branch: main, php: "8.3", database: pgsql, suite: phpunit-full } # Full run only for main. - - { branch: main, php: "8.1", database: pgsql, suite: phpunit-full } - - { branch: MOODLE_404_STABLE, php: "8.3", database: pgsql, suite: phpunit } # Other branches, quicker run. + - { branch: main, php: "8.2", database: pgsql, suite: phpunit-full } + - { branch: MOODLE_405_STABLE, php: "8.3", database: pgsql, suite: phpunit } # Other branches, quicker run. + - { branch: MOODLE_405_STABLE, php: "8.1", database: pgsql, suite: phpunit } + - { branch: MOODLE_404_STABLE, php: "8.3", database: pgsql, suite: phpunit } - { branch: MOODLE_404_STABLE, php: "8.1", database: pgsql, suite: phpunit } - - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, suite: phpunit } # Other branches, quicker run. + - { branch: MOODLE_403_STABLE, php: "8.2", database: pgsql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.0", database: pgsql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: pgsql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.0", database: pgsql, suite: phpunit } @@ -59,7 +61,8 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.4", database: pgsql, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.2", database: pgsql, suite: phpunit } # MariaDB (lowest php supported) - - { branch: main, php: "8.1", database: mariadb, suite: phpunit } + - { branch: main, php: "8.2", database: mariadb, suite: phpunit } + - { branch: MOODLE_405_STABLE, php: "8.1", database: mariadb, suite: phpunit } - { branch: MOODLE_404_STABLE, php: "8.1", database: mariadb, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.0", database: mariadb, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.0", database: mariadb, suite: phpunit } @@ -70,6 +73,7 @@ jobs: - { branch: MOODLE_39_STABLE, php: "7.2", database: mariadb, suite: phpunit } # Other databases (highest php supported) - { branch: main, php: "8.3", database: mssql, suite: phpunit } + - { branch: MOODLE_405_STABLE, php: "8.3", database: mssql, suite: phpunit } - { branch: MOODLE_404_STABLE, php: "8.3", database: mssql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: mssql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: mssql, suite: phpunit } @@ -79,6 +83,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mssql, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.4", database: mssql, suite: phpunit } - { branch: main, php: "8.3", database: mysql, suite: phpunit } + - { branch: MOODLE_405_STABLE, php: "8.3", database: mysql, suite: phpunit } - { branch: MOODLE_404_STABLE, php: "8.3", database: mysql, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: mysql, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: mysql, suite: phpunit } @@ -88,6 +93,7 @@ jobs: - { branch: MOODLE_310_STABLE, php: "7.4", database: mysql, suite: phpunit } - { branch: MOODLE_39_STABLE, php: "7.4", database: mysql, suite: phpunit } - { branch: main, php: "8.3", database: oracle, suite: phpunit } + - { branch: MOODLE_405_STABLE, php: "8.3", database: oracle, suite: phpunit } - { branch: MOODLE_404_STABLE, php: "8.3", database: oracle, suite: phpunit } - { branch: MOODLE_403_STABLE, php: "8.2", database: oracle, suite: phpunit } - { branch: MOODLE_402_STABLE, php: "8.2", database: oracle, suite: phpunit } From 7cac1df793639b689ba409cbd00b6e2eebbdbbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 3 Dec 2024 10:54:37 +0100 Subject: [PATCH 27/27] Update Moodle versions on app testing --- .github/workflows/ci.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68041229920..abe0794bad7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -242,26 +242,22 @@ jobs: include: # PostgreSQL (highest, lowest php supported) # First tests are for app developers. - - { branch: MOODLE_404_STABLE, php: "8.3", suite: app-development, app-version: "latest" } - - { branch: MOODLE_404_STABLE, php: "8.1", suite: app-development, app-version: "latest" } - - { branch: MOODLE_404_STABLE, php: "8.3", suite: app-development, app-version: "main" } - - { branch: MOODLE_404_STABLE, php: "8.1", suite: app-development, app-version: "main" } + - { branch: MOODLE_405_STABLE, php: "8.3", suite: app-development, app-version: "latest" } + - { branch: MOODLE_405_STABLE, php: "8.1", suite: app-development, app-version: "latest" } + - { branch: MOODLE_405_STABLE, php: "8.3", suite: app-development, app-version: "main" } + - { branch: MOODLE_405_STABLE, php: "8.1", suite: app-development, app-version: "main" } # Tests for Moodle plugin developers who want to test against the next version of the app. - - { branch: MOODLE_404_STABLE, php: "8.3", suite: app, app-version: "next-test" } - - { branch: MOODLE_404_STABLE, php: "8.1", suite: app, app-version: "next-test" } + - { branch: MOODLE_405_STABLE, php: "8.3", suite: app, app-version: "next-test" } + - { branch: MOODLE_405_STABLE, php: "8.1", suite: app, app-version: "next-test" } # Tests for Moodle plugin developers testing against all supported versions of Moodle. + - { branch: MOODLE_405_STABLE, php: "8.3", suite: app, app-version: "latest-test" } + - { branch: MOODLE_405_STABLE, php: "8.1", suite: app, app-version: "latest-test" } - { branch: MOODLE_404_STABLE, php: "8.3", suite: app, app-version: "latest-test" } - { branch: MOODLE_404_STABLE, php: "8.1", suite: app, app-version: "latest-test" } - { branch: MOODLE_403_STABLE, php: "8.2", suite: app, app-version: "latest-test" } - { branch: MOODLE_403_STABLE, php: "8.0", suite: app, app-version: "latest-test" } - - { branch: MOODLE_402_STABLE, php: "8.2", suite: app, app-version: "latest-test" } - - { branch: MOODLE_402_STABLE, php: "8.0", suite: app, app-version: "latest-test" } - { branch: MOODLE_401_STABLE, php: "8.1", suite: app, app-version: "latest-test" } - { branch: MOODLE_401_STABLE, php: "7.4", suite: app, app-version: "latest-test" } - - { branch: MOODLE_400_STABLE, php: "8.0", suite: app, app-version: "4.3.0-test" } - - { branch: MOODLE_400_STABLE, php: "7.3", suite: app, app-version: "4.3.0-test" } - - { branch: MOODLE_311_STABLE, php: "8.0", suite: app, app-version: "4.3.0-test" } - - { branch: MOODLE_311_STABLE, php: "7.3", suite: app, app-version: "4.3.0-test" } steps: - name: Checking out moodle-docker