From 182f659c973f7071aaa7cf205cecc978a8dd8161 Mon Sep 17 00:00:00 2001 From: ECYaz Date: Mon, 27 Jul 2026 07:20:48 -0400 Subject: [PATCH 1/2] Add GitHub Actions checks for pull requests 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. --- .github/workflows/ci.yml | 104 +++++++++++++++++++++++++++++++++++++++ .gitmodules | 3 -- .travis.yml | 18 ------- 3 files changed, 104 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .gitmodules delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..0ab3ad07c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,104 @@ +name: CI + +on: + push: + branches: + - 3.3.x + - master + - 4.0.x + pull_request: + +jobs: + lint: + name: "Lint (PHP ${{ matrix.php }})" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['7.4', '8.1', '8.2', '8.3'] + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + + - name: Syntax check + run: | + find . -name '*.php' \ + -not -path './vendor/*' \ + -not -path './includes/library/*' \ + -not -path './composer_packages/*' \ + -print0 | xargs -0 -n1 -P4 php -l > /dev/null + + coding-standards: + name: Coding standards (changed files) + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: none + tools: cs2pr + + - name: Fetch the phpBB coding standard + run: | + 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 + + - name: Install PHP_CodeSniffer and phpcs-changed + run: | + composer --working-dir="$RUNNER_TEMP" require --no-interaction \ + squizlabs/php_codesniffer:^3.7 \ + sirbrillig/phpcs-changed:^2.11 + + - name: Check lines changed by this pull request + run: | + 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]}" + + - name: Annotate the pull request + if: ${{ failure() }} + run: cs2pr phpcs.xml + + composer: + name: Validate composer.json + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + coverage: none + + - name: Validate + run: composer validate --no-check-all --no-check-publish diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4125b6d7f..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "test/vendor/phpBB"] - path = test/vendor/phpBB - url = git://github.com/phpbb/phpbb3.git diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1698a3d2f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: php -php: - - 5.3 - -env: - - DB=mysql - -before_script: - - pyrus set auto_discover 1 - - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS cdb_tests;'; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.2' ]; then pear install --force phpunit/DbUnit; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3' ]; then pyrus install --force phpunit/DbUnit; fi" - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.4' ]; then pyrus install --force phpunit/DbUnit; fi" - - phpenv rehash - - git submodule update --init - -script: - - phpunit --configuration test/travis/$DB.travis.xml From 978a473e2a4b6e090778c97828e775c7d498b016 Mon Sep 17 00:00:00 2001 From: ECYaz Date: Wed, 29 Jul 2026 06:20:44 -0400 Subject: [PATCH 2/2] Pin runners and pass changed files as an array Pin the jobs to ubuntu-22.04, matching phpBB's own 3.3.x workflows, so the PHP 7.4 job cannot break when GitHub advances ubuntu-latest. Collect the changed files with mapfile instead of an unquoted string so paths survive word splitting, and drop the shellcheck suppression the old expansion needed. --- .github/workflows/ci.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ab3ad07c..00de74335 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: jobs: lint: name: "Lint (PHP ${{ matrix.php }})" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: @@ -35,7 +35,7 @@ jobs: coding-standards: name: Coding standards (changed files) - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 if: github.event_name == 'pull_request' steps: @@ -64,24 +64,23 @@ jobs: - name: Check lines changed by this pull request run: | git fetch --no-tags origin "$GITHUB_BASE_REF" - FILES=$(git diff --name-only --diff-filter=ACMR "origin/$GITHUB_BASE_REF"...HEAD -- '*.php' \ + mapfile -t 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 + if [ "${#files[@]}" -eq 0 ]; then echo "No PHP files changed." exit 0 fi - echo "$FILES" + printf '%s\n' "${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 + --report checkstyle "${files[@]}" | tee phpcs.xml exit "${PIPESTATUS[0]}" - name: Annotate the pull request @@ -90,7 +89,7 @@ jobs: composer: name: Validate composer.json - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4