Skip to content

chore(v3): cleanup #390

chore(v3): cleanup

chore(v3): cleanup #390

Workflow file for this run

name: PHPUnit
on:
push:
paths: &paths
- .github/workflows/phpunit.yml
- config/**
- skeleton/**
- src/**
- tests/**
- composer.json
- phpunit*
pull_request:
paths: *paths
schedule:
- cron: '0 0 1,16 * *'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
tests:
name: P:${{ matrix.php }}, S:${{ matrix.symfony }}, D:${{ matrix.database }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}${{ matrix.no-dama == 1 && ' (no dama)' || '' }}${{ matrix.disable-php-84-lazy-objects == 1 && ' (no lazy objects)' || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.4, 8.5 ]
symfony: [ 8.0.* ]
database: [ mysql|mongo ]
deps: [ highest ]
include:
# One permutation per DBMS
- {php: 8.5, symfony: 8.0.*, database: mongo}
- {php: 8.5, symfony: 8.0.*, database: pgsql}
- {php: 8.5, symfony: 8.0.*, database: sqlite}
- {php: 8.5, symfony: 8.0.*, database: mysql}
# test with no database
- {php: 8.5, symfony: 8.0.*, database: none}
- {php: 8.5, symfony: 8.0.*, database: none, deps: lowest}
# lowest deps (one per DBMS)
- {php: 8.4, symfony: 8.0.*, database: mysql|mongo, deps: lowest}
- {php: 8.4, symfony: 8.0.*, database: mongo, deps: lowest}
- {php: 8.4, symfony: 8.0.*, database: pgsql, deps: lowest}
- {php: 8.4, symfony: 8.0.*, database: sqlite, deps: lowest}
- {php: 8.4, symfony: 8.0.*, database: mysql, deps: lowest}
# Disable dama
- {php: 8.5, symfony: 8.0.*, database: mysql, no-dama: 1}
# disable lazy objects in PHP 8.4
- { php: 8.4, symfony: 8.0.*, database: mysql|mongo, disable-php-84-lazy-objects: 1 }
env:
DATABASE_URL: ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/foundry?serverVersion=15' || contains(matrix.database, 'sqlite') && 'sqlite:///%kernel.project_dir%/var/data.db' || '' }}
MONGO_URL: ${{ contains(matrix.database, 'mongo') && 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' || '' }}
USE_DAMA_DOCTRINE_TEST_BUNDLE: ${{ contains(matrix.database, 'sql') && matrix.no-dama != 1 && 1 || 0 }}
WITH_LOWEST_DEPENDENCIES: ${{ matrix.deps == 'lowest' && 1 || 0 }}
USE_PHP_84_LAZY_OBJECTS: ${{ matrix.disable-php-84-lazy-objects != 1 && 1 || 0}}
services:
postgres:
image: ${{ contains(matrix.database, 'pgsql') && 'postgres:15' || '' }}
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: foundry
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mongo:
image: ${{ contains(matrix.database, 'mongo') && 'mongo:4' || '' }}
ports:
- 27017:27017
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: ./phpunit
shell: bash
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
test-reset-database:
name: Reset DB - D:${{ matrix.database }}${{ matrix.use-dama == 1 && ' (dama)' || '' }}${{ matrix.reset-database-mode == 'migrate' && ' (migrate)' || '' }}${{ contains(matrix.with-migration-configuration-file, 'transactional') && '(configuration file transactional)' || contains(matrix.with-migration-configuration-file, 'configuration') && '(configuration file)' || '' }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database: [ mysql, pgsql, sqlite, mysql|mongo ]
use-dama: [ 0, 1 ]
reset-database-mode: [ schema, migrate ]
migration-configuration-file: ['no']
deps: [ highest, lowest ]
include:
- { database: mongo, use-dama: 0, reset-database-mode: schema }
- { database: pgsql, migration-configuration-file: 'migration-configuration', use-dama: 0, reset-database-mode: migration }
- { database: pgsql, migration-configuration-file: 'migration-configuration-transactional', use-dama: 0, reset-database-mode: migration }
env:
DATABASE_URL: ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/foundry?serverVersion=15' || 'sqlite:///%kernel.project_dir%/var/data.db' }}
MONGO_URL: ${{ contains(matrix.database, 'mongo') && 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' || '' }}
USE_DAMA_DOCTRINE_TEST_BUNDLE: ${{ matrix.use-dama == 1 && 1 || 0 }}
DATABASE_RESET_MODE: ${{ matrix.reset-database-mode == 1 && 1 || 0 }}
MIGRATION_CONFIGURATION_FILE: ${{ matrix.migration-configuration-file == 'no' && '' || format('tests/Fixture/MigrationTests/configs/{0}.php', matrix.migration-configuration-file) }}
WITH_LOWEST_DEPENDENCIES: ${{ matrix.deps == 'lowest' && 1 || 0 }}
USE_PHP_84_LAZY_OBJECTS: 1
services:
postgres:
image: ${{ contains(matrix.database, 'pgsql') && 'postgres:15' || '' }}
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: foundry
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mongo:
image: ${{ contains(matrix.database, 'mongo') && 'mongo:4' || '' }}
ports:
- 27017:27017
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.5
coverage: none
tools: flex
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.deps }}
composer-options: --prefer-dist
env:
SYMFONY_REQUIRE: 8.0.*
- name: Set up MySQL
if: contains(matrix.database, 'mysql')
run: sudo /etc/init.d/mysql start
- name: Test
run: |
./phpunit --testsuite reset-database --bootstrap tests/bootstrap-reset-database.php
# We should be able to run the tests twice in order to check if the second run also starts from a fresh db
# some bugs could be detected this way
./phpunit --testsuite reset-database --bootstrap tests/bootstrap-reset-database.php
shell: bash
env:
SYMFONY_REQUIRE: 8.0.*
test-no-framework:
name: No framework - PHP${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: [ 8.4, 8.5 ]
env:
USE_DAMA_DOCTRINE_TEST_BUNDLE: 0
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:
composer-options: --prefer-dist
- name: Remove framework dependencies
run: |
composer remove --dev \
dama/doctrine-test-bundle \
doctrine/doctrine-bundle \
doctrine/doctrine-migrations-bundle \
doctrine/mongodb-odm-bundle \
symfony/maker-bundle \
symfony/flex \
symfony/phpunit-bridge \
symfony/framework-bundle
- name: Test
run: |
./phpunit tests/Unit
test-with-paratest:
name: Test with paratest
runs-on: ubuntu-latest
env:
DATABASE_URL: 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42'
MONGO_URL: 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb'
services:
mongo:
image: 'mongo:4'
ports:
- 27017:27017
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.5
coverage: none
tools: flex
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist
env:
SYMFONY_REQUIRE: 8.0.*
- name: Set up MySQL
run: sudo /etc/init.d/mysql start
- name: Install paratest
run: composer require brianium/paratest --dev
shell: bash
- name: Test
run: vendor/bin/paratest --processes 1 --configuration phpunit-paratest.xml.dist
shell: bash
code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://root:root@localhost:5432/foundry?serverVersion=15
MONGO_URL: mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb
USE_DAMA_DOCTRINE_TEST_BUNDLE: 1
FOUNDRY_FAKER_SEED: 1234
services:
mongo:
image: mongo:4
ports:
- 27017:27017
postgres:
image: postgres:15
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: foundry
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.5
coverage: xdebug
ini-values: xdebug.mode=coverage
tools: flex
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --prefer-dist
env:
SYMFONY_REQUIRE: 8.0.x
- name: Test with coverage
run: ./phpunit --coverage-text --coverage-clover coverage.xml
shell: bash
env:
SYMFONY_DEPRECATIONS_HELPER: disabled
- name: Publish coverage report to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml