Merge branch 'SemanticMediaWiki:master' into master #4
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: build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
matrix: | |
include: | |
- mediawiki_version: 1.35 | |
database_type: mysql | |
experimental: false | |
- mediawiki_version: 1.36 | |
database_type: mysql | |
experimental: true | |
- mediawiki_version: 1.37 | |
database_type: mysql | |
experimental: true | |
- mediawiki_version: 1.38 | |
database_type: mysql | |
experimental: true | |
- mediawiki_version: 1.39 | |
database_type: mysql | |
experimental: true | |
container: | |
image: mediawiki:${{ matrix.mediawiki_version }} | |
options: --link some-${{ matrix.database_type }}:${{ matrix.database_type }} | |
env: | |
EXT_NAME: SemanticMediaWiki | |
COMPOSER_VERSION: 2.1.14 | |
MW_INSTALL_PATH: /var/www/html | |
MW_EXT_PATH: /var/www/html/extensions | |
DB_ROOT_USER: root | |
DB_ROOT_PWD: database | |
MW_DB_TYPE: ${{ matrix.database_type }} | |
MW_DB_SERVER: ${{ matrix.database_type }} | |
MW_DB_PATH: /var/www/data | |
MW_DB_USER: wiki | |
MW_DB_PWD: wiki | |
MW_DB_NAME: wiki | |
services: | |
some-mysql: | |
image: mariadb:latest | |
env: | |
MARIADB_ROOT_PASSWORD: ${{ env.DB_ROOT_PWD }} | |
steps: | |
# https://getcomposer.org/download/ | |
- name: Get Composer | |
run: | | |
apt update | |
apt install -y unzip | |
php -r "copy('https://getcomposer.org/installer', 'installer');" | |
php -r "copy('https://composer.github.io/installer.sig', 'expected');" | |
echo `cat expected` " installer" | sha384sum -c - | |
php installer --version=${{ env.COMPOSER_VERSION }} | |
rm -f installer expected | |
mv composer.phar /usr/local/bin/composer | |
- name: Checkout Extension | |
uses: actions/checkout@v3 | |
with: | |
path: ${{ env.EXT_NAME }} | |
# Setting actions/checkout@v3 path to env.MW_EXT_PATH fails with "Repository path '/var/www/html/extensions' is not under ..." | |
# See also open PR https://github.com/actions/checkout/pull/388 | |
- name: Move Extension | |
run: | | |
mkdir -p ${{ env.MW_EXT_PATH }} | |
mv ${{ env.EXT_NAME }} ${{ env.MW_EXT_PATH }} | |
- name: MediaWiki Composer Update | |
run: | | |
COMPOSER=composer.local.json composer require --no-update --working-dir ${{ env.MW_INSTALL_PATH }} mediawiki/semantic-media-wiki @dev | |
COMPOSER=composer.local.json composer config repositories.semantic-media-wiki '{"type": "path", "url": "extensions/SemanticMediaWiki"}' --working-dir ${{ env.MW_INSTALL_PATH }} | |
composer update --working-dir ${{ env.MW_INSTALL_PATH }} | |
# Issue #5199 | |
# The following patch disable the cache (size = 0) and disable the "set"/"setField"/"add" functions in MapCacheLRU and ActorCache when the size of the cache is 0, to make the cache ineffective | |
# Other said, it virtually disables MediaWiki commit fd71596f97e / Phabricator task T273974 and its follow-ups | |
- name: Patch MediaWiki for issue 5199 (disable ActorStore cache) | |
run: | | |
sed -i 's/const LOCAL_CACHE_SIZE = 5;/const LOCAL_CACHE_SIZE = 0;/' ${{ env.MW_INSTALL_PATH }}/includes/user/ActorStore.php || true | |
sed -i 's/const LOCAL_CACHE_SIZE = 100;/const LOCAL_CACHE_SIZE = 0;/' ${{ env.MW_INSTALL_PATH }}/includes/user/ActorStore.php || true | |
sed -i 's/Assert::parameter( $maxKeys > 0/#\0/' ${{ env.MW_INSTALL_PATH }}/includes/libs/MapCacheLRU.php || true | |
sed -i 's/public function set( $key, $value, $rank = self::RANK_TOP ) {/\0\n\t\tif ( $this->maxCacheKeys === 0 ) {\n\t\t\treturn;\n\t\t}/' ${{ env.MW_INSTALL_PATH }}/includes/libs/MapCacheLRU.php || true | |
sed -i 's/public function setField( $key, $field, $value, $initRank = self::RANK_TOP ) {/\0\n\t\tif ( $this->maxCacheKeys === 0 ) {\n\t\t\treturn;\n\t\t}/' ${{ env.MW_INSTALL_PATH }}/includes/libs/MapCacheLRU.php || true | |
sed -i 's/if ( $maxKeys <= 0 ) {/if ( $maxKeys < 0 ) {/' ${{ env.MW_INSTALL_PATH }}/includes/libs/MapCacheLRU.php || true | |
sed -i 's/public function add( int $actorId, UserIdentity $actor ) {/\0\n\t\tif ( $this->maxSize === 0 ) {\n\t\t\treturn;\n\t\t}/' ${{ env.MW_INSTALL_PATH }}/includes/user/ActorCache.php || true | |
- name: MediaWiki Install | |
run: > | |
php ${{ env.MW_INSTALL_PATH }}/maintenance/install.php | |
--pass=Password123456 | |
--server="http://localhost:8000" | |
--scriptpath="" | |
--dbtype=${{ env.MW_DB_TYPE }} | |
--dbserver=${{ env.MW_DB_SERVER }} | |
--installdbuser=${{ env.DB_ROOT_USER }} | |
--installdbpass=${{ env.DB_ROOT_PWD }} | |
--dbname=${{ env.MW_DB_NAME }} | |
--dbuser=${{ env.MW_DB_USER }} | |
--dbpass=${{ env.MW_DB_PWD }} | |
--dbpath=${{ env.MW_DB_PATH }} | |
--extensions=SemanticMediaWiki | |
${{ env.EXT_NAME }}-test WikiSysop | |
- name: Enable Debug Output | |
run: | | |
echo 'error_reporting(E_ALL| E_STRICT);' >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php | |
echo 'ini_set("display_errors", 1);' >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php | |
echo '$wgShowExceptionDetails = true;' >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php | |
echo '$wgDevelopmentWarnings = true;' >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php | |
- name: Install SemanticMediaWiki | |
run: | | |
echo "enableSemantics( 'localhost' );" >> ${{ env.MW_INSTALL_PATH }}/LocalSettings.php | |
tail -n5 ${{ env.MW_INSTALL_PATH }}/LocalSettings.php | |
php ${{ env.MW_INSTALL_PATH }}/maintenance/update.php --quick | |
- name: Run Tests | |
run: > | |
composer phpunit | |
--working-dir ${{ env.MW_INSTALL_PATH }}/extensions/SemanticMediaWiki |