Skip to content

Commit 7a94fef

Browse files
authored
Run tests with multiple php and mysql versions (#136)
* Updating workflow * Add query for MySQL 8.4
1 parent 8a251b5 commit 7a94fef

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

.github/workflows/tests.yml

+13-15
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,25 @@ jobs:
66

77
strategy:
88
matrix:
9-
php: [ '8.2' ]
9+
php: [ '8.2', '8.3', '8.4' ]
1010
mysql-version: [ '5.7', '8.0', '8.4' ]
1111

12-
services:
13-
mysql:
14-
image: "mysql:${{ matrix.mysql-version }}"
15-
env:
16-
MYSQL_ROOT_PASSWORD: root
17-
MYSQL_DATABASE: mysqlreplication_test
18-
ports:
19-
- 3306/tcp
20-
2112
steps:
2213
- name: Checkout
2314
uses: actions/checkout@v2
2415

25-
- name: Start mysql service
26-
run: |
27-
echo -e "\n[mysqld]\nserver-id=1\nbinlog_format=row\nlog_bin=/var/log/mysql/mysql-bin.log\nbinlog_rows_query_log_events=ON" | sudo tee -a /etc/mysql/my.cnf
28-
sudo /etc/init.d/mysql start
29-
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -proot
16+
- uses: shogo82148/actions-setup-mysql@v1
17+
with:
18+
mysql-version: "${{ matrix.mysql-version }}"
19+
my-cnf: |
20+
server-id=1
21+
binlog_format=row
22+
binlog_rows_query_log_events=ON
23+
log_bin=binlog
24+
root-password: root
25+
26+
- name: set up timezones
27+
run: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -proot
3028

3129
- name: Setup PHP, with composer and extensions
3230
uses: shivammathur/setup-php@v2

src/MySQLReplication/Repository/MySQLRepository.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,14 @@ public function getVersion(): string
7070

7171
public function getMasterStatus(): MasterStatusDTO
7272
{
73+
$query = 'SHOW MASTER STATUS';
74+
75+
if (str_starts_with($this->getVersion(), '8.4')) {
76+
$query = 'SHOW BINARY LOG STATUS';
77+
}
78+
7379
$data = $this->getConnection()
74-
->fetchAssociative('SHOW MASTER STATUS');
80+
->fetchAssociative($query);
7581
if (empty($data)) {
7682
throw new BinLogException(
7783
MySQLReplicationException::BINLOG_NOT_ENABLED,

0 commit comments

Comments
 (0)