(tests) Fix Phan warnings in benchmarks #1230
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run PHPUnit testsuite | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
PARALLEL_PHPUNIT_TESTS: 4 | |
DBNAME: testwiki | |
DBPASS: "123456" | |
MEDIAWIKI_USER: "Moderator User" | |
MEDIAWIKI_PASSWORD: "123456" | |
jobs: | |
# Job #2: phpcs, parallel-lint, etc. | |
linter: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
tools: composer | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.composer/cache | |
key: buildcache-linter | |
- name: Install dependencies | |
run: composer install && npm install | |
- run: composer test | |
- run: npm test | |
# Job #4: Phan (PHP static analyzer) with PHAN_CHECK_TESTSUITE=1 | |
phan-testsuite: | |
if: ${{ github.ref == 'refs/heads/phan' }} | |
runs-on: ubuntu-24.04 | |
env: | |
branch: REL1_43 | |
PHAN_CHECK_TESTSUITE: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
extensions: ast | |
tools: composer | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.composer/cache | |
buildcache | |
key: buildcache-phan | |
- uses: edwardspec/github-action-build-mediawiki@v1 | |
with: | |
branch: ${{ env.branch }} | |
noinstall: 1 | |
extensions: "AbuseFilter CheckUser Echo MobileFrontend PageForms VisualEditor" | |
skins: "MinervaNeue" | |
- name: Install dependencies | |
run: | | |
rsync -a --exclude buildcache --exclude mediawiki --exclude .git . mediawiki/extensions/Moderation/ | |
cd mediawiki/extensions/Moderation | |
composer install | |
# Workaround incorrect annotation of with() method in PHPUnit 9 (used in MediaWiki 1.43) | |
# to avoid over 100 false positive Phan warnings. | |
sed -i '/@param mixed\[\] \$arguments/d' ../../vendor/phpunit/phpunit/src/Framework/MockObject/Builder/InvocationMocker.php | |
- name: RUN -- phan | |
run: cd mediawiki/extensions/Moderation && ./vendor/bin/phan --analyze-twice |