Skip to content

Run tests

Run tests #1746

Workflow file for this run

name: "Run tests"
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
test:
runs-on: ubuntu-latest
services:
mysql57:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: migration
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
mysql8:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: migration
ports:
- 33062:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
postgres:
image: postgis/postgis:13-3.3
env:
POSTGRES_DB: migration
POSTGRES_USER: root
POSTGRES_PASSWORD: "!QAZ2wsx"
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
sqlsrv:
image: mcr.microsoft.com/mssql/server:2019-latest
env:
SA_PASSWORD: "!QAZ2wsx"
ACCEPT_EULA: "Y"
ports:
- 1433:1433
options: >-
--health-cmd "echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P '!QAZ2wsx'"
mariadb:
image: mariadb:10
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: "migration"
ports:
- 3307:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
strategy:
matrix:
php: [ 8.2, 8.3 ]
laravel: [ 11.* ]
sqlsrv_extension: [ pdo_sqlsrv ]
include:
- php: 8.1
laravel: 10.43.*
- php: 8.1
laravel: 10.*
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: SQL Server Create Database
run: |
# Create DB
sqlcmd -S 127.0.0.1 -U sa -P '!QAZ2wsx' -Q 'CREATE DATABASE migration' -b
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, redis, memcached, ${{matrix.sqlsrv_extension}}
tools: composer:v2
coverage: pcov
- name: Install dependencies
run: |
composer config --no-plugins allow-plugins.kylekatarnls/update-helper true
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --prefer-stable --prefer-dist --no-interaction --no-progress
- name: Setup environment
run: |
mkdir ./database
composer run action-env-setup
- name: Execute tests
run: vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Upload to codecov
uses: codecov/codecov-action@v4
with:
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}
files: coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}