Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 140 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,30 @@ on:
jobs:
test:
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}

strategy:
fail-fast: false
matrix:
include:
- mw: 'REL1_43'
php: 8.3
- mw: 'REL1_42'
php: 8.2
- mw: 'REL1_41'
php: 8.1
- mw: 'REL1_40'
php: 8.0
- mw: 'REL1_39'
php: 8.0
composer: v2
- mw: 'REL1_38'
php: 8.0
composer: v2
- mw: 'REL1_37'
php: 8.0
composer: v2
- mw: 'REL1_36'
php: 7.4
composer: v1
- mw: 'REL1_35'
php: 7.3
composer: v1
- mw: 'REL1_34'
php: 7.2
composer: v1
experimental: false
- mw: 'REL1_40'
php: 8.1
experimental: false
- mw: 'REL1_41'
php: 8.2
experimental: false
- mw: 'REL1_42'
php: 8.2
experimental: false
- mw: 'REL1_43'
php: 8.3
experimental: false
- mw: 'master'
php: 8.4
experimental: true

runs-on: ubuntu-latest

Expand All @@ -56,25 +50,25 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl
tools: composer:${{ matrix.composer }}
tools: composer:v2

- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}-v21
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v1

- name: Cache Composer cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: EarlyCopy

Expand All @@ -83,7 +77,7 @@ jobs:
working-directory: ~
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} WikibaseLocalMedia

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: mediawiki/extensions/WikibaseLocalMedia

Expand All @@ -92,3 +86,119 @@ jobs:

- name: Run PHPUnit
run: php tests/phpunit/phpunit.php extensions/WikibaseLocalMedia/tests/

PHPStan:
name: "PHPStan: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_43'
php: '8.3'

runs-on: ubuntu-latest

defaults:
run:
working-directory: mediawiki

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring
tools: composer, cs2pr

- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v4
with:
path: |
mediawiki
mediawiki/extensions/
mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v1

- name: Cache Composer cache
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: composer_static_analysis

- 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/installMediaWiki.sh ${{ matrix.mw }} WikibaseLocalMedia

- uses: actions/checkout@v4
with:
path: mediawiki/extensions/WikibaseLocalMedia

- name: Composer allow-plugins
run: composer config --no-plugins allow-plugins.composer/installers true

- run: composer update

- name: Composer install
run: cd extensions/WikibaseLocalMedia && composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- name: PHPStan
run: cd extensions/WikibaseLocalMedia && php vendor/bin/phpstan analyse --error-format=checkstyle --no-progress | cs2pr

phpcs:
name: "Code style: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"

strategy:
matrix:
include:
- mw: 'REL1_43'
php: '8.3'

runs-on: ubuntu-latest

defaults:
run:
working-directory: mediawiki/extensions/WikibaseLocalMedia

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, php-ast
tools: composer

- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v4
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_static_analysis

- name: Cache Composer cache
uses: actions/cache@v4
with:
path: ~/.composer/cache
key: mw_${{ matrix.mw }}-php${{ matrix.php }}_v1

- name: Install MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ~
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} WikibaseLocalMedia

- uses: actions/checkout@v4
with:
path: mediawiki/extensions/WikibaseLocalMedia

- name: Composer install
run: composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader

- run: vendor/bin/phpcs -p -s
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Commands run from inside the MediaWiki container ##########################################################

ci: test cs
test: phpunit
cs: phpcs stan

phpunit:
ifdef filter
php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --filter $(filter)
else
php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist
endif

perf:
php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --group Performance

phpcs:
vendor/bin/phpcs -p -s --standard=$(shell pwd)/phpcs.xml

stan:
vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=2G

stan-baseline:
vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=2G --generate-baseline



# Commands run from the host machine #######################################################################

npm-install:
docker run -it --rm -v "$(CURDIR)":/home/node/app -w /home/node/app -u node node:22 npm install

lint:
docker run -it --rm -v "$(CURDIR)":/home/node/app -w /home/node/app -u node node:22 npm run lint
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Also see [this animated gif](https://twitter.com/i/status/1286293710112731137).

## Platform requirements

* [PHP] 7.2 or later, including PHP 8.0
* [MediaWiki] 1.34 up to 1.39
* [Wikibase Repository] REL1_34, REL1_35, REL1_36, REL1_37, REL1_38, or REL1_39
* [PHP] 7.4 or later
* [MediaWiki] 1.39 or later
* [Wikibase Repository] REL1_39 or later

For more information on the different versions of this extension, see the [release notes](#release-notes).

Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@
"source": "https://github.com/ProfessionalWiki/WikibaseLocalMedia/issues"
},
"require": {
"php": ">=7.2",
"php": ">=7.4",
"composer/installers": "^2|^1.0.1"
},
"require-dev": {
"vimeo/psalm": "dev-master",
"phpstan/phpstan": "dev-master"
"phpstan/phpstan": "^2.1.6",
"mediawiki/mediawiki-codesniffer": "^46.0.0"
},
"config": {
"allow-plugins": {
"composer/installers": true
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
4 changes: 2 additions & 2 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Wikibase Local Media",
"type": "wikibase",

"version": "1.1.0",
"version": "2.0.0",

"author": [
"[https://www.EntropyWins.wtf/mediawiki Jeroen De Dauw]",
Expand All @@ -16,7 +16,7 @@
"license-name": "GPL-2.0-or-later",

"requires": {
"MediaWiki": ">= 1.34.0",
"MediaWiki": ">= 1.39.0",
"extensions": {
"WikibaseRepository": "*"
}
Expand Down
9 changes: 9 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset>
<file>src/</file>
<file>tests/php</file>

<arg name="extensions" value="php"/>

<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
</ruleset>
Loading