Add GitHub Actions checks for pull requests - #438
Open
ECYaz wants to merge 1 commit into
Open
Conversation
Nothing verified a pull request. The only CI config was a Travis file pinned to PHP 5.3 running phpunit against test/travis/, a directory that no longer exists, alongside a .gitmodules pointing at git://github.com/phpbb/phpbb3.git. Neither has run in years and there is no submodule gitlink left in the tree, so both are removed. There are no tests in the repo, so this is not a test suite: lint php -l on 7.4, 8.1, 8.2 and 8.3 coding standards phpBB's extension ruleset via phpcs-changed composer composer validate The coding standards job reports only violations a pull request introduces. The whole tree currently carries 175 pre-existing errors across 75 files, so a tree-wide check would be permanently red, and checking whole changed files would fail anyone touching a legacy file on violations they did not write. Comparing against the base branch keeps new code clean without demanding a cleanup first.
There was a problem hiding this comment.
Pull request overview
This PR replaces the legacy Travis/submodule CI setup with a GitHub Actions workflow that runs lightweight validation on pushes and pull requests, aligning with the goal in #437 to provide pass/fail checks for every PR.
Changes:
- Removed obsolete CI/submodule configuration (
.travis.yml,.gitmodules). - Added a GitHub Actions workflow to run
php -l(PHP 7.4/8.1/8.2/8.3),composer validate, and a “changed-lines only” phpBB coding standards check with diff annotations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.travis.yml |
Removes dead Travis CI configuration that targets PHP 5.3 and missing test paths. |
.gitmodules |
Removes stale submodule config referencing retired git:// transport. |
.github/workflows/ci.yml |
Adds GitHub Actions CI workflow for linting, coding standards on changed lines, and composer validation. |
Comments suppressed due to low confidence (2)
.github/workflows/ci.yml:39
- Using
ubuntu-latesthere can cause CI to change or break when the default runner image is updated. Pinning the runner (e.g. ubuntu-22.04) helps keep the coding-standards check stable and easier to debug across time.
name: Coding standards (changed files)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
.github/workflows/ci.yml:94
- Using
ubuntu-latestcan introduce unexpected CI failures when GitHub advances the runner image. Since this job is intended to be a lightweight validation, pinning the Ubuntu version improves stability (particularly while still validating under PHP 7.4).
name: Validate composer.json
runs-on: ubuntu-latest
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+66
to
+85
| git fetch --no-tags origin "$GITHUB_BASE_REF" | ||
| FILES=$(git diff --name-only --diff-filter=ACMR "origin/$GITHUB_BASE_REF"...HEAD -- '*.php' \ | ||
| | grep -vE '^(vendor|includes/library|composer_packages)/' || true) | ||
|
|
||
| if [ -z "$FILES" ]; then | ||
| echo "No PHP files changed." | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "$FILES" | ||
| # Only report violations this pull request introduces. Running the ruleset | ||
| # over whole files would fail on the 175 pre-existing errors any time a | ||
| # legacy file is touched, which would make the check useless. | ||
| # shellcheck disable=SC2086 | ||
| "$RUNNER_TEMP/vendor/bin/phpcs-changed" \ | ||
| --git --git-base "origin/$GITHUB_BASE_REF" \ | ||
| --phpcs-path "$RUNNER_TEMP/vendor/bin/phpcs" \ | ||
| --standard "$RUNNER_TEMP/phpbb/build/code_sniffer/ruleset-php-extensions.xml" \ | ||
| --report checkstyle $FILES | tee phpcs.xml | ||
| exit "${PIPESTATUS[0]}" |
Comment on lines
+54
to
+56
| git clone --depth 1 --branch 3.3.x --filter=blob:none --sparse \ | ||
| https://github.com/phpbb/phpbb.git "$RUNNER_TEMP/phpbb" | ||
| git -C "$RUNNER_TEMP/phpbb" sparse-checkout set build/code_sniffer |
Comment on lines
+13
to
+15
| name: "Lint (PHP ${{ matrix.php }})" | ||
| runs-on: ubuntu-latest | ||
| strategy: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #437.
Adds the checks proposed there and removes the dead CI config:
php -lover first party files on PHP 7.4, 8.1, 8.2 and 8.3ruleset-php-extensions.xmlvia phpcs-changed, reporting only violations a pull request introducescomposer validateThe standards job compares changed lines against the base branch rather than checking whole files or the whole tree. The tree currently carries 175 pre-existing errors across 75 files, so a tree-wide check would be permanently red, and whole changed files would fail anyone touching a legacy file on violations they did not write. Failures are annotated on the diff via cs2pr.
.travis.ymlpins PHP 5.3 and points phpunit attest/travis/, which no longer exists, and.gitmodulesreferences a submodule over the retiredgit://protocol with no gitlink left in the tree, so both are removed.Exercised on a scratch repository before opening this: lint is green on all four PHP versions, a deliberately introduced
ELSEIFfails the standards job on exactly that line, and a pull request touching a file with pre-existing violations passes as long as it introduces none.