Skip to content

Commit

Permalink
Update moodle-plugin-ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Jul 16, 2024
1 parent a4841ba commit 28fc123
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 38 deletions.
54 changes: 32 additions & 22 deletions .github/workflows/moodle-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,28 @@ jobs:
# - each database at least once
include:
- {php: '7.4', moodle-branch: MOODLE_401_STABLE, database: mariadb}
- {php: '8.0', moodle-branch: MOODLE_402_STABLE, database: pgsql}
- {php: '8.1', moodle-branch: MOODLE_402_STABLE, database: pgsql}
- {php: '8.2', moodle-branch: MOODLE_403_STABLE, database: mariadb}
- {php: '8.1', moodle-branch: main, database: pgsql}
- {php: '8.1', moodle-branch: MOODLE_404_STABLE, database: pgsql}
- {php: '8.2', moodle-branch: main, database: mariadb}

steps:
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: plugin

- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, pgsql, mysqli
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none

- name: Initialise moodle-plugin-ci
run: |
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
Expand All @@ -71,47 +72,56 @@ jobs:
MOODLE_BRANCH: ${{ matrix.moodle-branch }}

- name: PHP Lint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phplint

- name: PHP Copy/Paste Detector
if: ${{ always() }}
continue-on-error: true # This step will show errors but will not fail
run: moodle-plugin-ci phpcpd

- name: PHP Mess Detector
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpmd

- name: Moodle Code Checker
if: ${{ always() }}
run: moodle-plugin-ci codechecker --max-warnings 0
continue-on-error: true # This step will show errors but will not fail
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpcs --max-warnings 0

- name: Moodle PHPDoc Checker
continue-on-error: true # This step will show errors but will not fail
if: ${{ always() }}
run: moodle-plugin-ci phpdoc
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpdoc --max-warnings 0

- name: Validating
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci validate

- name: Check upgrade savepoints
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci savepoints

- name: Mustache Lint
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci grunt --max-lint-warnings 0

- name: PHPUnit tests
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci phpunit

- name: Behat features
if: ${{ always() }}
if: ${{ !cancelled() }}
run: moodle-plugin-ci behat --profile chrome

- name: Upload Behat Faildump
if: ${{ failure() && steps.behat.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: Behat Faildump (${{ join(matrix.*, ', ') }})
path: ${{ github.workspace }}/moodledata/behat_dump
retention-days: 7
if-no-files-found: ignore

- name: Mark cancelled jobs as failed.
if: ${{ cancelled() }}
run: exit 1
16 changes: 0 additions & 16 deletions classes/statistics_calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ private static function get_attempt_stat_joins($cmid, $groupid, $excluderoles =
JOIN {question_references} qr ON qr.itemid = sqq.id
AND qr.component = 'mod_studentquiz'
AND qr.questionarea = 'studentquiz_question'
AND qr.usingcontextid = :contextid1
JOIN {question_bank_entries} qbe ON qr.questionbankentryid = qbe.id
JOIN {question_versions} qv ON qv.questionbankentryid = qr.questionbankentryid AND qv.version = (
SELECT MAX(version)
Expand Down Expand Up @@ -164,7 +163,6 @@ private static function get_attempt_stat_joins($cmid, $groupid, $excluderoles =
JOIN {question_references} qr ON qr.itemid = sqq.id
AND qr.component = 'mod_studentquiz'
AND qr.questionarea = 'studentquiz_question'
AND qr.usingcontextid = :contextid2
JOIN {question_bank_entries} qbe ON qr.questionbankentryid = qbe.id
JOIN {question_versions} qv ON qv.questionbankentryid = qr.questionbankentryid AND qv.version = (
SELECT MAX(version)
Expand Down Expand Up @@ -199,7 +197,6 @@ private static function get_attempt_stat_joins($cmid, $groupid, $excluderoles =
JOIN {question_references} qr ON qr.itemid = sqq.id
AND qr.component = 'mod_studentquiz'
AND qr.questionarea = 'studentquiz_question'
AND qr.usingcontextid = :contextid3
JOIN {question_bank_entries} qbe ON qr.questionbankentryid = qbe.id
JOIN {question_versions} qv ON qv.questionbankentryid = qr.questionbankentryid AND qv.version = (
SELECT MAX(version)
Expand Down Expand Up @@ -234,7 +231,6 @@ private static function get_attempt_stat_joins($cmid, $groupid, $excluderoles =
JOIN {question_references} qr ON qr.itemid = sqq.id
AND qr.component = 'mod_studentquiz'
AND qr.questionarea = 'studentquiz_question'
AND qr.usingcontextid = :contextid4
JOIN {question_bank_entries} qbe ON qr.questionbankentryid = qbe.id
JOIN {question_versions} qv ON qv.questionbankentryid = qr.questionbankentryid AND qv.version = (
SELECT MAX(version)
Expand Down Expand Up @@ -263,7 +259,6 @@ private static function get_attempt_stat_joins($cmid, $groupid, $excluderoles =
JOIN {question_references} qr ON qr.itemid = sqq.id
AND qr.component = 'mod_studentquiz'
AND qr.questionarea = 'studentquiz_question'
AND qr.usingcontextid = :contextid5
JOIN {question_bank_entries} qbe ON qr.questionbankentryid = qbe.id
JOIN {question_versions} qv ON qv.questionbankentryid = qr.questionbankentryid AND qv.version = (
SELECT MAX(version)
Expand Down Expand Up @@ -308,7 +303,6 @@ private static function get_attempt_stat_joins($cmid, $groupid, $excluderoles =
* @return array
*/
private static function get_attempt_stat_joins_params($cmid, $quantifiers = null, $userid = null): array {
$contextid = \context_module::instance($cmid)->id;
$params = [
'cmid1' => $cmid,
'cmid2' => $cmid,
Expand All @@ -317,11 +311,6 @@ private static function get_attempt_stat_joins_params($cmid, $quantifiers = null
'cmid5' => $cmid,
'cmid6' => $cmid,
'cmid7' => $cmid,
'contextid1' => $contextid,
'contextid2' => $contextid,
'contextid3' => $contextid,
'contextid4' => $contextid,
'contextid5' => $contextid,
'status1' => question_version_status::QUESTION_STATUS_HIDDEN,
'status2' => question_version_status::QUESTION_STATUS_HIDDEN,
'status3' => question_version_status::QUESTION_STATUS_HIDDEN,
Expand Down Expand Up @@ -444,7 +433,6 @@ public static function get_question_stats($cmid, $groupid) {
JOIN {question_references} qr ON qr.itemid = sqq.id
AND qr.component = 'mod_studentquiz'
AND qr.questionarea = 'studentquiz_question'
AND qr.usingcontextid = :contextid1
JOIN {question_bank_entries} qbe ON qr.questionbankentryid = qbe.id
JOIN {question_versions} qv ON qv.questionbankentryid = qr.questionbankentryid AND qv.version = (
SELECT MAX(version)
Expand All @@ -461,7 +449,6 @@ public static function get_question_stats($cmid, $groupid) {
JOIN {question_bank_entries} qbe ON qr.questionbankentryid = qbe.id
AND qr.component = 'mod_studentquiz'
AND qr.questionarea = 'studentquiz_question'
AND qr.usingcontextid = :contextid2
JOIN {question_versions} qv ON qv.questionbankentryid = qr.questionbankentryid AND qv.version = (
SELECT MAX(version)
FROM {question_versions}
Expand All @@ -477,12 +464,9 @@ public static function get_question_stats($cmid, $groupid) {
'q.parent = 0',
'sq.coursemodule = :cmid1'
];
$contextid = \context_module::instance($cmid)->id;
$params = [
'cmid1' => $cmid,
'cmid2' => $cmid,
'contextid1' => $contextid,
'contextid2' => $contextid,
'status1' => question_version_status::QUESTION_STATUS_HIDDEN,
'status2' => question_version_status::QUESTION_STATUS_HIDDEN,
];
Expand Down

0 comments on commit 28fc123

Please sign in to comment.