From 97c83d0909f55cd6072c2749966fe73d8e3b40e7 Mon Sep 17 00:00:00 2001 From: Felix Yeung <19355619+imfelixyeung@users.noreply.github.com> Date: Sun, 14 Jun 2026 17:17:24 +0100 Subject: [PATCH 1/3] ci: add Moodle Plugin CI workflow --- .github/workflows/moodle-ci.yaml | 128 +++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 .github/workflows/moodle-ci.yaml diff --git a/.github/workflows/moodle-ci.yaml b/.github/workflows/moodle-ci.yaml new file mode 100644 index 0000000..ef20b43 --- /dev/null +++ b/.github/workflows/moodle-ci.yaml @@ -0,0 +1,128 @@ +# Modified from https://github.com/moodlehq/moodle-plugin-ci/blob/198ee6c2b36eddba6c3ccac560f50396792c1b47/gha.dist.yml + +name: Moodle Plugin CI + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-22.04 + + services: + mariadb: + image: mariadb:10 + env: + MYSQL_USER: "root" + MYSQL_ALLOW_EMPTY_PASSWORD: "true" + MYSQL_CHARACTER_SET_SERVER: "utf8mb4" + MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci" + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3 + + strategy: + fail-fast: false + matrix: + php: ["8.4"] + moodle-branch: + [ + "MOODLE_405_STABLE", + "MOODLE_500_STABLE", + "MOODLE_501_STABLE", + "MOODLE_502_STABLE", + ] + database: [mariadb] + exclude: + - moodle-branch: MOODLE_405_STABLE + php: "8.4" + + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + path: plugin + + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + 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 ^4 + echo $(cd ci/bin; pwd) >> $GITHUB_PATH + echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH + sudo locale-gen en_AU.UTF-8 + echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV + + - name: Install moodle-plugin-ci + run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1 + env: + DB: ${{ matrix.database }} + MOODLE_BRANCH: ${{ matrix.moodle-branch }} + IGNORE_PATHS: "vendor" + + - name: PHP Lint + if: ${{ !cancelled() }} + run: moodle-plugin-ci phplint + + - name: PHP Mess Detector + continue-on-error: true + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpmd + + - name: Moodle Code Checker + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpcs --max-warnings 0 + + - name: Moodle PHPDoc Checker + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpdoc --max-warnings 0 || exit 0 + continue-on-error: true + env: + MDL_LOCAL_DEVKIT_DISABLE: 1 + + - name: Validating + if: ${{ !cancelled() }} + run: moodle-plugin-ci validate + + - name: Check upgrade savepoints + if: ${{ !cancelled() }} + run: moodle-plugin-ci savepoints + + - name: Mustache Lint + if: ${{ !cancelled() }} + run: moodle-plugin-ci mustache + + - name: Grunt + if: ${{ !cancelled() }} + run: moodle-plugin-ci grunt --max-lint-warnings 0 + + - name: PHPUnit tests + if: ${{ !cancelled() }} + run: moodle-plugin-ci phpunit --fail-on-warning + + - name: Behat features + id: behat + if: ${{ !cancelled() }} + run: moodle-plugin-ci behat --profile chrome --scss-deprecations + + - 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 From d2de319f5771f52d1bb356a47639cebf59b0fa48 Mon Sep 17 00:00:00 2001 From: Felix Yeung <19355619+imfelixyeung@users.noreply.github.com> Date: Sun, 14 Jun 2026 21:29:37 +0100 Subject: [PATCH 2/3] fix: address review comments - matrix, SHA pinning, extensions, joins --- .github/workflows/moodle-ci.yaml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/moodle-ci.yaml b/.github/workflows/moodle-ci.yaml index ef20b43..5dbdc44 100644 --- a/.github/workflows/moodle-ci.yaml +++ b/.github/workflows/moodle-ci.yaml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - php: ["8.4"] + php: ["8.3", "8.4"] moodle-branch: [ "MOODLE_405_STABLE", @@ -42,15 +42,18 @@ jobs: steps: - name: Check out repository code - uses: actions/checkout@v4 + # actions/checkout@v4.3.1 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: path: plugin + persist-credentials: false - name: Setup PHP ${{ matrix.php }} - uses: shivammathur/setup-php@v2 + # shivammathur/setup-php@v2 + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 with: php-version: ${{ matrix.php }} - extensions: ${{ matrix.extensions }} + extensions: mysqli,pdo_mysql ini-values: max_input_vars=5000 coverage: none @@ -84,7 +87,7 @@ jobs: - name: Moodle PHPDoc Checker if: ${{ !cancelled() }} - run: moodle-plugin-ci phpdoc --max-warnings 0 || exit 0 + run: moodle-plugin-ci phpdoc --max-warnings 0 continue-on-error: true env: MDL_LOCAL_DEVKIT_DISABLE: 1 @@ -116,9 +119,10 @@ jobs: - name: Upload Behat Faildump if: ${{ failure() && steps.behat.outcome == 'failure' }} - uses: actions/upload-artifact@v4 + # actions/upload-artifact@v4.6.2 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with: - name: Behat Faildump (${{ join(matrix.*, ', ') }}) + name: Behat Faildump (${{ matrix.php }}, ${{ matrix.moodle-branch }}, ${{ matrix.database }}) path: ${{ github.workspace }}/moodledata/behat_dump retention-days: 7 if-no-files-found: ignore From 014689bee5555dc278ef22a3bcd2cc901bac4501 Mon Sep 17 00:00:00 2001 From: Felix Yeung <19355619+imfelixyeung@users.noreply.github.com> Date: Sun, 14 Jun 2026 21:40:21 +0100 Subject: [PATCH 3/3] fix: add pdo_sqlite extension for sqlite plugin --- .github/workflows/moodle-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/moodle-ci.yaml b/.github/workflows/moodle-ci.yaml index 5dbdc44..7348874 100644 --- a/.github/workflows/moodle-ci.yaml +++ b/.github/workflows/moodle-ci.yaml @@ -53,7 +53,7 @@ jobs: uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 with: php-version: ${{ matrix.php }} - extensions: mysqli,pdo_mysql + extensions: mysqli,pdo_mysql,pdo_sqlite ini-values: max_input_vars=5000 coverage: none