Skip to content

Improve workflows

Improve workflows #356

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.4, 8.3, 8.2 ]
database: [ mysql, mariadb, pgsql, sqlite, sqlsrv, singlestore, oracle, firebird ]
release: [ stable, lowest ]
exclude:
- php: 8.4
database: oracle
- php: 8.4
database: firebird
include:
- php: 8.3
release: stable
coverage: true
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ~/.cache/composer/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Start database container
run: docker compose -f docker-compose.yml -f docker-compose.ci.yml up --wait ${{ matrix.database }}
if: matrix.database != 'sqlite'
- name: Create SQL Server database
run: docker compose exec sqlsrv /opt/mssql-tools18/bin/sqlcmd -C -S 127.0.0.1 -U sa -P Password! -Q 'CREATE DATABASE [test]'
if: matrix.database == 'sqlsrv'
- name: Install dependencies
run: |
docker compose -f docker-compose.yml -f docker-compose.ci.yml run --rm php${{ matrix.php }} \
composer update --no-interaction --no-progress --prefer-dist --prefer-${{ matrix.release }}
- name: Run tests
run: |
docker compose -f docker-compose.yml -f docker-compose.ci.yml run -e DB_CONNECTION=${{ matrix.database }} \
--rm php${{ matrix.php }}${{ env.XDEBUG }} vendor/bin/phpunit ${{ env.COVERAGE }}
env:
COVERAGE: ${{ matrix.coverage && '--coverage-clover=coverage.xml' || '' }}
XDEBUG: ${{ matrix.coverage && '-xdebug' || '' }}
- name: Upload code coverage
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: matrix.coverage && env.CODECOV_TOKEN