Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 #51

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1157380
Add PHP 8.4, drop unsupported PHP versions
back-2-95 Nov 27, 2024
e6747c7
GHA: try importing init sql
back-2-95 Nov 27, 2024
4f18876
GHA: try importing init sql 2
back-2-95 Nov 27, 2024
a603be3
GHA: try importing init sql 3
back-2-95 Nov 27, 2024
41b986e
Fix double space in INSERT IGNORE
back-2-95 Nov 27, 2024
e7747f9
GHA: use docker images as databases
back-2-95 Nov 27, 2024
a850025
GHA: use docker images as databases 2
back-2-95 Nov 27, 2024
3860140
GHA: use docker images as databases 3
back-2-95 Nov 27, 2024
5b3d5ba
GHA: use docker images as databases 4
back-2-95 Nov 27, 2024
e4de88b
GHA: use docker images as databases 5
back-2-95 Nov 27, 2024
8f013d7
GHA: use docker images as databases 6
back-2-95 Nov 27, 2024
0bf521c
GHA: use docker images as databases 7
back-2-95 Nov 27, 2024
8b8647b
GHA: use docker images as databases 8 bitnami images
back-2-95 Nov 27, 2024
aa78d75
GHA: use docker images as databases 9 bitnami images
back-2-95 Nov 27, 2024
118207b
GHA: use docker images as databases 10 bitnami images
back-2-95 Nov 27, 2024
1a9a2c6
GHA: use docker images as databases 11
back-2-95 Nov 27, 2024
5f236a3
GHA: use docker images as databases 12
back-2-95 Nov 27, 2024
0b0337d
GHA: use docker images as databases 13
back-2-95 Nov 27, 2024
efcb2dc
GHA: use docker images as databases 14
back-2-95 Nov 27, 2024
41733df
GHA: use docker images as databases 15
back-2-95 Nov 27, 2024
462b694
GHA: use docker images as databases 16
back-2-95 Nov 27, 2024
089db94
GHA: use docker images as databases 17
back-2-95 Nov 27, 2024
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 .env.mysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MARIADB_ROOT_PASSWORD=mysql
MYSQL_ROOT_PASSWORD=mysql
MYSQL_DATABASE=mysql
MYSQL_USER=mysql
MYSQL_PASSWORD=mysql
116 changes: 53 additions & 63 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
# Push events on main branch
- main
- php-8.4
pull_request:

jobs:
Expand All @@ -13,84 +14,69 @@ jobs:

runs-on: ${{ matrix.os }}

services:
db:
image: ${{ matrix.database_image }}
env:
# The MySQL docker container requires these environment variables to be set
# so we can create and migrate the test database.
# See: https://hub.docker.com/_/mysql
MARIADB_ROOT_PASSWORD: example
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: example
MYSQL_USER: example
MYSQL_PASSWORD: example
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
ports:
# Opens port 3306 on service container and host
# https://docs.github.com/en/actions/using-containerized-services/about-service-containers
- 3306:3306
# Before continuing, verify the mysql container is reachable from the ubuntu host
options: --name db --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false
matrix:
include:
# MySQL 5.7
- os: ubuntu-20.04
database: 'mysql'
database-version: '5.7'
php-version: '7.4'
- os: ubuntu-20.04
database: 'mysql'
database-version: '5.7'
php-version: '8.0'
- os: ubuntu-20.04
database: 'mysql'
database-version: '5.7'
php-version: '8.1'
- os: ubuntu-20.04
database: 'mysql'
database-version: '5.7'
php-version: '8.2'
- os: ubuntu-20.04
database: 'mysql'
database-version: '5.7'
php-version: '8.3'

# MySQL 8.0
- os: ubuntu-latest
database: 'mysql'
database-version: '8.0'
php-version: '7.4'
- os: ubuntu-latest
database: 'mysql'
database-version: '8.0'
php-version: '8.0'
database: mysql
database_image: bitnami/mysql:8.0
php-version: 8.1
- os: ubuntu-latest
database: 'mysql'
database-version: '8.0'
php-version: '8.1'
database: mysql
database_image: bitnami/mysql:8.0
php-version: 8.2
- os: ubuntu-latest
database: 'mysql'
database-version: '8.0'
php-version: '8.2'
database: mysql
database_image: bitnami/mysql:8.0
php-version: 8.3
- os: ubuntu-latest
database: 'mysql'
database-version: '8.0'
php-version: '8.3'
database: mysql
database_image: bitnami/mysql:8.0
php-version: 8.4

# MariaDB 10.11 LTS
- os: ubuntu-20.04
database: 'mariadb'
database-version: '10.11'
php-version: '7.4'
database: mariadb
database_image: bitnami/mariadb:10.11
php-version: 8.1
- os: ubuntu-20.04
database: 'mariadb'
database-version: '10.11'
php-version: '8.0'
database: mariadb
database_image: bitnami/mariadb:10.11
php-version: 8.2
- os: ubuntu-20.04
database: 'mariadb'
database-version: '10.11'
php-version: '8.1'
database: mariadb
database_image: bitnami/mariadb:10.11
php-version: 8.3
- os: ubuntu-20.04
database: 'mariadb'
database-version: '10.11'
php-version: '8.2'
- os: ubuntu-20.04
database: 'mariadb'
database-version: '10.11'
php-version: '8.3'
database: mariadb
database_image: bitnami/mariadb:10.11
php-version: 8.4

steps:

- uses: shogo82148/actions-setup-mysql@v1
with:
distribution: '${{ matrix.database }}'
mysql-version: '${{ matrix.database-version }}'
user: 'travis'
password: ''
root-password: 'drupal'

- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -112,7 +98,11 @@ jobs:
run: vendor/bin/phpunit

- name: Create user and databases for testing
run: cd tests/scripts && ./create_users.sh 127.0.0.1
run: cat docker-entrypoint-initdb.d/${{ matrix.database }}-init.sql | mysql -h127.0.0.1 -uroot -pexample

- name: Run test script
run: cd tests/scripts && ./test.sh 127.0.0.1
run: |
shopt -s expand_aliases
alias mysqldump='docker exec db mysqldump'
mysqldump --version
cd tests/scripts && ./test.sh 127.0.0.1
29 changes: 7 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
ARG PHP_SHORT_VERSION
ARG PHP_SHORT_VERSION=81

FROM druidfi/php:7.4 AS php-74

RUN sudo apk --update -X https://dl-cdn.alpinelinux.org/alpine/edge/testing --no-cache add php7-pdo php7-pdo_mysql

FROM druidfi/php:8.0 AS php-80

RUN sudo apk --update --no-cache add php8-pdo php8-pdo_mysql

FROM druidfi/php:8.1 AS php-81

RUN sudo apk --update --no-cache add php81-pdo php81-pdo_mysql

FROM druidfi/php:8.2 AS php-82

RUN sudo apk --update -X https://dl-cdn.alpinelinux.org/alpine/edge/community --no-cache add php82-pdo php82-pdo_mysql

FROM druidfi/php:8.3 AS php-83

RUN sudo apk --update -X https://dl-cdn.alpinelinux.org/alpine/edge/community --no-cache add php83-pdo php83-pdo_mysql
FROM php:8.1-alpine AS php-81
FROM php:8.2-alpine AS php-82
FROM php:8.3-alpine AS php-83
FROM php:8.4-alpine AS php-84

FROM php-${PHP_SHORT_VERSION}

RUN sudo apk --update --no-cache add bash mysql-client \
&& sudo rm -rf /var/cache/apk/*
RUN docker-php-ext-install pdo pdo_mysql
RUN apk --update --no-cache add bash mysql-client

WORKDIR /app

Expand Down
34 changes: 12 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Out of the box, `mysqldump-php` supports backing up table structures, the data i

## Requirements

- PHP 7.4 or 8.x with PDO - [see supported versions](https://www.php.net/supported-versions.php)
- MySQL 5.7 or newer (and compatible MariaDB)
- PHP 8.1 or newer with PDO - [see supported versions](https://www.php.net/supported-versions.php)
- MySQL 8.0 or newer (and compatible MariaDB)

## Installing

Install using [Composer](https://getcomposer.org/):

```
```console
composer require druidfi/mysqldump-php
```

Expand Down Expand Up @@ -239,29 +239,19 @@ Local setup for tests:

```console
docker compose up --wait --build
docker compose exec php81 /app/tests/scripts/create_users.sh
docker compose exec php81 /app/tests/scripts/create_users.sh db2
docker compose exec php81 /app/tests/scripts/create_users.sh db3
docker compose exec -w /app/tests/scripts php74 ./test.sh
docker compose exec -w /app/tests/scripts php80 ./test.sh
docker compose exec -w /app/tests/scripts php81 ./test.sh
docker compose exec -w /app/tests/scripts php82 ./test.sh
docker compose exec -w /app/tests/scripts php83 ./test.sh
docker compose exec -w /app/tests/scripts php74 ./test.sh db2
docker compose exec -w /app/tests/scripts php80 ./test.sh db2
docker compose exec -w /app/tests/scripts php81 ./test.sh db2
docker compose exec -w /app/tests/scripts php82 ./test.sh db2
docker compose exec -w /app/tests/scripts php83 ./test.sh db2
docker compose exec -w /app/tests/scripts php74 ./test.sh db3
docker compose exec -w /app/tests/scripts php80 ./test.sh db3
docker compose exec -w /app/tests/scripts php81 ./test.sh db3
docker compose exec -w /app/tests/scripts php82 ./test.sh db3
docker compose exec -w /app/tests/scripts php83 ./test.sh db3
docker compose exec -w /app/tests/scripts php81 ./test.sh mysql
docker compose exec -w /app/tests/scripts php82 ./test.sh mysql
docker compose exec -w /app/tests/scripts php83 ./test.sh mysql
docker compose exec -w /app/tests/scripts php84 ./test.sh mysql
docker compose exec -w /app/tests/scripts php81 ./test.sh mariadb
docker compose exec -w /app/tests/scripts php82 ./test.sh mariadb
docker compose exec -w /app/tests/scripts php83 ./test.sh mariadb
docker compose exec -w /app/tests/scripts php84 ./test.sh mariadb
```

## Credits

Forked from Diego Torres's version which have latest updates from 2020. Use it for PHP 7.3 and older.
Forked from Diego Torres's version which have latest updates from 2020. Use it for PHP 8.0 and older.
https://github.com/ifsnop/mysqldump-php

Originally based on James Elliott's script from 2009.
Expand Down
90 changes: 32 additions & 58 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,91 +1,65 @@
version: '3.7'

services:

db:
container_name: mysqldump-php-mysql-57
image: druidfi/mysql:5.7-drupal
ports:
- 3306

db2:
mysql:
container_name: mysqldump-php-mysql-80
image: druidfi/mysql:8.0-drupal
ports:
- 3306

db3:
container_name: mysqldump-php-mariadb-80
image: druidfi/mariadb:10.11-drupal
ports:
- 3306

php74:
container_name: mysqldump-php-74
image: mysqldump-php-tester:php-7.4
build:
context: .
args:
PHP_SHORT_VERSION: "74"
image: bitnami/mysql:8.0
env_file:
- .env.mysql
volumes:
- .:/app
depends_on:
- db
- db2
- db3
- ./docker-entrypoint-initdb.d/mysql-init.sql:/docker-entrypoint-initdb.d/00-init.sql

php80:
container_name: mysqldump-php-80
image: mysqldump-php-tester:php-8.0
build:
context: .
args:
PHP_SHORT_VERSION: "80"
mariadb:
container_name: mysqldump-php-mariadb-10
image: bitnami/mariadb:10.11
env_file:
- .env.mysql
volumes:
- .:/app
depends_on:
- db
- db2
- db3
- ./docker-entrypoint-initdb.d/mariadb-init.sql:/docker-entrypoint-initdb.d/00-init.sql

php81:
container_name: mysqldump-php-81
image: mysqldump-php-tester:php-8.1
build:
context: .
args:
PHP_SHORT_VERSION: "81"
PHP_SHORT_VERSION: 81
volumes:
- .:/app
depends_on:
- db
- db2
- db3
- mysql
- mariadb

php82:
container_name: mysqldump-php-82
image: mysqldump-php-tester:php-8.2
build:
context: .
args:
PHP_SHORT_VERSION: "82"
PHP_SHORT_VERSION: 82
volumes:
- .:/app
depends_on:
- db
- db2
- db3
- mysql
- mariadb

php83:
container_name: mysqldump-php-83
image: mysqldump-php-tester:php-8.3
build:
context: .
args:
PHP_SHORT_VERSION: "83"
PHP_SHORT_VERSION: 83
volumes:
- .:/app
depends_on:
- mysql
- mariadb

php84:
container_name: mysqldump-php-84
build:
context: .
args:
PHP_SHORT_VERSION: 84
volumes:
- .:/app
depends_on:
- db
- db2
- db3
- mysql
- mariadb
Loading
Loading