From 7f6315c84e5c6f8d9601011514b18d6c69309e60 Mon Sep 17 00:00:00 2001 From: malberts Date: Thu, 21 May 2026 10:31:58 +0200 Subject: [PATCH] CI: switch to vendor/bin/phpunit for MediaWiki master MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MediaWiki master (≥ 1.46) removed the bundled `tests/phpunit/phpunit.php` runner — the master matrix entry was failing with "Could not open input file: tests/phpunit/phpunit.php". For the master matrix entry only, drive PHPUnit via: composer phpunit:config vendor/bin/phpunit -c extensions/BootstrapComponents/phpunit.xml.dist \ --bootstrap tests/phpunit/bootstrap.php \ --testsuite bootstrap-components-unit `composer phpunit:config` (introduced on master) generates the runner-side phpunit.xml from `phpunit.xml.template`. MW's `.gitattributes` marks that template as `export-ignore`, so it's missing from the source-archive tarball that `installWiki.sh` was fetching with `wget`. Switch `installWiki.sh` to `git clone --depth 1` so the file ships. Empirically the same wall-clock time (~7-9s either way over GH-to-GH) and ~40MB extra `.git/` retained in the cached `mediawiki/` tree. Bump the `mediawiki/` cache-key suffix to `-v2` so existing caches populated by the old wget path don't shadow the new git-clone install. Gate the existing two PHPUnit invocations on `matrix.mw != 'master'` so REL1_39–REL1_43 keep their working behaviour unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 16 +++++++++++++--- .github/workflows/installWiki.sh | 10 ++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df5ea06..f09781f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,7 +74,7 @@ jobs: mediawiki !mediawiki/extensions/ !mediawiki/vendor/ - key: mw_${{ matrix.mw }}-php${{ matrix.php }} + key: mw_${{ matrix.mw }}-php${{ matrix.php }}-v2 - name: Cache Composer cache uses: actions/cache@v4 @@ -102,14 +102,24 @@ jobs: working-directory: ~ run: bash EarlyCopy/.github/workflows/uploadImages.sh - - if: env.TYPE != 'coverage' + - if: env.TYPE != 'coverage' && matrix.mw != 'master' name: Run PHPUnit w/o coverage run: php tests/phpunit/phpunit.php -c extensions/BootstrapComponents/ --testsuite bootstrap-components-unit - - if: env.TYPE == 'coverage' + - if: env.TYPE == 'coverage' && matrix.mw != 'master' name: Run PHPUnit w/ coverage run: php tests/phpunit/phpunit.php -c extensions/BootstrapComponents/ --testsuite bootstrap-components-unit --coverage-clover coverage.clover + - if: matrix.mw == 'master' + name: Run PHPUnit (MW master) + run: | + # MediaWiki master (≥ 1.46) removed tests/phpunit/phpunit.php; the + # supported runner is vendor/bin/phpunit against the config + # generated by `composer phpunit:config` from phpunit.xml.template + # (which installWiki.sh's git clone ships). + composer phpunit:config + vendor/bin/phpunit -c extensions/BootstrapComponents/phpunit.xml.dist --bootstrap tests/phpunit/bootstrap.php --testsuite bootstrap-components-unit + - if: env.TYPE == 'coverage' name: upload coverage report working-directory: ~ diff --git a/.github/workflows/installWiki.sh b/.github/workflows/installWiki.sh index 62b6662..41d7b53 100644 --- a/.github/workflows/installWiki.sh +++ b/.github/workflows/installWiki.sh @@ -4,10 +4,12 @@ MW_BRANCH=$1 EXTENSION_NAME=$2 ## install core -wget https://github.com/wikimedia/mediawiki/archive/${MW_BRANCH}.tar.gz -nv - -tar -zxf $MW_BRANCH.tar.gz -mv mediawiki-$MW_BRANCH mediawiki +# Clone rather than fetch the tarball: MW's .gitattributes marks +# phpunit.xml.template as `export-ignore`, so it's absent from the +# archive that GitHub serves. `composer phpunit:config` on MW master +# needs that file; `git clone` ships it. ~40MB extra in cached +# `.git/`, no measurable time difference. +git clone --depth 1 --branch "$MW_BRANCH" https://github.com/wikimedia/mediawiki.git mediawiki cd $MW_ROOT composer install