(tests) TestsuiteEntry::$id can't be null #1250
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 #1: PHPUnit testsuite (unit tests + integration tests) | |
phpunit: | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [8.1] | |
branch: [REL1_39, REL1_42, REL1_43] | |
dbtype: [mysql, postgres] | |
include: | |
- php: 8.3 | |
branch: REL1_43 | |
dbtype: mysql | |
- php: 8.1 | |
branch: REL1_43 | |
dbtype: sqlite | |
- php: 8.1 | |
branch: REL1_41 | |
dbtype: mysql | |
- php: 8.1 | |
branch: REL1_40 | |
dbtype: mysql | |
env: | |
branch: ${{ matrix.branch }} | |
DBTYPE: ${{ matrix.dbtype }} | |
runs-on: ubuntu-24.04 | |
services: | |
memcached: | |
image: memcached:latest | |
ports: | |
- 11211:11211 | |
options: --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/11211'" --health-interval 10s --health-timeout 5s --health-retries 5 | |
mariadb: | |
image: mariadb:11.4 | |
env: | |
MYSQL_ROOT_PASSWORD: ${{ env.DBPASS }} | |
ports: | |
- 3306:3306 | |
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3 | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: root | |
POSTGRES_PASSWORD: ${{ env.DBPASS }} | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
buildcache | |
key: buildcache-${{ env.branch }}-${{ hashFiles('**/no/files/need/to/invalidate/cache/for/now') }} | |
- uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: mbstring, intl, opcache, mysqli | |
tools: composer | |
ini-values: zend.enable_gc=Off, opcache.enable_cli=1, opcache.file_cache="/dev/shm", opcache.file_cache_only=1, opcache.file_cache_consistency_checks=0, opcache.validate_timestamps=0 | |
- name: (debug) Print "php -i" | |
run: php -i | |
- uses: edwardspec/github-action-build-mediawiki@v1 | |
with: | |
branch: ${{ env.branch }} | |
extraLocalSettings: tests/travis/ModerationSettings.php | |
extensions: "AbuseFilter CheckUser Echo MobileFrontend PageForms VisualEditor" | |
skins: "MinervaNeue" | |
dbtype: ${{ env.DBTYPE }} | |
dbname: ${{ env.DBNAME }} | |
dbpass: ${{ env.DBPASS }} | |
dbserver: ${{ env.DBTYPE == 'mysql' && '127.0.0.1:3306' || '127.0.0.1' }} | |
- name: Finalize the installation of MediaWiki | |
run: | | |
cp -fv tests/travis/my.cnf ~/.my.cnf | |
cp -fv tests/travis/pgpass.conf ~/.pgpass | |
chmod 0600 ~/.my.cnf ~/.pgpass | |
rsync -a --exclude buildcache --exclude mediawiki --exclude .git . mediawiki/extensions/Moderation/ | |
cd mediawiki && echo 'DELETE FROM recentchanges;' | php maintenance/sql.php | |
( cd extensions/AbuseFilter && composer update --no-dev ) | |
WITH_ECHO=1 php maintenance/update.php --quick | |
php maintenance/createAndPromote.php "$MEDIAWIKI_USER" "$MEDIAWIKI_PASSWORD" --custom-groups moderator,automoderated | |
( cd extensions/Moderation && composer install ${{ matrix.php == '8.0' && '--ignore-platform-reqs' || '' }} ) | |
echo '{{CURRENTVERSION}}' | php maintenance/parse.php | |
( cd extensions/Moderation/tests/phpunit/consequence && ln -sv ../unit/*Test.php . ) | |
# Start by running non-blackbox unit tests that can use temporary DB tables. | |
# These tests are much faster than the integration testsuite. | |
- name: Run non-blackbox unit tests (very fast) | |
run: cd mediawiki && php tests/phpunit/phpunit.php extensions/Moderation/tests/phpunit/consequence/ | |
# Run all tests. | |
- name: Run integration tests (blackbox) | |
run: cd mediawiki && PHPUNIT_USE_NORMAL_TABLES=1 php tests/phpunit/phpunit.php extensions/Moderation/tests/phpunit/blackbox | |
- name: Run integration tests (decoupled) | |
run: cd mediawiki && PHPUNIT_USE_NORMAL_TABLES=1 php tests/phpunit/phpunit.php extensions/Moderation/tests/phpunit/decoupled | |
# 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 #3: Phan (PHP static analyzer) | |
phan: | |
runs-on: ubuntu-24.04 | |
env: | |
branch: REL1_43 | |
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 | |
- name: RUN -- phan | |
run: cd mediawiki/extensions/Moderation && ./vendor/bin/phan --analyze-twice | |
# Job #4: Phan (PHP static analyzer) with PHAN_CHECK_TESTSUITE=1 | |
phan-testsuite: | |
if: ${{ github.ref == 'refs/heads/phpunit' }} | |
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 |