Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 72 additions & 58 deletions .github/workflows/mediawiki-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,73 +13,87 @@ jobs:
strategy:
matrix:
include:
# Latest MediaWiki LTS - PHP 8.1 (phan)
- mw: 'REL1_43'
php: 8.1
php-docker: 81
# Legacy MediaWiki stable - PHP 8.2 (phan)
- mw: 'REL1_44'
php: 8.2
php-docker: 82
experimental: false
stage: phan

# Latest stable MediaWiki - PHP 8.1 (phan)
- mw: 'REL1_44'
php: 8.1
php-docker: 81
# Latest MediaWiki stable - PHP 8.2 (phan)
- mw: 'REL1_45'
php: 8.2
php-docker: 82
experimental: true
stage: phan

# Latest MediaWiki master - PHP 8.1 (phan)
# Latest MediaWiki stable - PHP 8.4 (phan)
- mw: 'REL1_45'
php: 8.4
php-docker: 84
experimental: true
stage: phan

# Latest MediaWiki master - PHP 8.2 (phan)
- mw: 'master'
php: 8.1
php-docker: 81
php: 8.2
php-docker: 82
experimental: true
stage: phan

# Latest MediaWiki master - PHP 8.1 (coverage)
# Latest MediaWiki master - PHP 8.4 (phan)
- mw: 'master'
php: 8.1
php-docker: 81
experimental: false
stage: coverage
php: 8.4
php-docker: 84
experimental: true
stage: phan

# Latest MediaWiki LTS - PHP 8.1 (phpunit)
- mw: 'REL1_43'
php: 8.1
php-docker: 81
experimental: false
stage: phpunit
# Latest MediaWiki master - PHP 8.2 (coverage)
- mw: 'master'
php: 8.2
php-docker: 82
experimental: true
stage: coverage

# Latest stable MediaWiki - PHP 8.1 (phpunit)
# Legacy MediaWiki stable - PHP 8.2 (phpunit)
- mw: 'REL1_44'
php: 8.1
php-docker: 81
php: 8.2
php-docker: 82
experimental: false
stage: phpunit

# Latest MediaWiki master - PHP 8.1 (phpunit)
- mw: 'master'
php: 8.1
php-docker: 81
experimental: true
# Latest MediaWiki stable - PHP 8.2 (phpunit)
- mw: 'REL1_45'
php: 8.2
php-docker: 82
experimental: false
stage: phpunit

# Latest MediaWiki stable - PHP 8.4 (phpunit)
- mw: 'REL1_45'
php: 8.4
php-docker: 84
experimental: false
stage: phpunit

# Latest MediaWiki master - PHP 8.1 (selenium)
# Latest MediaWiki master - PHP 8.2 (phpunit)
- mw: 'master'
php: 8.1
php-docker: 81
php: 8.2
php-docker: 82
experimental: true
stage: selenium
stage: phpunit

# Latest MediaWiki master - PHP 8.1 (qunit)
# Latest MediaWiki master - PHP 8.4 (phpunit)
- mw: 'master'
php: 8.1
php-docker: 81
php: 8.4
php-docker: 84
experimental: true
stage: qunit
stage: phpunit

# Latest stable MediaWiki - PHP 8.1 (composer-test)
- mw: 'REL1_43'
php: 8.1
php-docker: 81
# Latest MediaWiki stable - PHP 8.2 (composer-test)
- mw: 'REL1_45'
php: 8.2
php-docker: 82
experimental: false
stage: composer-test

Expand All @@ -89,17 +103,15 @@ jobs:
DOCKER_REGISTRY: docker-registry.wikimedia.org
DOCKER_ORG: releng
QUIBBLE_DOCKER_IMAGE: quibble-bullseye-php${{ matrix.php-docker }}
COVERAGE_DOCKER_IMAGE: quibble-bullseye-php${{ matrix.php-docker }}-coverage
PHAN_DOCKER_IMAGE: mediawiki-phan-php${{ matrix.php-docker }}
MEDIAWIKI_VERSION: ${{ matrix.mw }}

steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
uses: styfle/cancel-workflow-action@0.13.0
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v5
- uses: actions/checkout@v6

# /home/runner/cache/ Cache
# /home/runner/src/ Mediawiki installation
Expand All @@ -109,13 +121,7 @@ jobs:
# $GITHUB_WORKSPACE/.github/workflows/globals.php Add global configuration options for MediaWiki
- name: Set up
run: |
if [ "${{ matrix.stage }}" == 'phan' ]; then
export DOCKER_IMAGE="${PHAN_DOCKER_IMAGE}"
elif [ "${{ matrix.stage }}" == coverage ]; then
export DOCKER_IMAGE="${COVERAGE_DOCKER_IMAGE}"
else
export DOCKER_IMAGE="${QUIBBLE_DOCKER_IMAGE}"
fi
export DOCKER_IMAGE="${QUIBBLE_DOCKER_IMAGE}"
echo "DOCKER_IMAGE=${DOCKER_IMAGE}" >> $GITHUB_ENV

# Get the latest docker tag (Ref: https://github.com/thcipriani/dockerregistry)
Expand All @@ -142,7 +148,7 @@ jobs:
fi

- name: Cache docker image
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: /home/runner/docker-images/${{ env.DOCKER_IMAGE }}
key: ${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_LATEST_TAG }}
Expand All @@ -154,7 +160,7 @@ jobs:

- name: Cache quibble docker image
if: ${{ matrix.stage == 'coverage' || matrix.stage == 'phan' }}
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: /home/runner/docker-images/${{ env.QUIBBLE_DOCKER_IMAGE }}
key: ${{ env.QUIBBLE_DOCKER_IMAGE }}:${{ env.QUIBBLE_DOCKER_LATEST_TAG }}
Expand Down Expand Up @@ -190,7 +196,7 @@ jobs:
git -C src/ log -n 1 --format="%H"

- name: Cache dependencies (composer and npm)
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: /home/runner/cache
key: ${{ runner.os }}-${{ env.MEDIAWIKI_VERSION }}-${{ hashFiles('**/*.json') }}
Expand Down Expand Up @@ -259,6 +265,7 @@ jobs:

if [ "${{ matrix.stage }}" == 'phan' ]; then
docker run \
--entrypoint /run-phan.sh \
-e THING_SUBNAME=extensions/"${{ github.event.repository.name }}" \
-v "$(pwd)"/src:/mediawiki \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}" \
Expand All @@ -272,8 +279,15 @@ jobs:
-v "$(pwd)"/cover:/workspace/cover \
"${DOCKER_REGISTRY}/${DOCKER_ORG}/${DOCKER_IMAGE}:${DOCKER_LATEST_TAG}" \
--skip-zuul \
--skip-deps \
-c mwext-phpunit-coverage
--packages-source composer \
-c "/bin/bash -c 'curl -sL https://raw.githubusercontent.com/wikimedia/integration-config/refs/heads/master/dockerfiles/quibble-bullseye-php81-coverage/mwext-phpunit-coverage.sh -o mwext-phpunit-coverage && \
curl -sL https://raw.githubusercontent.com/wikimedia/integration-config/refs/heads/master/dockerfiles/quibble-bullseye-php81-coverage/phpunit-suite-edit.py -o phpunit-suite-edit && \
curl -sL https://raw.githubusercontent.com/wikimedia/integration-config/refs/heads/master/dockerfiles/quibble-bullseye-php81-coverage/phpunit-junit-edit.py -o phpunit-junit-edit && \
rm -rf /workspace/src/extensions/*/vendor/squizlabs/php_codesniffer /workspace/src/extensions/*/vendor/composer/pcre && \
chmod +x mwext-phpunit-coverage phpunit-suite-edit phpunit-junit-edit && \
sed -i \"s|phpunit-suite-edit|./phpunit-suite-edit|g\" mwext-phpunit-coverage && \
sed -i \"s|phpunit-junit-edit|./phpunit-junit-edit|g\" mwext-phpunit-coverage && \
./mwext-phpunit-coverage'"
elif [ "${{ matrix.stage }}" != 'coverage' ]; then
docker run \
--entrypoint quibble-with-supervisord \
Expand Down
2 changes: 1 addition & 1 deletion includes/Services/Parser/Nodes/NodeMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function getTabberData( $html ) {
$libXmlErrorSetting = libxml_use_internal_errors( true );

// encode for correct load
$doc->loadHTML( mb_convert_encoding( $html, 'HTML-ENTITIES', 'UTF-8' ) );
$doc->loadHTML( '<?xml encoding="UTF-8">' . $html );

libxml_clear_errors();
libxml_use_internal_errors( $libXmlErrorSetting );
Expand Down
12 changes: 7 additions & 5 deletions tests/phpunit/Services/PortableInfoboxDataServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ public function testGetInfoboxes() {
// phpcs:ignore Generic.Files.OneObjectStructurePerFile.MultipleFound
class ParsingHelperDummy {

public function __construct( $infoboxesData = null, $includeonlyInfoboxesData = null ) {
$this->infoboxesData = $infoboxesData;
$this->includeonlyInfoboxesData = $includeonlyInfoboxesData;
public function __construct(
private readonly ?array $infoboxesData = null,
private readonly ?array $includeonlyInfoboxesData = null,
) {
}

public function parseIncludeonlyInfoboxes( $title ) {
Expand All @@ -277,8 +278,9 @@ public function getMarkup( Title $title ) {
// phpcs:ignore Generic.Files.OneObjectStructurePerFile.MultipleFound
class PagePropsProxyDummy {

public function __construct( $data = [] ) {
$this->data = $data;
public function __construct(
private array $data = [],
) {
}

public function get( $id, $property ) {
Expand Down
Loading