Skip to content

Add enum phpType support and enum migrations for PostgreSQL #545

Add enum phpType support and enum migrations for PostgreSQL

Add enum phpType support and enum migrations for PostgreSQL #545

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
- 'develop'
pull_request:
workflow_dispatch:
env:
DB_NAME: 'perpl_tests'
DB_USER: 'perpl'
DB_PW: 'perpl'
jobs:
testsuite:
name: "Test Suite"
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.5' ]
db-type: [ sqlite, mysql, pgsql, agnostic ]
symfony-version: [ '6-min', '6-max', '7-min', '7-max', '8-min', '8-max']
exclude:
- symfony-version: '7-min'
php-version: '8.1'
- symfony-version: '7-max'
php-version: '8.1'
- symfony-version: '8-min'
php-version: '8.1'
- symfony-version: '8-max'
php-version: '8.1'
services:
postgres:
image: ${{ matrix.db-type != 'pgsql' && '' || (matrix.php-version == '8.1' && 'postgres:9' || 'postgres:latest') }}
env:
POSTGRES_DB: ${{ env.DB_NAME }}
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PW }}
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: ${{ matrix.db-type != 'mysql' && '' || (matrix.php-version == '8.1' && 'mariadb:10.2' || 'mysql:latest') }}
env:
MYSQL_ROOT_PASSWORD: ${{ env.DB_PW }}
MYSQL_DATABASE: ${{ env.DB_NAME }}
MYSQL_USER: ${{ env.DB_USER }}
MYSQL_PASSWORD: ${{ env.DB_PW }}
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: ${{ matrix.php-version }}
symfony-version: ${{ matrix.symfony-version }}
cache-key-suffix: ${{ matrix.db-type}}
- name: Grant MySQL privileges to DB user
if: matrix.db-type == 'mysql'
run: |
mysql -h 127.0.0.1 -u root -e "
GRANT ALL PRIVILEGES ON *.* TO '${{ env.DB_USER }}'@'%';
FLUSH PRIVILEGES;
"
env:
MYSQL_PWD: ${{ env.DB_PW }}
- name: Setup database for test suite
if: matrix.db-type != 'agnostic'
run: tests/bin/setup.${{ matrix.db-type }}.sh
- name: Run tests
shell: bash
run: |
if [[ ${{ matrix.php-version }} == '8.1' && ${{ matrix.symfony-version }} == '6-max' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml --verbose --coverage-clover=tests/coverage.xml
else
vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml
fi
env:
SYMFONY_VERSION: ${{ matrix.symfony-version }}
- name: Code Coverage Report
if: success() && matrix.php-version == '8.1' && matrix.symfony-version == '6-max'
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.php-version }}, ${{ matrix.db-type }}, ${{ matrix.symfony-version }}
file: tests/coverage.xml
static-analysis:
name: 'Stan & Psalm'
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- php-version: '8.1'
symfony-version: '6-max'
- php-version: '8.5'
symfony-version: '8-max'
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: ${{ matrix.php-version }}
symfony-version: ${{ matrix.symfony-version }}
cache-key-suffix: sa
- name: PHPStan
env:
PHPSTAN: 1
run: composer stan
- name: Psalm
run: composer psalm -- --php-version=${{ steps.build-container.outputs.php-version }}
code-style:
name: 'Code Style (PHPCS)'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.4
symfony-version: 6-max
cache-key-suffix: cs
- name: Code Style
run: composer cs-check
generated-code-style:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
type: ['query', 'model']
check: ['PHPCS', 'Stan']
include:
- check: PHPCS
command: 'cs-check -- --exclude=SlevomatCodingStandard.TypeHints.DeclareStrictTypes'
- check: Stan
command: 'stan -- -a autoload.php.dist'
- type: query
file-pattern: '*Query.php'
- type: model
file-pattern: '*[^Query].php'
name: '${{ matrix.check }} on ${{ matrix.type }} code'
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.4
symfony-version: 6-max
cache-key-suffix: cs
- name: Run checks on generated code
run: |
bin/perpl test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
&& composer ${{ matrix.command }} tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/${{ matrix.file-pattern }}