PortableInfobox/.github/workflows/phpunit-tests.yml
2021-09-11 20:50:54 -06:00

118 lines
3.2 KiB
YAML

name: PHPUnit tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: "MediaWiki ${{ matrix.mw }} | PHP ${{ matrix.php }} | MySQL ${{ matrix.mysql }}"
continue-on-error: true
strategy:
matrix:
include:
# Latest stable MW - PHP 7.3
- mw: 'REL1_36'
php: 7.3
composer: v2
mysql: '5.7'
continue-on-error: false
# Latest stable MW - PHP 7.4
- mw: 'REL1_36'
php: 7.4
composer: v2
mysql: '5.7'
continue-on-error: false
# Latest MW master - PHP 7.3
- mw: 'master'
php: 7.3
composer: v2
mysql: '5.7'
continue-on-error: false
# Latest MW master - PHP 7.4
- mw: 'master'
php: 7.4
composer: v2
mysql: '5.7'
continue-on-error: false
# Latest MW master - PHP 8.0
- mw: 'master'
php: 8.0
composer: v2
mysql: '8.0'
continue-on-error: true
runs-on: ubuntu-latest
defaults:
run:
working-directory: mediawiki
services:
mysql:
image: mysql:${{ matrix.mysql }}
options: --name integration-tests-mysql
env:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: mwtest
MYSQL_USER: mwuser
MYSQL_PASSWORD: mw12345
ports:
- 3306:3306
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl
tools: composer:${{ matrix.composer }}
- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v2
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw-${{ matrix.mw }}-php${{ matrix.php }}-v2
- name: Cache Composer cache
uses: actions/cache@v2
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}
- name: Fetch MW install script
uses: actions/checkout@v2
with:
path: installer
- name: Download MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ~
run: bash installer/.github/workflows/download-mediawiki.sh ${{ matrix.mw }}
- name: Install MediaWiki
working-directory: ~
run: bash installer/.github/workflows/install-mediawiki.sh
env:
MYSQL_DATABASE: mwtest
MYSQL_USER: mwuser
MYSQL_PASSWORD: mw12345
- name: Checkout PortableInfobox extension
uses: actions/checkout@v2
with:
path: mediawiki/extensions/PortableInfobox
- name: Run PHPUnit
continue-on-error: ${{ matrix.continue-on-error }}
run: |
[[ '${{ matrix.mw }}' != 'master' ]] && PHPUNIT_ARGS='--use-normal-tables' || PHPUNIT_ARGS=''
php tests/phpunit/phpunit.php $PHPUNIT_ARGS extensions/PortableInfobox/tests/phpunit
env:
PHPUNIT_USE_NORMAL_TABLES: 1