SemanticScribunto icon indicating copy to clipboard operation
SemanticScribunto copied to clipboard

Modernise CI

Open paladox opened this issue 10 months ago • 17 comments

  • Adds CI for MW 1.43
  • Uses gesinn-it-pub/docker-compose-ci for CI
  • Runs linting, phpcs and more
  • Fixes some phpcs errors - although not all.

Fixes #103

paladox avatar Jan 05 '25 17:01 paladox

@gesinn-it-gea / @gesinn-it-ilm requires https://github.com/gesinn-it-pub/docker-compose-ci/pull/9 to be merged.

paladox avatar Jan 05 '25 17:01 paladox

Hmm even with that it is still throwing "Fatal error: Uncaught ExtensionDependencyError: SemanticScribunto requires Scribunto to be installed."

paladox avatar Jan 05 '25 17:01 paladox

Oh I missed a few places in https://github.com/gesinn-it-pub/docker-compose-ci/pull/9. Although I think it has to be published for things to take affect? idk.

paladox avatar Jan 05 '25 17:01 paladox

Have no idea how to fix:

[e716f232d4cd70a1ff19f141] [no req]   MediaWiki\Extension\Scribunto\ScribuntoException: Lua error: Internal error: The interpreter has terminated with signal "5".
Backtrace:
from /var/www/html/extensions/Scribunto/includes/ScribuntoEngineBase.php(147)
#0 /var/www/html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(675): MediaWiki\Extension\Scribunto\ScribuntoEngineBase->newException(string, array)
#1 /var/www/html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(485): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->handleIOError()
#2 /var/www/html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(440): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->receiveMessage()
#3 /var/www/html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php(326): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->dispatch(array)
#4 /var/www/html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(187): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneInterpreter->registerLibrary(string, array)
#5 /var/www/html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(156): Scribunto_LuaEngine->registerInterface(string, array)
#6 /var/www/html/extensions/Scribunto/includes/engines/LuaStandalone/LuaStandaloneEngine.php(23): Scribunto_LuaEngine->load()
#7 /var/www/html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(235): MediaWiki\Extension\Scribunto\Engines\LuaStandalone\LuaStandaloneEngine->load()
#8 /var/www/html/extensions/Scribunto/tests/phpunit/engines/LuaCommon/LuaEngineTestHelper.php(69): Scribunto_LuaEngine->getInterpreter()
#9 /var/www/html/extensions/Scribunto/tests/phpunit/engines/LuaCommon/LuaEngineTestBase.php(72): Scribunto_LuaEngineTestBase::makeSuite(string)
#10 [internal function]: Scribunto_LuaEngineTestBase::suite(string)
#11 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(462): ReflectionMethod->invoke(NULL, string)
#12 /var/www/html/vendor/phpunit/phpunit/src/Framework/TestSuite.php(481): PHPUnit\Framework\TestSuite->addTestFile(string)
#13 /var/www/html/vendor/phpunit/phpunit/src/Util/Configuration.php(1034): PHPUnit\Framework\TestSuite->addTestFiles(array)
#14 /var/www/html/vendor/phpunit/phpunit/src/Util/Configuration.php(910): PHPUnit\Util\Configuration->getTestSuite(DOMElement, array)
#15 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(973): PHPUnit\Util\Configuration->getTestSuiteConfiguration(string)
#16 /var/www/html/vendor/phpunit/phpunit/src/TextUI/Command.php(203): PHPUnit\TextUI\Command->handleArguments(array)
#17 /var/www/html/tests/phpunit/phpunit.php(101): PHPUnit\TextUI\Command->run(array, boolean)
#18 /var/www/html/tests/phpunit/phpunit.php(153): PHPUnitMaintClass->execute()
#19 {main}

paladox avatar Jan 05 '25 18:01 paladox

@gesinn-it-ilm @gesinn-it-gea not sure how to resolve ^? Unless it doesn't work on my Mac in docker. (I have a M1 Mac).

The error in GitHub ci is because the https://github.com/gesinn-it-pub/docker-compose-ci/pull/9 needs merging. For some reason it doesn't use the current build checkout.

paladox avatar Jan 05 '25 18:01 paladox

MediaWiki has been successfully installed. You can now visit <http://localhost:8080> to view your wiki. If you have questions, check out our frequently asked questions list: <https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ> or use one of the support forums linked on that page.
Fatal error: Uncaught ExtensionDependencyError: SemanticScribunto requires Scribunto to be installed.
 in /var/www/html/includes/registration/ExtensionRegistry.php:432
Stack trace:
#0 /var/www/html/includes/registration/ExtensionRegistry.php(276): ExtensionRegistry->readFromQueue(Array)
#1 /var/www/html/includes/Setup.php(278): ExtensionRegistry->loadFromQueue()
#2 /var/www/html/maintenance/doMaintenance.php(83): require_once('/var/www/html/i...')
#3 /var/www/html/maintenance/update.php(319): require_once('/var/www/html/m...')
#4 {main}
  thrown in /var/www/html/includes/registration/ExtensionRegistry.php on line 432
make: *** [build/Makefile:100: .install] Error 255

is still happening. I dunno if there's suppose to be a deployment of that change (CI?)

paladox avatar Jan 07 '25 20:01 paladox

For another repo I implemented a workflow to schedule automatic updates of docker-compose-ci: https://github.com/gesinn-it-pub/IDProvider/blob/master/.github/workflows/update-submodules.yml

If you like this approach, you can add it to other repos as well. Instead of running this only on one day, we can run it daily

gesinn-it-gea avatar Jan 08 '25 11:01 gesinn-it-gea

I'm not using SemanticScribuntu. Maybe the way it is installed by docker-compose-ci needs to be changed (e.g. using composer to get the deps). Or make the deps being installable via docker-compose-ci

gesinn-it-gea avatar Jan 08 '25 11:01 gesinn-it-gea

I'm not using SemanticScribuntu. Maybe the way it is installed by docker-compose-ci needs to be changed (e.g. using composer to get the deps). Or make the deps being installable via docker-compose-ci

I’m not sure. It works locally hence the error about lua returning that status number.

paladox avatar Jan 08 '25 11:01 paladox

I see that REL1_39 isn’t being supplied to where it fetches Scribunto which would be a problem.

paladox avatar Jan 08 '25 11:01 paladox

For some reason phpunit is now in an infinite loop. I don't know why.

paladox avatar Jan 08 '25 12:01 paladox

@gesinn-it-ilm dunno how we fix:

1) SMW\Scribunto\Integration\JSONScript\SemanticScribuntoJsonTestCaseScriptRunnerTest::testCaseFile with data set "ask-001.json" ('/var/www/html/extensions/Sema...1.json')
RuntimeException: Can't create user on real database
/var/www/html/tests/phpunit/includes/TestUser.php:35
/var/www/html/tests/phpunit/includes/TestUser.php:42
/var/www/html/tests/phpunit/includes/TestUserRegistry.php:82
/var/www/html/tests/phpunit/MediaWikiIntegrationTestCase.php:276
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/SMWIntegrationTestCase.php:84
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptTestCaseRunner.php:67
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/JSONScriptServicesTestCaseRunner.php:63
/var/www/html/extensions/SemanticScribunto/tests/phpunit/Integration/JSONScript/SemanticScribuntoJsonTestCaseScriptRunnerTest.php:33
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/SMWIntegrationTestCase.php:203

Seems related to your change switching to MW integration class.

Also dunno how we fix:

7) SMW\Scribunto\Integration\JSONScript\SemanticScribuntoJsonTestCaseScriptRunnerTest::testCaseFile with data set "info-001.json" ('/var/www/html/extensions/Sema...1.json')
RuntimeException: Tracking is already enabled
/var/www/html/includes/libs/rdbms/ChangedTablesTracker.php:29
/var/www/html/tests/phpunit/MediaWikiIntegrationTestCase.php:694
/var/www/html/tests/phpunit/MediaWikiIntegrationTestCase.php:624
/var/www/html/extensions/SemanticMediaWiki/tests/phpunit/SMWIntegrationTestCase.php:203

paladox avatar Jan 08 '25 14:01 paladox

@gesinn-it-gea / @gesinn-it-ilm looks like https://github.com/wikimedia/mediawiki/blob/17e259ef2475f56635cf3c4651c81606f8be62bb/tests/phpunit/includes/TestUser.php#L35

So wgDBprefix isn't unittest_. I don't know how to fix that. Looks like SMW needs its test fixing which is out of my experience (I would have no clue how to do it). There's https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/tests/phpunit/Utils/Connection/TestDatabaseTableBuilder.php#L71 and https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/tests/phpunit/Utils/Connection/TestDatabaseTableBuilder.php#L237

paladox avatar Jan 08 '25 15:01 paladox

https://github.com/SemanticMediaWiki/SemanticMediaWiki/commit/3f6d15433efc2de8f3c365cafc7be9621f3ce9e9#diff-04a0eaaa6a686fdb4e98911c7ce0f7f294f06950dcb3839cabaac007ba86f3ccL29

Looks like we re-added it under the new name cc @gesinn-it-gea / @gesinn-it-ilm . I guess things need to be fixed to conform to MW Integration test class?

paladox avatar Jan 08 '25 15:01 paladox

Maybe the whole JSONScript runner need to be updated. Compare with other places where we use it, e.g. https://github.com/SemanticMediaWiki/SemanticDrilldown/blob/master/tests/phpunit/Integration/JSONScript/JsonTestCaseScriptRunnerTest.php or https://github.com/SemanticMediaWiki/SemanticResultFormats/tree/master/tests/phpunit/Integration/JSONScript

gesinn-it-gea avatar Jan 08 '25 15:01 gesinn-it-gea

@gesinn-it-gea do you mean changing to JSONScriptTestCaseRunnerTest? Not too sure that will help much here. We can try it.

paladox avatar Jan 08 '25 16:01 paladox

Doesn't fix the problem. MW 1.39 it's just a infinite recursion and in mw 1.42 it at least show the errors (the same one).

paladox avatar Jan 08 '25 16:01 paladox