Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .ci/mysql_fixtures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

echo "Configure MySQL test database"

mysql --user=root --password=Password123 -e "create database laminasdb_test;"
40 changes: 38 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,41 @@ on:
tags:

jobs:
ci:
uses: laminas/workflow-continuous-integration/.github/workflows/continuous-integration.yml@1.x
matrix:
name: Generate job matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Gather CI configuration
id: matrix
uses: laminas/laminas-ci-matrix-action@v1

qa:
name: QA Checks
needs: [matrix]
runs-on: ${{ matrix.operatingSystem }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.matrix.outputs.matrix) }}
steps:
- name: ${{ matrix.name }}
uses: laminas/laminas-continuous-integration-action@v1
with:
job: ${{ matrix.job }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: 'password'
MYSQL_ROOT_HOST: '%'
MYSQL_USER: 'gha'
MYSQL_PASSWORD: 'password'
MYSQL_DATABASE: 'laminasdb_test'
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
ports:
- 3306
3 changes: 3 additions & 0 deletions .laminas-ci/mysql_permissions.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE USER 'gha'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'gha'@'%';
FLUSH PRIVILEGES;
29 changes: 29 additions & 0 deletions .laminas-ci/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
requireCoverageMetadata="true"
colors="true">

<extensions>
<bootstrap class="LaminasIntegrationTest\Db\Mysql\Extension\ListenerExtension" />
</extensions>
<testsuites>
<testsuite name="unit test">
<directory>./test/unit</directory>
</testsuite>
<testsuite name="integration test">
<directory>./test/integration</directory>
</testsuite>
</testsuites>
<php>
<!-- Integration Test Variables -->
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER" value="true" /><!-- todo: remove this env variable as its no longer needed-->
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_HOSTNAME" value="mysql" />
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_USERNAME" value="gha" />
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_PASSWORD" value="password" />
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_DATABASE" value="laminasdb_test" />
</php>
</phpunit>

17 changes: 17 additions & 0 deletions .laminas-ci/pre-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

WORKING_DIRECTORY=$2
JOB=$3
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')


if [ ! -z "$GITHUB_BASE_REF" ] && [[ "$GITHUB_BASE_REF" =~ ^[0-9]+\.[0-9] ]]; then
readarray -td. TARGET_BRANCH_VERSION_PARTS <<<"${GITHUB_BASE_REF}.";
unset 'TARGET_BRANCH_VERSION_PARTS[-1]';
declare -a TARGET_BRANCH_VERSION_PARTS
MAJOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[0]}
MINOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[1]}

export COMPOSER_ROOT_VERISON="${MAJOR_OF_TARGET_BRANCH}.${MINOR_OF_TARGET_BRANCH}.99"
echo "Exported COMPOSER_ROOT_VERISON as ${COMPOSER_ROOT_VERISON}"
fi
22 changes: 22 additions & 0 deletions .laminas-ci/pre-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e

TEST_USER=$1
WORKSPACE=$2
JOB=$3

COMMAND=$(echo "${JOB}" | jq -r '.command')

if [[ ! ${COMMAND} =~ phpunit ]]; then
exit 0
fi

PHP_VERSION=$(echo "${JOB}" | jq -r '.php')

# Install CI version of phpunit config
cp .laminas-ci/phpunit.xml phpunit.xml

# Install lsof (used in integration tests)
apt update -qq
apt install -yqq lsof
7 changes: 7 additions & 0 deletions bin/install-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

/usr/bin/composer validate && \
/usr/bin/composer --ignore-platform-reqs install \
--no-ansi --no-progress --no-scripts \
--classmap-authoritative --no-interaction \
--quiet
31 changes: 31 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:
php:
build:
context: ./
dockerfile: docker/php/Dockerfile
args:
- PHP_VERSION=${PHP_VERSION:-8.3.19}
volumes:
- ./:/var/www/html
depends_on:
- mysql

mysql:
build:
context: ./
dockerfile: docker/databases/mysql/Dockerfile
args:
- VERSION=${MYSQL_VERSION:-8.0.41}
ports:
- "3306:3306"
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE:-laminasdb_test}
- MYSQL_USER=${MYSQL_USER:-user}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
- MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD:-yes}
volumes:
- ./test/integration/TestFixtures/mysql.sql:/docker-entrypoint-initdb.d/mysql.sql
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
timeout: 20s
retries: 10
40 changes: 20 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,67 @@
{
"name": "laminas/laminas-db-mysql-adapter",
"name": "laminas/laminas-db-adapter-mysql",
"description": "MySQL support for laminas-db",
"license": "BSD-3-Clause",
"keywords": [
"laminas",
"mysql",
"db"
],
"homepage": "https://github.com/axleus/laminas-db-mysql/discussions",
"homepage": "https://github.com/axleus/laminas-db-adapter-mysql/discussions",
"support": {
"issues": "https://github.com/alxeus/laminas-db-mysql/issues",
"source": "https://github.com/axleus/laminas-db-mysql",
"forum": "https://github.com/axleus/laminas-db-mysql/discussions"
"issues": "https://github.com/alxeus/laminas-db-adapter-mysql/issues",
"source": "https://github.com/axleus/laminas-db-adapter-mysql",
"forum": "https://github.com/axleus/laminas-db-adapter-mysql/discussions"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true,
"platform": {
"php": "8.1.99"
"php": "8.2.99"
},
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
"laminas": {
"component": "Laminas\\Db\\Mysql",
"config-provider": "Laminas\\Db\\Mysql\\ConfigProvider"
"component": "Laminas\\Db\\Adapter\\Mysql",
"config-provider": "Laminas\\Db\\Adapter\\Mysql\\ConfigProvider"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/axleus/laminas-db"
}
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"laminas/laminas-db": "3.0.x"
"laminas/laminas-db": "dev-adapter-migration-mysql"
},
"require-dev": {
"ext-mysqli": "*",
"ext-pdo_mysql": "*",
"laminas/laminas-coding-standard": "^3.0.1",
"laminas/laminas-eventmanager": "^3.6.0",
"laminas/laminas-hydrator": "^4.7",
"laminas/laminas-servicemanager": "^3.19.0",
"phpunit/phpunit": "^9.5.25",
"phpunit/phpunit": "^11.5.15",
"psalm/plugin-phpunit": "^0.19.2",
"vimeo/psalm": "^6.8.8"
},
"suggest": {
"ext-mysqli": "Required for MySQLi support",
"ext-pdo_mysql": "Required for PDO MySQL support",
"laminas/laminas-servicemanager": "Laminas\\ServiceManager component"
"laminas/laminas-eventmanager": "Required for TableGateway events support"
},
"autoload": {
"psr-4": {
"Laminas\\Db\\Mysql\\": "src/"
"Laminas\\Db\\Adapter\\Mysql\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"LaminasTest\\Db\\Mysql\\": "test/unit/",
"LaminasIntegrationTest\\Db\\Mysql\\": "test/integration/"
"LaminasTest\\Db\\Adapter\\Mysql\\": "test/unit/",
"LaminasIntegrationTest\\Db\\Adapter\\Mysql\\": "test/integration/"
}
},
"scripts": {
Expand All @@ -73,8 +76,5 @@
"test-integration": "phpunit --colors=always --testsuite \"integration test\"",
"static-analysis": "psalm --shepherd --stats",
"upload-coverage": "coveralls -v"
},
"conflict": {
"laminas/laminas-db": "*"
}
}
Loading