Skip to content

feat: add setTimeout/getTimeout methods and improve code quality #94

feat: add setTimeout/getTimeout methods and improve code quality

feat: add setTimeout/getTimeout methods and improve code quality #94

Workflow file for this run

name: Tests
on:
push:
pull_request:
jobs:
phpstan:
name: PHPStan Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: pdo, pdo_mysql, pdo_pgsql, pdo_sqlite
coverage: none
- run: composer install --no-interaction --prefer-dist
- run: composer phpstan
mysql:
name: MySQL Tests
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
env:
MYSQL_DATABASE: testdb
MYSQL_USER: testuser
MYSQL_PASSWORD: testpass
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: pdo_mysql, simplexml, xmlreader
coverage: xdebug
- run: composer install --no-interaction --prefer-dist
- name: Enable MySQL local_infile
run: |
mysql -h 127.0.0.1 -uroot -proot -e "SET GLOBAL local_infile=1;"
- run: |
DB_DSN="mysql:host=127.0.0.1;port=3306;dbname=testdb;charset=utf8mb4" \
DB_USER="testuser" \
DB_PASS="testpass" \
vendor/bin/phpunit tests/PdoDbMySQLTest.php --coverage-clover coverage-mysql.xml
- name: Test MySQL Examples
run: ./scripts/test-examples.sh
- name: Upload MySQL coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage-mysql.xml
flags: mysql
name: mysql-coverage
postgres:
name: PostgreSQL Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: testdb
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5433:5432
options: >-
--health-cmd="pg_isready -U postgres -d testdb"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: pdo_pgsql, simplexml, xmlreader
coverage: xdebug
- run: composer install --no-interaction --prefer-dist
- name: Setup PostgreSQL test user
run: |
PGPASSWORD=postgres psql -h localhost -p 5433 -U postgres -d testdb -c "CREATE USER testuser WITH PASSWORD 'testpass';"
PGPASSWORD=postgres psql -h localhost -p 5433 -U postgres -d testdb -c "GRANT ALL PRIVILEGES ON DATABASE testdb TO testuser;"
PGPASSWORD=postgres psql -h localhost -p 5433 -U postgres -d testdb -c "GRANT ALL ON SCHEMA public TO testuser;"
- run: |
DB_DSN="pgsql:host=localhost;port=5433;dbname=testdb" \
DB_USER="testuser" \
DB_PASS="testpass" \
vendor/bin/phpunit tests/PdoDbPostgreSQLTest.php --coverage-clover coverage-postgres.xml
- name: Test PostgreSQL Examples
run: ./scripts/test-examples.sh
- name: Upload PostgreSQL coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage-postgres.xml
flags: postgres
name: postgres-coverage
sqlite:
name: SQLite Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: pdo_sqlite
coverage: xdebug
- run: composer install --no-interaction --prefer-dist
- run: |
DB_DSN="sqlite::memory:" \
vendor/bin/phpunit tests/PdoDbSqliteTest.php --coverage-clover coverage-sqlite.xml
- name: Test SQLite Examples
run: ./scripts/test-examples.sh
- name: Upload SQLite coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage-sqlite.xml
flags: sqlite
name: sqlite-coverage
shared-coverage:
name: Shared Coverage Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: pdo_sqlite
coverage: xdebug
- run: composer install --no-interaction --prefer-dist
- run: vendor/bin/phpunit tests/SharedCoverageTest.php --coverage-clover coverage-shared.xml
- name: Upload Shared coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage-shared.xml
flags: shared
name: shared-coverage