Skip to content

Merge pull request #22 from Lomkit/feature/documentation #91

Merge pull request #22 from Lomkit/feature/documentation

Merge pull request #22 from Lomkit/feature/documentation #91

Workflow file for this run

name: tests
on:
push:
branches: [ master, next ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.2' ]
laravel-version: [ '^8.0', '^9.0', '^10.0' ]
database: [ 'sqlite', 'mysql', 'pgsql' ]
name: Tests on PHP ${{ matrix.php-version }} with Laravel ${{ matrix.laravel-version }} and ${{ matrix.database }}
services:
mysql:
image: mysql:8
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: rest
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
pgsql:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: rest
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer update --with "illuminate/contracts=${{ matrix.laravel-version }}" --prefer-dist --no-progress
- name: Run test suite with Sqlite
if: matrix.database == 'sqlite'
run: vendor/bin/phpunit
env:
DB_CONNECTION: sqlite
DB_DATABASE: ':memory:'
- name: Run test suite with MySQL
if: matrix.database == 'mysql'
run: vendor/bin/phpunit
env:
DB_CONNECTION: mysql
DB_PORT: ${{ job.services.mysql.ports[3306] }}
DB_DATABASE: rest
DB_USERNAME: root
- name: Run test suite with PostgreSQL
if: matrix.database == 'pgsql'
run: vendor/bin/phpunit
env:
DB_CONNECTION: pgsql
DB_PORT: ${{ job.services.pgsql.ports[5432] }}
DB_DATABASE: rest
DB_USERNAME: postgres
DB_PASSWORD: postgres