Skip to content

CI

CI #268

Workflow file for this run

name: CI
on:
push:
pull_request:
schedule:
- cron: '0 0 1,16 * *'
jobs:
tests:
name: PHP ${{ matrix.php }}, DB ${{ matrix.database }}, SF ${{ matrix.symfony }} - ${{ matrix.deps }}
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.1, 8.2, 8.3, 8.4 ]
deps: [ highest ]
symfony: [ 6.4.*, 7.1.* ]
database: [ mysql, sqlite, pgsql, mariadb ]
include:
- php: 8.1
deps: lowest
symfony: '*'
database: mysql
exclude:
- php: 8.1
symfony: 7.1.*
services:
mariadb:
image: ${{ contains(matrix.database, 'mariadb') && 'mariadb:10.11' || '' }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: db
options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized || mysqladmin ping --protocol tcp --silent"
ports:
- "3306:3306"
postgres:
image: ${{ contains(matrix.database, 'pgsql') && 'postgres:15' || '' }}
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: db
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/db?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/db?serverVersion=15' || contains(matrix.database, 'sqlite') && 'sqlite:///%kernel.project_dir%/var/data.db' || contains(matrix.database, 'mariadb') && 'mysql://root@127.0.0.1:3306/db?serverVersion=10.11.2-MariaDB&charset=utf8mb4' || '' }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: flex
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.deps }}
composer-options: --prefer-dist
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
- name: Set up MySQL
if: contains(matrix.database, 'mysql')
run: sudo /etc/init.d/mysql start
- name: Test
run: vendor/bin/phpunit
shell: bash
code-coverage:
uses: zenstruck/.github/.github/workflows/php-coverage-codecov.yml@main
composer-validate:
uses: zenstruck/.github/.github/workflows/php-composer-validate.yml@main
sca:
uses: zenstruck/.github/.github/workflows/php-stan.yml@main
fixcs:
name: Run php-cs-fixer
needs: sync-with-template
if: (github.event_name == 'push' || github.event_name == 'schedule') && !startsWith(github.ref, 'refs/tags') && github.repository_owner == 'zenstruck'
runs-on: ubuntu-latest
steps:
- uses: zenstruck/.github/actions/php-cs-fixer@main
with:
php: 8.1
key: ${{ secrets.GPG_PRIVATE_KEY }}
token: ${{ secrets.COMPOSER_TOKEN }}
sync-with-template:
name: Sync meta files
if: (github.event_name == 'push' || github.event_name == 'schedule') && !startsWith(github.ref, 'refs/tags') && github.repository_owner == 'zenstruck'
runs-on: ubuntu-latest
steps:
- uses: zenstruck/.github/actions/sync-with-template@main
with:
key: ${{ secrets.GPG_PRIVATE_KEY }}
token: ${{ secrets.COMPOSER_TOKEN }}