forked from SemanticMediaWiki/SemanticScribunto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overhaul ci, refactor extension loading, raise minimum requirements
* switch unit tests from tavis to github * add new ci sets for mw > 1.39 * switch hook registration to default mw schema * switch to mw autoloader, abandoning composer autoloader * fix unit tests * raising minimum requirement to mw 1.39 and smw 4.1
- Loading branch information
Showing
27 changed files
with
508 additions
and
363 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "composer" | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "daily" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ "*" ] | ||
|
||
jobs: | ||
test: | ||
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }} (TYPE ${{ matrix.type }})" | ||
|
||
strategy: | ||
matrix: | ||
include: | ||
- mw: 'REL1_39' | ||
php: 8.0 | ||
type: coverage | ||
experimental: false | ||
- mw: 'REL1_39' | ||
php: 8.1 | ||
type: normal | ||
experimental: false | ||
- mw: 'REL1_40' | ||
php: 8.1 | ||
type: normal | ||
experimental: false | ||
- mw: 'REL1_41' | ||
php: 8.1 | ||
type: normal | ||
experimental: false | ||
- mw: 'REL1_42' | ||
php: 8.2 | ||
type: normal | ||
experimental: false | ||
- mw: 'master' | ||
php: 8.3 | ||
type: normal | ||
experimental: true | ||
|
||
runs-on: ubuntu-latest | ||
continue-on-error: ${{ matrix.experimental }} | ||
|
||
defaults: | ||
run: | ||
working-directory: mediawiki | ||
|
||
env: | ||
MW_ROOT: mediawiki | ||
TYPE: ${{ matrix.type }} | ||
|
||
|
||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: mbstring, intl | ||
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 }} | ||
|
||
- name: Cache Composer cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.composer/cache | ||
key: composer-php${{ matrix.php }} | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
path: EarlyCopy | ||
|
||
- name: Install MediaWiki | ||
if: steps.cache-mediawiki.outputs.cache-hit != 'true' | ||
working-directory: ~ | ||
run: bash EarlyCopy/.github/workflows/installWiki.sh ${{ matrix.mw }} SemanticScribunto | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
path: mediawiki/extensions/SemanticScribunto | ||
|
||
- name: Composer update | ||
run: composer update | ||
|
||
- name: run update.php | ||
run: php maintenance/update.php --quick | ||
|
||
- if: env.TYPE != 'coverage' | ||
name: Run PHPUnit w/o coverage | ||
run: php tests/phpunit/phpunit.php -c extensions/SemanticScribunto/ --testsuite semantic-scribunto-unit | ||
|
||
- if: env.TYPE == 'coverage' | ||
name: Run PHPUnit w/ coverage | ||
run: php tests/phpunit/phpunit.php -c extensions/SemanticScribunto/ --testsuite semantic-scribunto-unit --coverage-clover coverage.clover | ||
|
||
- if: env.TYPE == 'coverage' | ||
name: upload coverage report | ||
working-directory: ~ | ||
run: bash EarlyCopy/.github/workflows/uploadCoverageReport.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#! /bin/bash | ||
|
||
MW_BRANCH=$1 | ||
EXTENSION_NAME=$2 | ||
|
||
## install core | ||
wget https://github.com/wikimedia/mediawiki/archive/${MW_BRANCH}.tar.gz -nv | ||
|
||
tar -zxf $MW_BRANCH.tar.gz | ||
mv mediawiki-$MW_BRANCH mediawiki | ||
cd $MW_ROOT | ||
|
||
composer install | ||
php maintenance/install.php --dbtype sqlite --dbuser root --dbname mw --dbpath $(pwd) --pass AdminPassword WikiName AdminUser | ||
|
||
cat <<EOT >> composer.local.json | ||
{ | ||
"extra": { | ||
"merge-plugin": { | ||
"merge-dev": true, | ||
"include": [ | ||
"extensions/${EXTENSION_NAME}/composer.json" | ||
] | ||
} | ||
} | ||
} | ||
EOT | ||
|
||
## Vector | ||
cd skins | ||
# most mw dumps ship with empty skin directories | ||
[[ -e Vector ]] && rm -rf Vector | ||
git clone --branch ${MW_BRANCH} https://github.com/wikimedia/Vector.git | ||
|
||
|
||
## Scribunto | ||
cd ../extensions | ||
wget https://github.com/wikimedia/mediawiki-extensions-Scribunto/archive/${MW_BRANCH}.tar.gz | ||
tar -zxf ${MW_BRANCH}.tar.gz | ||
[[ -e Scribunto ]] && rm -rf Scribunto | ||
mv mediawiki-extensions-Scribunto* Scribunto | ||
cd .. | ||
|
||
|
||
## extend LocalSettings.php | ||
echo 'error_reporting(E_ALL| E_STRICT);' >> LocalSettings.php | ||
echo 'ini_set("display_errors", 1);' >> LocalSettings.php | ||
echo '$wgShowExceptionDetails = true;' >> LocalSettings.php | ||
echo '$wgShowDBErrorBacktrace = true;' >> LocalSettings.php | ||
echo '$wgDevelopmentWarnings = true;' >> LocalSettings.php | ||
|
||
echo '$wgArticlePath = $wgScriptPath . "/$1";' >> LocalSettings.php | ||
echo '$wgEnableUploads = true;' >> LocalSettings.php | ||
|
||
echo 'wfLoadSkin( "Vector" );' >> LocalSettings.php | ||
echo '$wgDefaultSkin = "vector-2022";' >> LocalSettings.php | ||
|
||
echo 'wfLoadExtension( "SemanticMediaWiki" );' >> LocalSettings.php | ||
echo 'wfLoadExtension( "Scribunto" );' >> LocalSettings.php | ||
echo 'enableSemantics( "reynolds.serenity.verse" );' >> LocalSettings.php | ||
|
||
## add loading of $EXTENSION_NAME | ||
echo 'wfLoadExtension( "'$EXTENSION_NAME'" );' >> LocalSettings.php |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /bin/bash | ||
|
||
COVERAGE_REPORT=${MW_ROOT}/coverage.clover | ||
|
||
if [[ ! -e ${COVERAGE_REPORT} ]]; then | ||
echo "File coverage.clover is missing. Abort the upload!" | ||
# this was exit 127; restore exit value when code coverage is again supported | ||
exit | ||
fi | ||
|
||
cd EarlyCopy | ||
|
||
wget https://scrutinizer-ci.com/ocular.phar | ||
php ocular.phar code-coverage:upload --format=php-clover ../${COVERAGE_REPORT} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /bin/bash | ||
|
||
cd $MW_ROOT | ||
|
||
## inject Resources | ||
php maintenance/importImages.php extensions/BootstrapComponents/tests/resources/ png | ||
php maintenance/rebuildall.php | ||
php maintenance/runJobs.php --quiet | ||
|
||
cd .. |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="tests/bootstrap.php" | ||
cacheTokens="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
verbose="true"> | ||
<testsuites> | ||
<testsuite name="semantic-scribunto-unit"> | ||
<directory>tests/phpunit/Unit</directory> | ||
</testsuite> | ||
<testsuite name="semantic-scribunto-integration"> | ||
<directory>tests/phpunit/Integration</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist addUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
<php> | ||
<var name="seqlgHttpResponseCacheType" value="hash"/> | ||
</php> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="tests/bootstrap.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnIncomplete="false" | ||
stopOnSkipped="false" | ||
verbose="true" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
> | ||
<coverage includeUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="semantic-scribunto-unit"> | ||
<directory>tests/phpunit/Unit</directory> | ||
</testsuite> | ||
<testsuite name="semantic-scribunto-integration"> | ||
<directory>tests/phpunit/Integration</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<var name="seqlgHttpResponseCacheType" value="hash"/> | ||
</php> | ||
</phpunit> |
Oops, something went wrong.