Skip to content

Add GitHub Actions checks for pull requests - #438

Open
ECYaz wants to merge 1 commit into
phpbb:3.3.xfrom
ECYaz:ci/github-actions
Open

Add GitHub Actions checks for pull requests#438
ECYaz wants to merge 1 commit into
phpbb:3.3.xfrom
ECYaz:ci/github-actions

Conversation

@ECYaz

@ECYaz ECYaz commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Closes #437.

Adds the checks proposed there and removes the dead CI config:

  • lint, php -l over first party files on PHP 7.4, 8.1, 8.2 and 8.3
  • coding standards, phpBB's ruleset-php-extensions.xml via phpcs-changed, reporting only violations a pull request introduces
  • composer validate

The 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.yml pins PHP 5.3 and points phpunit at test/travis/, which no longer exists, and .gitmodules references a submodule over the retired git:// 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 ELSEIF fails 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.

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.

Copilot AI 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.

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-latest here 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-latest can 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 thread .github/workflows/ci.yml
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 thread .github/workflows/ci.yml
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 thread .github/workflows/ci.yml
Comment on lines +13 to +15
name: "Lint (PHP ${{ matrix.php }})"
runs-on: ubuntu-latest
strategy:
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.

Add CI checks for pull requests

2 participants