Skip to content

REL1_43 REL1_44 compatibility #415

REL1_43 REL1_44 compatibility

REL1_43 REL1_44 compatibility #415

Workflow file for this run

name: CI
on:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test:
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
include:
- mw: 'REL1_43'
php: 8.3
experimental: false
- mw: 'REL1_44'
php: 8.4
experimental: false
- mw: 'master'
php: 8.4
experimental: true
runs-on: ubuntu-latest
defaults:
run:
working-directory: mediawiki
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, pdo_sqlite, php-ast
tools: composer
- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v4
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}-${{ runner.os }}
restore-keys: |
mw_${{ matrix.mw }}-php${{ matrix.php }}-
mw_${{ matrix.mw }}-
- name: Cache composer cache
id: cache-composer
uses: actions/cache@v4
with:
path: ~/.cache/composer
key: composer-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer-${{ matrix.php }}-
- name: Checkout (EarlyCopy)
uses: actions/checkout@v4
with:
path: EarlyCopy
- name: Install MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} ExternalContent
- name: Checkout extension into MediaWiki tree
uses: actions/checkout@v4
with:
path: mediawiki/extensions/ExternalContent
- name: Composer allow-plugins
run: composer config --no-plugins allow-plugins.composer/installers true
- name: Composer update (extension + deps)
run: composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: Run update.php
run: php maintenance/update.php --quick
- name: Run PHPUnit (junit)
continue-on-error: true
run: php tests/phpunit/phpunit.php -c extensions/ExternalContent/ --log-junit tests/junit.xml
- name: Upload PHPUnit JUnit result
uses: actions/upload-artifact@v4
with:
name: phpunit-junit-${{ matrix.mw }}-php${{ matrix.php }}
path: mediawiki/tests/junit.xml
- name: Run PHPUnit with code coverage (master only)
if: matrix.mw == 'master'
run: php tests/phpunit/phpunit.php -c extensions/ExternalContent/ --coverage-clover coverage.xml
- name: Upload code coverage (master only) securely
if: matrix.mw == 'master'
continue-on-error: true
uses: codecov/codecov-action@v4
with:
files: coverage.xml
- name: Upload coverage artifact (master only)
if: matrix.mw == 'master'
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.mw }}-php${{ matrix.php }}
path: coverage.xml
- name: Run parser tests (explicit targets)
if: matrix.mw == 'REL1_43' || matrix.mw == 'REL1_44' || matrix.mw == 'master'
run: |
if [[ "${{ matrix.mw }}" == "REL1_43" ]]; then
php tests/parser/parserTests.php --file=extensions/ExternalContent/tests/parser/parserTests-mw143.txt
else
php tests/parser/parserTests.php --file=extensions/ExternalContent/tests/parser/parserTests.txt
fi
static-analysis:
name: "Static Analysis: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
strategy:
matrix:
include:
- mw: 'REL1_43'
php: '8.3'
- mw: 'REL1_44'
php: '8.4'
runs-on: ubuntu-latest
defaults:
run:
working-directory: mediawiki/extensions/ExternalContent
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, pdo_sqlite, php-ast
tools: composer, cs2pr
- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v4
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
# Shared cache key across static-analysis and code-style jobs
# Safe to share because both jobs use the same MW core code
key: mw_static_analysis
restore-keys: |
mw_static_analysis
- name: Cache composer cache
uses: actions/cache@v4
with:
path: ~/.cache/composer
key: composer_shared-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer_shared-
- name: Checkout (EarlyCopy)
uses: actions/checkout@v4
with:
path: EarlyCopy
- name: Install MediaWiki (if needed)
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} ExternalContent
- name: Checkout extension into MediaWiki tree
uses: actions/checkout@v4
with:
path: mediawiki/extensions/ExternalContent
- name: Composer allow-plugins
run: composer config --no-plugins allow-plugins.composer/installers true
- name: Composer install
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: PHPStan
run: php vendor/bin/phpstan analyse --error-format=checkstyle --no-progress | cs2pr
- name: Psalm
# Skip Psalm on PHP 8.4 until we can upgrade psalm to 5.x
# MediaWiki core locks psalm to ^4.3
if: matrix.php != '8.4'
run: php vendor/bin/psalm --shepherd --stats
code-style:
name: "Code style: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
strategy:
matrix:
include:
- mw: 'REL1_43'
php: '8.3'
- mw: 'REL1_44'
php: '8.4'
runs-on: ubuntu-latest
defaults:
run:
working-directory: mediawiki/extensions/ExternalContent
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, pdo_sqlite, php-ast
tools: composer
- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v4
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
# Shared cache key across static-analysis and code-style jobs
# Safe to share because both jobs use the same MW core code
key: mw_static_analysis
restore-keys: |
mw_static_analysis
- name: Cache composer cache
uses: actions/cache@v4
with:
path: ~/.cache/composer
key: composer_shared-${{ hashFiles('**/composer.lock') }}
restore-keys: |
composer_shared-
- name: Checkout (EarlyCopy)
uses: actions/checkout@v4
with:
path: EarlyCopy
- name: Install MediaWiki (if needed)
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} ExternalContent
- name: Checkout extension into MediaWiki tree
uses: actions/checkout@v4
with:
path: mediawiki/extensions/ExternalContent
- name: Composer allow-plugins
run: composer config --no-plugins allow-plugins.composer/installers true
- name: Composer install
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: PHP CodeSniffer
run: vendor/bin/phpcs -p -s