Skip to content

feat: implement phase 4 optional ORM features #65

feat: implement phase 4 optional ORM features

feat: implement phase 4 optional ORM features #65

Workflow file for this run

name: CI
on:
push:
branches: ["main"]
pull_request:
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
coverage: none
extensions: pdo, pdo_mysql, pdo_pgsql, pdo_sqlite
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Static analysis
run: vendor/bin/phpstan analyse -c phpstan.neon
- name: Format check
run: vendor/bin/php-cs-fixer fix --dry-run --diff
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.3", "8.4"]
db: ["mysql", "postgres", "sqlite"]
services:
mysql:
image: mariadb:10.11
ports:
- "3306:3306"
env:
MYSQL_ALLOW_EMPTY_PASSWORD: "1"
MYSQL_ROOT_HOST: "%"
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s
--health-timeout=5s
--health-retries=20
postgres:
image: postgres:16
ports:
- "5432:5432"
env:
POSTGRES_DB: categorytest
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd="pg_isready -U postgres -d categorytest"
--health-interval=5s
--health-timeout=5s
--health-retries=20
steps:
- uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: pdo, pdo_mysql, pdo_pgsql, pdo_sqlite
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Configure DB env
run: |
if [ "${{ matrix.db }}" = "mysql" ]; then
echo "MODEL_ORM_TEST_DSN=mysql:host=127.0.0.1;port=3306" >> "$GITHUB_ENV"
echo "MODEL_ORM_TEST_USER=root" >> "$GITHUB_ENV"
echo "MODEL_ORM_TEST_PASS=" >> "$GITHUB_ENV"
elif [ "${{ matrix.db }}" = "postgres" ]; then
echo "MODEL_ORM_TEST_DSN=pgsql:host=127.0.0.1;port=5432;dbname=categorytest" >> "$GITHUB_ENV"
echo "MODEL_ORM_TEST_USER=postgres" >> "$GITHUB_ENV"
echo "MODEL_ORM_TEST_PASS=postgres" >> "$GITHUB_ENV"
else
echo "MODEL_ORM_TEST_DSN=sqlite::memory:" >> "$GITHUB_ENV"
echo "MODEL_ORM_TEST_USER=" >> "$GITHUB_ENV"
echo "MODEL_ORM_TEST_PASS=" >> "$GITHUB_ENV"
fi
- name: Run tests
run: vendor/bin/phpunit -c phpunit.xml.dist