framework/.github/workflows/test.yml

80 lines
2.2 KiB
YAML
Raw Normal View History

2019-08-21 06:05:04 +08:00
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
2021-10-14 02:48:03 +08:00
php: [7.3, 7.4, '8.0', '8.1']
service: ['mysql:5.7', mariadb]
prefix: ['', flarum_]
include:
- service: 'mysql:5.7'
db: MySQL
- service: mariadb
db: MariaDB
- prefix: flarum_
prefixStr: (prefix)
exclude:
- php: 7.3
service: 'mysql:5.7'
prefix: flarum_
- php: 7.3
service: mariadb
prefix: flarum_
- php: 8.0
service: 'mysql:5.7'
prefix: flarum_
- php: 8.0
service: mariadb
prefix: flarum_
2019-08-21 06:05:04 +08:00
services:
mysql:
image: ${{ matrix.service }}
2019-08-21 06:05:04 +08:00
ports:
- 13306:3306
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
2019-08-21 06:05:04 +08:00
steps:
- name: Check out code
uses: actions/checkout@v2
2019-08-21 06:05:04 +08:00
2021-03-03 21:48:03 +08:00
- name: Setup PHP
uses: shivammathur/setup-php@0b9d33cd0782337377999751fc10ea079fdd7104 # pin@v2
2021-03-03 21:48:03 +08:00
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
tools: phpunit, composer:v2
2019-08-21 06:05:04 +08:00
2021-03-03 21:48:03 +08:00
# The authentication alter is necessary because newer mysql versions use the `caching_sha2_password` driver,
# which isn't supported prior to PHP7.4
# When we drop support for PHP7.3, we should remove this from the setup.
2019-08-21 06:05:04 +08:00
- name: Create MySQL Database
run: |
sudo systemctl start mysql
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306
2021-03-03 21:48:03 +08:00
mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" --port 13306
2019-08-21 06:05:04 +08:00
- name: Install Composer dependencies
run: composer install
- name: Setup Composer tests
run: composer test:setup
env:
DB_PORT: 13306
DB_PASSWORD: root
DB_PREFIX: ${{ matrix.prefix }}
2019-08-21 06:05:04 +08:00
- name: Run Composer tests
run: composer test
env:
COMPOSER_PROCESS_TIMEOUT: 600