Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
bbdf5af
initial attempt to move ci checks to their own jobs
jay-oswald Jan 13, 2026
d378331
always skip anchor job
jay-oswald Jan 13, 2026
e2e3b5e
remove anchor jobs, they didn't work as needed
jay-oswald Jan 13, 2026
61a404d
use newer version of artifacts
jay-oswald Jan 13, 2026
5c56672
remove phpunit check from single setup
jay-oswald Jan 13, 2026
6edd338
move behat into matrix, only install in matrix
jay-oswald Jan 13, 2026
4da880f
fix release needs
jay-oswald Jan 13, 2026
24dd3ce
build dockerfiles for moodle versions
jay-oswald Jan 13, 2026
53ea796
publish containers
jay-oswald Jan 13, 2026
7a4bb21
consume new containers
jay-oswald Jan 13, 2026
3e034de
fix container name
jay-oswald Jan 13, 2026
3bb30a7
move container name generator to php
jay-oswald Jan 13, 2026
b9e5e16
fixing privacy of containers
jay-oswald Jan 13, 2026
8a2e05b
remove login step, make single setup single run directly on container
jay-oswald Jan 13, 2026
254fc14
fix publish workflow
jay-oswald Jan 13, 2026
a4561b0
use proper container name
jay-oswald Jan 13, 2026
04ce235
use build action
jay-oswald Jan 13, 2026
e008593
branch to lower
jay-oswald Jan 13, 2026
f05228d
fix container name
jay-oswald Jan 13, 2026
3398f6e
fix python
jay-oswald Jan 13, 2026
d4ede6c
auctally use container name
jay-oswald Jan 13, 2026
cae5452
fix composer build
jay-oswald Jan 13, 2026
56f71ef
go back to composer installs
jay-oswald Jan 13, 2026
1e058d9
go back to cli to build
jay-oswald Jan 13, 2026
1df9083
add npm
jay-oswald Jan 13, 2026
265e59e
add workspace folder
jay-oswald Jan 13, 2026
0280e3d
remove woring directory from prepare matrix
jay-oswald Jan 13, 2026
6162e56
add auth to container
jay-oswald Jan 13, 2026
918efe0
fix container name
jay-oswald Jan 13, 2026
48ac85f
fix container runs on
jay-oswald Jan 13, 2026
b4a3307
change path of ci
jay-oswald Jan 13, 2026
4e4cd3f
fix container usage
jay-oswald Jan 13, 2026
2568bad
use proper moodle directory everywhere
jay-oswald Jan 13, 2026
ecfaf1f
run individual checks directly
jay-oswald Jan 13, 2026
0e96a42
remove last refrence to single-setup
jay-oswald Jan 13, 2026
e456a9a
try removing workspace
jay-oswald Jan 13, 2026
8628068
fix needs needs: prepare_matrix
jay-oswald Jan 13, 2026
b67a57a
hardcode container image
jay-oswald Jan 13, 2026
12cbc9e
fix output properly
jay-oswald Jan 13, 2026
514b82a
make all run in container, add plugin path
jay-oswald Jan 13, 2026
fff4fbe
init plugin ci every time
jay-oswald Jan 13, 2026
81acb34
remove cpd
jay-oswald Jan 13, 2026
9b3be4d
remove ignore-paths
jay-oswald Jan 13, 2026
3e54e22
adding db details even though were doing no-init
jay-oswald Jan 13, 2026
a1c8823
db type typo
jay-oswald Jan 13, 2026
1231da3
add db to codechecker
jay-oswald Jan 13, 2026
ac15942
add support for databases
jay-oswald Jan 13, 2026
9873f2a
dynamically get pgsql version
jay-oswald Jan 13, 2026
ba31b24
remove install, run directly
jay-oswald Jan 13, 2026
06d7c82
access db by name
jay-oswald Jan 13, 2026
d706d48
add more php extenstions
jay-oswald Jan 13, 2026
b1420b7
fix version in includes
jay-oswald Jan 13, 2026
d68d34e
fix node build/install
jay-oswald Jan 13, 2026
241ebb5
change node version, add pgsql to validate
jay-oswald Jan 13, 2026
9983688
set max input vars
jay-oswald Jan 13, 2026
3d81a28
seperate behat
jay-oswald Jan 14, 2026
4e4747b
fix release requirements
jay-oswald Jan 14, 2026
3fca485
install grunt, fix names, ci install for mustache
jay-oswald Jan 14, 2026
84c1b71
behat fixes
jay-oswald Jan 14, 2026
ea765e2
run mustache globally
jay-oswald Jan 14, 2026
205d2bb
remove docker groupadd
jay-oswald Jan 14, 2026
3c5736b
add behat root config
jay-oswald Jan 14, 2026
0a405ae
grunt debug
jay-oswald Jan 14, 2026
2b4924f
re-install grunt cli, path to moodle
jay-oswald Jan 14, 2026
a2a8952
behat and grunt fixes
jay-oswald Jan 14, 2026
07073ff
grunt npm install, mustache verbose
jay-oswald Jan 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 17 additions & 22 deletions .github/actions/matrix/matrix_includes.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
include:
# Always include main (issue #18) - disable-able by config by setting 'disable_master' to true
- {moodle-branch: 'main', php: '8.4', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '14', database: 'pgsql'}
- {moodle-branch: 'main', php: '8.4', node: '22', mariadb-ver: '10.11', pgsql-ver: '15', database: 'pgsql'}
# Test all variants of 5.1
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.4', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '15', database: 'mariadb' }
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.4', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '15', database: 'pgsql' }
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.2', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '15', database: 'mariadb' }
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.2', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '15', database: 'pgsql' }
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.4', node: '22', mariadb-ver: '10.11', pgsql-ver: '15', database: 'mariadb' }
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.4', node: '22', mariadb-ver: '10.11', pgsql-ver: '15', database: 'pgsql' }
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.2', node: '22', mariadb-ver: '10.11', pgsql-ver: '15', database: 'mariadb' }
- { moodle-branch: 'MOODLE_501_STABLE', php: '8.2', node: '22', mariadb-ver: '10.11', pgsql-ver: '15', database: 'pgsql' }
# Test all variants of 5.0
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.4', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '14', database: 'mariadb' }
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.4', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '14', database: 'pgsql' }
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.2', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '14', database: 'mariadb' }
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.2', node: '22.11', mariadb-ver: '10.11', pgsql-ver: '14', database: 'pgsql' }
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.4', node: '22', mariadb-ver: '10.11', pgsql-ver: '14', database: 'mariadb' }
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.4', node: '22', mariadb-ver: '10.11', pgsql-ver: '14', database: 'pgsql' }
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.2', node: '22', mariadb-ver: '10.11', pgsql-ver: '14', database: 'mariadb' }
- { moodle-branch: 'MOODLE_500_STABLE', php: '8.2', node: '22', mariadb-ver: '10.11', pgsql-ver: '14', database: 'pgsql' }
# Test all variants of 4.5.
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.3', node: '20.11', mariadb-ver: '10.6', pgsql-ver: '13', database: 'mariadb' }
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.3', node: '20.11', mariadb-ver: '10.6', pgsql-ver: '13', database: 'pgsql' }
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.1', node: '20.11', mariadb-ver: '10.6', pgsql-ver: '13', database: 'mariadb' }
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.1', node: '20.11', mariadb-ver: '10.6', pgsql-ver: '13', database: 'pgsql' }
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.3', node: '22', mariadb-ver: '10.6', pgsql-ver: '13', database: 'mariadb' }
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.3', node: '22', mariadb-ver: '10.6', pgsql-ver: '13', database: 'pgsql' }
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.1', node: '22', mariadb-ver: '10.6', pgsql-ver: '13', database: 'mariadb' }
- { moodle-branch: 'MOODLE_405_STABLE', php: '8.1', node: '22', mariadb-ver: '10.6', pgsql-ver: '13', database: 'pgsql' }
# Test all variants of 4.1 (LTS).
- { moodle-branch: 'MOODLE_401_STABLE', php: '7.4', node: '20.11', mariadb-ver: '10.5', pgsql-ver: '12', database: 'mariadb' }
- { moodle-branch: 'MOODLE_401_STABLE', php: '7.4', node: '20.11', mariadb-ver: '10.5', pgsql-ver: '12', database: 'pgsql' }
- { moodle-branch: 'MOODLE_401_STABLE', php: '8.0', node: '20.11', mariadb-ver: '10.5', pgsql-ver: '12', database: 'mariadb' }
- { moodle-branch: 'MOODLE_401_STABLE', php: '8.0', node: '20.11', mariadb-ver: '10.5', pgsql-ver: '12', database: 'pgsql' }
# Also test all variants of 3.9 (LTS).
- {moodle-branch: 'MOODLE_39_STABLE', php: '7.4', node: '16.20', mariadb-ver: '10.5', pgsql-ver: '10', database: 'mariadb'}
- {moodle-branch: 'MOODLE_39_STABLE', php: '7.4', node: '16.20', mariadb-ver: '10.5', pgsql-ver: '10', database: 'pgsql'}
- {moodle-branch: 'MOODLE_39_STABLE', php: '7.4', node: '16.20', mariadb-ver: '10.5', pgsql-ver: '10', database: 'mariadb'}
- {moodle-branch: 'MOODLE_39_STABLE', php: '7.4', node: '16.20', mariadb-ver: '10.5', pgsql-ver: '10', database: 'pgsql'}
- { moodle-branch: 'MOODLE_401_STABLE', php: '7.4', node: '22', mariadb-ver: '10.5', pgsql-ver: '12', database: 'mariadb' }
- { moodle-branch: 'MOODLE_401_STABLE', php: '7.4', node: '22', mariadb-ver: '10.5', pgsql-ver: '12', database: 'pgsql' }
- { moodle-branch: 'MOODLE_401_STABLE', php: '8.0', node: '22', mariadb-ver: '10.5', pgsql-ver: '12', database: 'mariadb' }
- { moodle-branch: 'MOODLE_401_STABLE', php: '8.0', node: '22', mariadb-ver: '10.5', pgsql-ver: '12', database: 'pgsql' }
51 changes: 49 additions & 2 deletions .github/actions/parse-version/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ function output(string $name, string $value) {
$updates = json_decode(file_get_contents('https://download.moodle.org/api/1.3/updates.php?format=json&version=0.0&branch=3.8'), true);
$updates = $updates['updates']['core'] ?? [];


// Helper to normalize container name
function container_image_name($moodle_branch, $php) {
$repo = 'catalyst-moodle-workflows-'
. str_replace('_', '-', strtolower($moodle_branch))
. '-'
. str_replace('_', '-', strtolower($php));
return "ghcr.io/catalyst/$repo:latest";
}

$preparedMatrix = array_filter($matrix['include'], function($entry) use($plugin, $updates, $matrix) {

if (!isset($entry)) {
Expand Down Expand Up @@ -161,12 +171,49 @@ function output(string $name, string $value) {
return false;
});

$jsonMatrix = json_encode(['include' => array_values($preparedMatrix)], JSON_UNESCAPED_SLASHES);

// Add container image name to each entry
$finalMatrix = array_map(function($entry) {
$entry['container'] = container_image_name($entry['moodle-branch'], $entry['php']);
return $entry;
}, array_values($preparedMatrix));

$jsonMatrix = json_encode(['include' => $finalMatrix], JSON_UNESCAPED_SLASHES);
output('matrix', $jsonMatrix);

// Output the component / plugin name (which would be useful e.g. for a release)
output('component', $plugin->component);


// Output the highest available moodle branch in this set, which will be used to
// determine whether or not various tests/tasks will run, such as grunt.
output('highest_moodle_branch', reset($preparedMatrix)['moodle-branch'] ?? '');
$highestMoodleBranch = reset($preparedMatrix)['moodle-branch'] ?? '';
output('highest_moodle_branch', $highestMoodleBranch);

// Find the highest PHP version for the highest moodle branch
$phpVersions = [];
foreach ($finalMatrix as $entry) {
if ($entry['moodle-branch'] === $highestMoodleBranch) {
$phpVersions[] = $entry['php'];
}
}
if (!empty($phpVersions)) {
// Use version_compare to find the highest PHP version
usort($phpVersions, 'version_compare');
$highestPhp = end($phpVersions);
// Find the container for this combo
foreach ($finalMatrix as $entry) {
if ($entry['moodle-branch'] === $highestMoodleBranch && $entry['php'] === $highestPhp) {
output('latest_container', $entry['container']);
if (isset($entry['pgsql-ver'])) {
output('latest_pgsql_ver', $entry['pgsql-ver']);
} else {
output('latest_pgsql_ver', '');
}
break;
}
}
} else {
output('latest_container', '');
output('latest_pgsql_ver', '');
}
196 changes: 3 additions & 193 deletions .github/plugin/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,12 @@
name: 'Plugin setup'
description: 'Run plugin setup'
inputs:
codechecker_max_warnings:
description: 'Sets the value for --max-warnings on the moodle-plugin-ci codechecker step. Defaults to -1 which means no limit.'
default: '-1'
extra_php_extensions:
description: 'List of additional php packages to install'
extra_plugin_runners:
description: 'Command to install dependencies'
disable_behat:
description: 'Option to disable behat tests'
disable_mustache:
description: 'Option to disable mustache tests'
disable_phpdoc:
description: 'Option to disable phpdoc tests'
disable_phpcs:
description: 'Option to disable code standards (codechecker) tests'
disable_phplint:
description: 'Option to disable phplint tests'
disable_phpunit:
description: 'Option to disable phpunit tests'
disable_grunt:
description: 'Option to disable grunt'
enable_phpmd:
description: 'Option to enable phpmd'
disable_phpcpd:
description: 'Option to disable phpcpd'
disable_ci_validate:
description: 'Option to disable running moodle-plugin-ci validate'

highest_moodle_branch:
description: 'Holds the value of the highest moodle-branch in the test matrix'
moodle_branch:
description: 'Moodle branch to use (for patching)'
runs:
using: "composite"
steps:
Expand All @@ -39,186 +15,20 @@ runs:
with:
path: plugin
submodules: true
- name: Install node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
with:
php-version: ${{ matrix.php }}
ini-values: max_input_vars=5000
extensions: pgsql, mysqli, zip, gd, xmlrpc, soap, ${{ inputs.extra_php_extensions }}
coverage: none

- name: Configure Required Composer Version
id: install-composer1
if: ${{ matrix.moodle-branch == 'MOODLE_32_STABLE' || matrix.moodle-branch == 'MOODLE_33_STABLE' }}
run: |
echo "::set-output name=COMPOSER_VERSION::--1"
shell: bash

- name: Update Composer
if: ${{ matrix.moodle-branch == 'MOODLE_32_STABLE' || matrix.moodle-branch == 'MOODLE_33_STABLE' }}
run: |
composer self-update ${{ steps.install-composer1.outputs.COMPOSER_VERSION }}
shell: bash

- name: Initialise moodle-plugin-ci
run: |
# Initialise moodle-plugin-ci (install via composer)
echo "::group::Initialise moodle-plugin-ci"

composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci m-ci ^4
# Add dirs to $PATH
echo $(cd m-ci/bin; pwd) >> $GITHUB_PATH
echo $(cd m-ci/vendor/bin; pwd) >> $GITHUB_PATH
# PHPUnit depends on en_AU.UTF-8 locale
sudo locale-gen en_AU.UTF-8

echo "::endgroup::"
shell: bash

- name: Install dependencies
if: ${{ inputs.extra_plugin_runners }}
run: |
# Install dependencies
echo "::group::Install dependencies"

${{ inputs.extra_plugin_runners }}

echo "::endgroup::"
shell: bash

- name: Clone Moodle
# Clone to a temporary directory
run: |
echo "::group::Moodle clone output"

git clone https://github.com/moodle/moodle.git --branch $MOODLE_BRANCH $GITHUB_WORKSPACE/moodletemp

echo "::endgroup::"
shell: bash
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}

- name: Install Core Patches
if: ${{ always() }}
# Install core patches to moodle in temporary directory
run: |
git config --global user.email "test@test.com"
git config --global user.name "Test"
((test -f plugin/patch/${{ matrix.moodle-branch }}.diff && cd $GITHUB_WORKSPACE/moodletemp && git am --whitespace=nowarn < ../plugin/patch/${{ matrix.moodle-branch }}.diff) || echo No patch found;)
shell: bash

- name: Install Moodle and Plugin
# Install moodle, but use our temporary directory to include any potential core patches that have been applied.
run: |
# Install moodle commands
echo "::group::Moodle install output"

# This is a workaround for https://github.com/moodlehq/moodle-plugin-ci/issues/306 - we disable the git repository validation to allow folder cloning.
sed -i '/public function gitUrl($url)/{n; s/{/& return $url;/}' $GITHUB_WORKSPACE/m-ci/src/Validate.php

moodle-plugin-ci install -vvv --plugin ./plugin --db-host=127.0.0.1 --repo $GITHUB_WORKSPACE/moodletemp

echo "::endgroup::"
shell: bash
env:
DB: ${{ matrix.database }}
MOODLE_BRANCH: ${{ matrix.moodle-branch }}

- name: Run phplint
if: ${{ always() && inputs.disable_phplint != 'true' }}
run: moodle-plugin-ci phplint
shell: bash

- name: Run codechecker
if: ${{ always() && inputs.disable_phpcs != 'true' }}
run: moodle-plugin-ci codechecker --max-warnings=${{ inputs.codechecker_max_warnings }}
shell: bash

- name: Run validate
if: ${{ always() && inputs.disable_ci_validate != 'true' }}
run: moodle-plugin-ci validate
((test -f plugin/patch/${{ inputs.moodle_branch }}.diff && cd /moodle && git am --whitespace=nowarn < ../plugin/patch/${{ inputs.moodle_branch }}.diff) || echo No patch found;)
shell: bash

- name: Run savepoints
if: ${{ always() }}
run: moodle-plugin-ci savepoints
shell: bash

- name: Run mustache
if: ${{ always() && inputs.disable_mustache != 'true' }}
run: moodle-plugin-ci mustache
shell: bash

- name: Run grunt
if: ${{ always() && inputs.disable_grunt != 'true' && inputs.highest_moodle_branch == matrix.moodle-branch }}
run: moodle-plugin-ci grunt
shell: bash

- name: Run phpunit
if: ${{ always() && inputs.disable_phpunit != 'true' }}
run: |
moodle-plugin-ci phpunit
cd moodle
vendor/bin/phpunit --fail-on-risky --disallow-test-output --filter tool_dataprivacy_metadata_registry_testcase
vendor/bin/phpunit --fail-on-risky --disallow-test-output --testsuite core_privacy_testsuite --filter provider_testcase
shell: bash

- name: Run behat
if: ${{ always() && inputs.disable_behat != 'true' }}
run: moodle-plugin-ci behat --profile chrome
shell: bash

- name: PHP Copy/Paste Detector
if: ${{ always() && inputs.disable_phpcpd != 'true' }}
run: moodle-plugin-ci phpcpd
shell: bash

- name: PHP Mess Detector
if: ${{ always() && inputs.enable_phpmd == 'true' }}
run: moodle-plugin-ci phpmd
shell: bash

- name: Moodle PHPDoc Checker
if: ${{ always() && inputs.disable_phpdoc != 'true' && inputs.highest_moodle_branch == matrix.moodle-branch }}
# Run this check and only fail CI if it's on 4.0+ / master
run: |
# phpdoc checks

# Don't stop on faiures
set +e

# Note this block whilst large, was made so that it can be pasted locally if needed and isn't CI specific
# Disclaimer: you'll need to adjust the main command but otherwise the handling of output remains the same.
output=`GITHUB_PATH=$GITHUB_PATH moodle-plugin-ci phpdoc`
haserrors=$?

# No errors? Print and return.
if [[ $haserrors -eq 0 ]]; then
echo "phpdoc checks - OK"
exit 0
fi

# Skip incorrect errors/warnings and retain the relevant lines.
output=`echo "$output" | grep -v 'Class ( is not documented' | grep -v 'Could not connect to debugging client.'`
output=`echo "$output" | grep -B1 'Line'`

# Filter out github actions paths from the output. It should only
# show the path relevant to the files in the plugin repo.
# For example:
# from /home/runner/work/moodle-tool_dataflows/moodle-tool_dataflows/moodle/admin/tool/dataflows/db/upgrade.php
# to db/upgrade.php at best,
# or admin/tool/dataflows/db/upgrade.php
currentdir=$(pwd)
if [[ "$output" ]]; then
echo "$output" | sed -e "s,$currentdir/,,g" | sed -e "s,^moodle/,,g" | tee $GITHUB_STEP_SUMMARY
exit 1
fi

echo "phpdoc checks - OK"
shell: bash
Loading