forked from SemanticMediaWiki/SemanticMediaWiki
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (120 loc) · 5.87 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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