The action is a composite action that uses the following actions to install an ephemeral MediaWiki instance with Composer and PHP on board and run PHPUnit tests for your extension or skin repo:
- uses: wikiteq/mediawiki-phpunit-action@v2
with:
php: 7.4
mwbranch: REL1_35
extension: DummyExtension
php
- version of PHP to installmwbranch
- MediaWiki branch to installextension
- extension name to test (this should match the desired extension directory)type
- (optional) either can beextension
orskin
, default value isextension
use_mysql
- (optional) whether to use MySQL instead of SQLite
The below is an example of how to setup your GitHub Actions workflow on extension repository:
.github/workflows/main.yml
name: Example
on:
push:
branches: [ master ]
pull_request:
branches: [ "*" ]
jobs:
test:
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
strategy:
matrix:
include:
- mw: 'REL1_35'
php: 7.4
- mw: 'REL1_36'
php: 7.4
- mw: 'REL1_37'
php: 7.4
- mw: 'master'
php: 7.4
runs-on: ubuntu-latest
steps:
# check out the extension repository
- name: Checkout
uses: actions/checkout@v3
# run the action to install MediaWiki, PHP, Composer
# and run PHPUnit tests for the extension
- name: Mediawiki PHPUnit
uses: wikiteq/mediawiki-phpunit-action@v2
with:
php: ${{ matrix.php }}
mwbranch: ${{ matrix.mw }}
extension: MyExtension
Example of adding a group to your extension tests:
MyExtension/tests/phpunit/MyExtensionTest.php
/**
* @group extension-MyExtension
*/
class MyExtensionTest extends MediaWikiIntegrationTestCase {
// ...
}