Skip to content

ci: add Moodle Plugin CI workflow - #3

Merged
imfelixyeung merged 3 commits into
mainfrom
ci-workflow
Jun 14, 2026
Merged

ci: add Moodle Plugin CI workflow#3
imfelixyeung merged 3 commits into
mainfrom
ci-workflow

Conversation

@imfelixyeung

Copy link
Copy Markdown
Collaborator

Adds GitHub Actions CI workflow for automated testing (PHP lint, code checker, PHPUnit, Behat). Only PHP 8.4 is used as this is a simple plugin.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

Recent review info
Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 622ad6af-7439-4b54-a4d1-9744aec3c61a

Commits

Reviewing files that changed from the base of the PR and between d2de319 and 014689b.

Files selected for processing (1)
  • .github/workflows/moodle-ci.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/moodle-ci.yaml

Walkthrough

Summary by CodeRabbit

  • Chores
    • Updated the “Moodle Plugin CI” workflow to run on every pull request and on pushes to the main branch.
    • Added CI coverage across multiple PHP versions and Moodle stable branches, with targeted exclusions.
    • Enabled end-to-end testing plus comprehensive linting and documentation checks; Behat failures now produce a faildump artefact for easier diagnosis.

Walkthrough

Adds .github/workflows/moodle-ci.yaml, a new GitHub Actions workflow that triggers on pushes to main and all pull requests. It runs a matrix of PHP 8.3 and 8.4 against Moodle stable branches (MOODLE_405_STABLE through MOODLE_502_STABLE), excluding the PHP 8.4 + MOODLE_405_STABLE combination. The workflow provisions MariaDB 10, installs moodle-plugin-ci, and executes a full sequence of PHP lint, PHPMD, PHPCS, PHPDoc, Moodle validation, Mustache lint, Grunt lint, PHPUnit, and Behat checks with conditional artefact upload on Behat failure.

Changes

Moodle Plugin CI Workflow

Layer / File(s) Summary
Workflow triggers, matrix, and MariaDB service
.github/workflows/moodle-ci.yaml
Defines push and pull-request triggers, the ubuntu-22.04 job, a MariaDB 10 service container, and a PHP/Moodle branch matrix with an explicit exclusion for MOODLE_405_STABLE and PHP 8.4.
PHP setup, moodle-plugin-ci installation, and core CI checks
.github/workflows/moodle-ci.yaml
Checks out the repository into a plugin subdirectory, sets up PHP with required extensions, installs moodle-plugin-ci via Composer with environment configuration, then sequentially runs PHP lint, PHPMD, PHPCS, PHPDoc, Moodle validation, upgrade savepoints, Mustache lint, Grunt lint, and PHPUnit—each step gated by cancellation checks with selective continue-on-error for PHPMD and PHPDoc.
Behat execution, faildump artefact, and cancellation handler
.github/workflows/moodle-ci.yaml
Runs Behat using the chrome profile with an SCSS deprecation environment variable, conditionally uploads moodledata/behat_dump as a 7-day artefact when Behat fails, and forces a non-zero exit if the job is cancelled.

@imfelixyeung
imfelixyeung enabled auto-merge June 14, 2026 16:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/moodle-ci.yaml:
- Around line 30-42: The CI matrix currently only includes PHP 8.4 and has an
exclude rule that prevents MOODLE_405_STABLE from being tested with PHP 8.4,
which means the minimum supported Moodle branch declared in version.php is never
exercised by the CI. Add another PHP version to the php array that is compatible
with MOODLE_405_STABLE (such as an earlier PHP version), and then either remove
the exclude rule or modify it to only exclude incompatible PHP and Moodle branch
combinations, allowing at least one combination to test the minimum supported
Moodle branch.
- Line 45: GitHub Actions at lines 45, 50, and 119 are using tag-based
references (such as `@v4`) instead of immutable full-length commit SHAs, which
creates a supply-chain security risk. For each of these lines, replace the
tag-based reference with the corresponding resolved full commit SHA. For
example, actions/checkout@v4 should be replaced with actions/checkout@ followed
by the full 40-character commit SHA that `@v4` currently resolves to. This applies
to all three instances where `@v`* tags are used.
- Line 53: The `matrix.extensions` reference is undefined because the extensions
key is not defined in the matrix configuration (which only contains php,
moodle-branch, and database). Either add extensions as a new matrix key with
appropriate values, or remove the reference to matrix.extensions and use a
static value if extension configuration is not matrix-dependent. Additionally,
the `join(matrix.*, ', ')` expression on the other line uses invalid syntax that
cannot filter matrix object values; replace this with valid GitHub Actions
syntax such as referencing a specific matrix key or restructure the logic to
properly join the intended values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

Comment thread .github/workflows/moodle-ci.yaml Outdated
Comment thread .github/workflows/moodle-ci.yaml Outdated
Comment thread .github/workflows/moodle-ci.yaml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Nitpick comments (3)
.github/workflows/moodle-ci.yaml (3)

17-17: ⚡ Quick win

Consider pinning the MariaDB image to a specific minor version.

The mariadb:10 tag references the latest patch release in the 10.x series, which may introduce non-deterministic behaviour across builds. Pinning to a specific minor version (e.g., mariadb:10.11) would improve reproducibility.

Proposed fix
-                image: mariadb:10
+                image: mariadb:10.11
Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/moodle-ci.yaml at line 17, The MariaDB image tag in the CI
workflow is using only the major version (mariadb:10), which pulls the latest
patch release and causes non-deterministic builds. Pin the image to a specific
minor version (such as mariadb:10.11) instead of mariadb:10 to ensure
reproducible and consistent builds across different CI runs. This change applies
to the image specification in the MariaDB service configuration.

88-93: ⚖️ Poor tradeoff

Consider whether PHPDoc failures should block CI.

Similar to PHPMD, continue-on-error: true allows PHPDoc checker to fail without failing the job. Whilst --max-warnings 0 enforces strict checking when it runs, failures won't prevent merges.

Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/moodle-ci.yaml around lines 88 - 93, The Moodle PHPDoc
Checker step has a contradiction: it uses --max-warnings 0 to enforce strict
checking, but also has continue-on-error: true which allows the step to fail
without blocking the job. Decide whether PHPDoc failures should block CI merges.
If yes, remove the continue-on-error: true directive from the Moodle PHPDoc
Checker step to make failures fail the job. If no, adjust the --max-warnings
threshold or remove the strict enforcement. The current configuration sends
mixed signals about the importance of PHPDoc compliance.

79-82: ⚖️ Poor tradeoff

Consider whether PHPMD failures should block CI.

The continue-on-error: true setting allows PHPMD to fail without failing the job, which reduces CI strictness. This may be intentional if PHPMD produces false positives, but it means potential code quality issues won't block merges.

Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/moodle-ci.yaml around lines 79 - 82, The PHP Mess Detector
step in the moodle-ci.yaml workflow has `continue-on-error: true` set, which
allows PHPMD to fail without blocking the CI job. Determine if this is
intentional based on your project's code quality standards: either remove the
`continue-on-error: true` line from the PHP Mess Detector step to make PHPMD
failures block CI and enforce code quality checks, or keep it if PHPMD produces
acceptable false positives that shouldn't block merges. Make an explicit
decision and ensure it aligns with your project's CI strictness requirements.
Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/moodle-ci.yaml:
- Line 56: The extensions list in the GitHub Actions workflow configuration is
missing the required pdo_sqlite PHP extension. Update the extensions parameter
that currently contains "mysqli,pdo_mysql" to include pdo_sqlite by adding it to
the comma-separated list, ensuring the plugin's core export functionality and
tests can run successfully without encountering missing extension errors.

---

Nitpick comments:
In @.github/workflows/moodle-ci.yaml:
- Line 17: The MariaDB image tag in the CI workflow is using only the major
version (mariadb:10), which pulls the latest patch release and causes
non-deterministic builds. Pin the image to a specific minor version (such as
mariadb:10.11) instead of mariadb:10 to ensure reproducible and consistent
builds across different CI runs. This change applies to the image specification
in the MariaDB service configuration.
- Around line 88-93: The Moodle PHPDoc Checker step has a contradiction: it uses
--max-warnings 0 to enforce strict checking, but also has continue-on-error:
true which allows the step to fail without blocking the job. Decide whether
PHPDoc failures should block CI merges. If yes, remove the continue-on-error:
true directive from the Moodle PHPDoc Checker step to make failures fail the
job. If no, adjust the --max-warnings threshold or remove the strict
enforcement. The current configuration sends mixed signals about the importance
of PHPDoc compliance.
- Around line 79-82: The PHP Mess Detector step in the moodle-ci.yaml workflow
has `continue-on-error: true` set, which allows PHPMD to fail without blocking
the CI job. Determine if this is intentional based on your project's code
quality standards: either remove the `continue-on-error: true` line from the PHP
Mess Detector step to make PHPMD failures block CI and enforce code quality
checks, or keep it if PHPMD produces acceptable false positives that shouldn't
block merges. Make an explicit decision and ensure it aligns with your project's
CI strictness requirements.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

Comment thread .github/workflows/moodle-ci.yaml Outdated
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

@imfelixyeung
imfelixyeung merged commit 5fbbf0d into main Jun 14, 2026
7 checks passed
@imfelixyeung
imfelixyeung deleted the ci-workflow branch June 14, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant