Run tests #190
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
on: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
php-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
db: ['mysql'] | |
payload: | |
- { laravel: '11.*', php: '8.2', 'testbench': '9.*' } | |
- { laravel: '11.*', php: '8.3', 'testbench': '9.*' } | |
- { laravel: '10.*', php: '8.3', 'testbench': '8.*'} | |
- { laravel: '10.*', php: '8.2', 'testbench': '8.*'} | |
- { laravel: '10.*', php: '8.1', 'testbench': '8.*'} | |
- { laravel: '9.*', php: '8.2', 'testbench': '7.*'} | |
- { laravel: '9.*', php: '8.1', 'testbench': '7.*'} | |
- { laravel: '9.*', php: '8.0', 'testbench': '7.*'} | |
- { laravel: '8.*', php: '8.1', 'testbench': '6.*'} | |
- { laravel: '8.*', php: '8.0', 'testbench': '6.*'} | |
name: PHP ${{ matrix.payload.php }} - Laravel ${{ matrix.payload.laravel }} - DB ${{ matrix.db }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.payload.php }} | |
extensions: mbstring, dom, fileinfo | |
coverage: none | |
- name: Set up MySQL | |
run: | | |
MYSQL_PORT=3307 docker compose up ${{ matrix.db }} -d | |
- name: Install dependencies | |
run: | | |
composer require "laravel/framework:${{ matrix.payload.laravel }}" "orchestra/testbench:${{ matrix.payload.testbench }}" --no-interaction --no-update | |
composer update --prefer-stable --prefer-dist --no-interaction | |
if [ "${{ matrix.db }}" = "mysql" ]; then | |
while ! mysqladmin ping --host=127.0.0.1 --user=db --port=3307 --password=db@123 --silent; do | |
echo "Waiting for MySQL..." | |
sleep 1 | |
done | |
else | |
echo "Not waiting for MySQL." | |
fi | |
- name: Execute tests | |
env: | |
DB_DRIVER: ${{ matrix.db }} | |
run: | | |
vendor/bin/phpunit |