Skip to content

Commit f9ecb1f

Browse files
committed
Brings repo up to date on dev deps and ci/cd tooling (have not tested yet)
composer.json respository needs set or the correct alias for laminas/laminas-db configured Signed-off-by: Joey Smith <jsmith@webinertia.net> Signed-off-by: Joey Smith <jsmith@webinertia.net>
1 parent 367fd43 commit f9ecb1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1744
-353
lines changed

.ci/mysql_fixtures.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Configure MySQL test database"
4+
5+
mysql --user=root --password=Password123 -e "create database laminasdb_test;"

.laminas-ci/mysql_permissions.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE USER 'gha'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
2+
GRANT ALL PRIVILEGES ON *.* TO 'gha'@'%';
3+
FLUSH PRIVILEGES;

.laminas-ci/phpunit.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
requireCoverageMetadata="true"
7+
colors="true">
8+
9+
<extensions>
10+
<bootstrap class="LaminasIntegrationTest\Db\Mysql\Extension\ListenerExtension" />
11+
</extensions>
12+
<testsuites>
13+
<testsuite name="unit test">
14+
<directory>./test/unit</directory>
15+
</testsuite>
16+
<testsuite name="integration test">
17+
<directory>./test/integration</directory>
18+
</testsuite>
19+
</testsuites>
20+
<php>
21+
<!-- Integration Test Variables -->
22+
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER" value="true" /><!-- todo: remove this env variable as its no longer needed-->
23+
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_HOSTNAME" value="mysql" />
24+
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_USERNAME" value="gha" />
25+
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_PASSWORD" value="password" />
26+
<env name="TESTS_LAMINAS_DB_MYSQL_ADAPTER_DATABASE" value="laminasdb_test" />
27+
</php>
28+
</phpunit>
29+

.laminas-ci/pre-install.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
WORKING_DIRECTORY=$2
4+
JOB=$3
5+
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
6+
7+
8+
if [ ! -z "$GITHUB_BASE_REF" ] && [[ "$GITHUB_BASE_REF" =~ ^[0-9]+\.[0-9] ]]; then
9+
readarray -td. TARGET_BRANCH_VERSION_PARTS <<<"${GITHUB_BASE_REF}.";
10+
unset 'TARGET_BRANCH_VERSION_PARTS[-1]';
11+
declare -a TARGET_BRANCH_VERSION_PARTS
12+
MAJOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[0]}
13+
MINOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[1]}
14+
15+
export COMPOSER_ROOT_VERISON="${MAJOR_OF_TARGET_BRANCH}.${MINOR_OF_TARGET_BRANCH}.99"
16+
echo "Exported COMPOSER_ROOT_VERISON as ${COMPOSER_ROOT_VERISON}"
17+
fi

.laminas-ci/pre-run.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
TEST_USER=$1
6+
WORKSPACE=$2
7+
JOB=$3
8+
9+
COMMAND=$(echo "${JOB}" | jq -r '.command')
10+
11+
if [[ ! ${COMMAND} =~ phpunit ]]; then
12+
exit 0
13+
fi
14+
15+
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
16+
17+
# Install CI version of phpunit config
18+
cp .laminas-ci/phpunit.xml phpunit.xml
19+
20+
# Install lsof (used in integration tests)
21+
apt update -qq
22+
apt install -yqq lsof

bin/install-deps.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
/usr/bin/composer validate && \
4+
/usr/bin/composer --ignore-platform-reqs install \
5+
--no-ansi --no-progress --no-scripts \
6+
--classmap-authoritative --no-interaction \
7+
--quiet

compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
php:
3+
build:
4+
context: ./
5+
dockerfile: docker/php/Dockerfile
6+
args:
7+
- PHP_VERSION=${PHP_VERSION:-8.3.19}
8+
volumes:
9+
- ./:/var/www/html
10+
depends_on:
11+
- mysql
12+
13+
mysql:
14+
build:
15+
context: ./
16+
dockerfile: docker/databases/mysql/Dockerfile
17+
args:
18+
- VERSION=${MYSQL_VERSION:-8.0.41}
19+
ports:
20+
- "3306:3306"
21+
environment:
22+
- MYSQL_DATABASE=${MYSQL_DATABASE:-laminasdb_test}
23+
- MYSQL_USER=${MYSQL_USER:-user}
24+
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
25+
- MYSQL_RANDOM_ROOT_PASSWORD=${MYSQL_RANDOM_ROOT_PASSWORD:-yes}
26+
volumes:
27+
- ./test/integration/TestFixtures/mysql.sql:/docker-entrypoint-initdb.d/mysql.sql
28+
healthcheck:
29+
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
30+
timeout: 20s
31+
retries: 10

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,23 @@
3232
},
3333
"require": {
3434
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
35-
"laminas/laminas-db": "*"
35+
"laminas/laminas-db": "*",
36+
"laminas/laminas-servicemanager": "^4.0.0"
3637
},
3738
"require-dev": {
3839
"ext-mysqli": "*",
3940
"ext-pdo_mysql": "*",
4041
"laminas/laminas-coding-standard": "^3.0.1",
4142
"laminas/laminas-eventmanager": "^3.6.0",
4243
"laminas/laminas-hydrator": "^4.7",
43-
"laminas/laminas-servicemanager": "^3.19.0",
44-
"phpunit/phpunit": "^9.5.25",
44+
"phpunit/phpunit": "^11.5.15",
4545
"psalm/plugin-phpunit": "^0.19.2",
4646
"vimeo/psalm": "^6.8.8"
4747
},
4848
"suggest": {
4949
"ext-mysqli": "Required for MySQLi support",
5050
"ext-pdo_mysql": "Required for PDO MySQL support",
51-
"laminas/laminas-servicemanager": "Laminas\\ServiceManager component"
51+
"laminas/laminas-eventmanager": "Required for TableGateway events support"
5252
},
5353
"autoload": {
5454
"psr-4": {

docker/databases/mysql/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ARG VERSION=8.4.5
2+
3+
FROM mysql:${VERSION}-bookworm AS base

docker/php/Dockerfile.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ARG PHP_VERSION=8.3.19
2+
3+
FROM php:${PHP_VERSION}-apache-bookworm AS base
4+
5+
# Copy Composer from the official Docker Hub repository to the local filesystem
6+
COPY --from=composer:2.8.6 /usr/bin/composer /usr/bin/
7+
8+
# Install the database extensions for MySQL, PostgreSQL, and SQLite, their
9+
# dependencies, and any other tools that are required for the environment to be
10+
# used fully and completely.
11+
RUN apt-get update \
12+
&& apt-get install -y git \
13+
&& docker-php-ext-install mysqli pdo pdo_mysql \
14+
&& apt-get clean
15+
16+
# Allow the www-data login so that it can run Composer instead of using root
17+
RUN usermod -s /usr/bin/bash www-data
18+
19+
# Copy all of the files from the context to the current directory setting the
20+
# correct owner
21+
COPY --chown=www-data:www-data . .
22+
23+
RUN chmod +x bin/install-deps.sh
24+
25+
# Validate and install PHP's dependencies
26+
RUN su --preserve-environment www-data --command "bin/install-deps.sh"

0 commit comments

Comments
 (0)