Skip to content

Commit e684762

Browse files
committed
update unit test environments in CI
1 parent f239bf7 commit e684762

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

.github/workflows/unit_tests.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,25 @@ jobs:
77
unit-tests:
88
runs-on: ubuntu-22.04
99
strategy:
10-
fail-fast: true
10+
fail-fast: false
1111
matrix:
12+
image-tag-prefix: ["", "6.0-"]
1213
php: ["8.1", "8.2", "8.3", "8.4"]
13-
swoole-prefix: ["6.0-", ""]
1414

15-
name: Run Tests Using Image ${{ matrix.swoole-prefix }}php${{ matrix.php }}
15+
name: Run Tests Using Image phpswoole/swoole:${{ matrix.image-tag-prefix }}php${{ matrix.php }}
1616

1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

21-
- name: Customize Dockerfile
22-
run: sed -i.bak -e "s/^FROM phpswoole\/swoole.*$/FROM phpswoole\/swoole:${{ matrix.swoole-prefix }}php${{ matrix.php }}/g" ./Dockerfile
23-
2421
- name: Start Docker Containers
2522
uses: hoverkraft-tech/compose-action@v2.2.0
23+
with:
24+
up-flags: "--build --abort-on-container-exit --remove-orphans --renew-anon-volumes"
25+
down-flags: "--volumes"
26+
env:
27+
IMAGE_TAG_PREFIX: ${{ matrix.image-tag-prefix }}
28+
PHP_VERSION: ${{ matrix.php }}
2629

2730
- name: Prepare Test Environment
2831
run: |

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
FROM phpswoole/swoole
1+
ARG IMAGE_TAG_PREFIX=""
2+
ARG PHP_VERSION=8.3
3+
4+
FROM phpswoole/swoole:${IMAGE_TAG_PREFIX}php${PHP_VERSION}
25

36
RUN apt update \
47
&& apt install -y libaio-dev libc-ares-dev libaio1 supervisor wget git \

docker-compose.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
services:
22
app:
3-
build: .
3+
build:
4+
context: .
5+
args:
6+
- IMAGE_TAG_PREFIX
7+
- PHP_VERSION
48
platform: linux/amd64
59
links:
610
- consul
@@ -21,12 +25,12 @@ services:
2125
- wordpress:/var/www/html
2226

2327
php-fpm:
24-
image: php:8.3-fpm
28+
image: php:8.4-fpm
2529
volumes:
2630
- .:/var/www
2731

2832
wordpress:
29-
image: wordpress:php8.3-fpm
33+
image: wordpress:php8.4-fpm
3034
links:
3135
- mysql
3236
environment:
@@ -43,36 +47,32 @@ services:
4347
nocopy: false
4448

4549
mysql:
46-
image: mysql:8.2
50+
image: mysql:8
4751
environment:
4852
MYSQL_DATABASE: test
4953
MYSQL_USER: username
5054
MYSQL_PASSWORD: password
5155
MYSQL_ROOT_PASSWORD: password
5256

5357
pgsql:
54-
image: postgres:14
58+
image: postgres:17-alpine
5559
environment:
56-
POSTGRES_USER: root
5760
POSTGRES_DB: test
58-
POSTGRES_PASSWORD: root
61+
POSTGRES_USER: username
62+
POSTGRES_PASSWORD: password
5963

6064
oracle:
6165
image: gvenzl/oracle-xe:slim
6266
platform: linux/amd64
6367
environment:
6468
ORACLE_PASSWORD: oracle
65-
ports:
66-
- 1521
6769

6870
redis:
69-
image: redis:6.2
71+
image: redis:7.2
7072

7173
nacos:
7274
image: nacos/nacos-server
7375
platform: linux/amd64
74-
ports:
75-
- 8848
7676
environment:
7777
MODE: standalone
7878
PREFER_HOST_MODE: hostname
@@ -81,8 +81,6 @@ services:
8181
image: consul:1.15
8282
command:
8383
consul agent -dev -client=0.0.0.0
84-
ports:
85-
- 8500
8684

8785
volumes:
8886
wordpress:

tests/bootstrap.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
if (!defined('MYSQL_SERVER_HOST')) {
2525
define('MYSQL_SERVER_HOST', 'mysql');
2626
define('MYSQL_SERVER_PORT', 3306);
27-
define('MYSQL_SERVER_USER', 'root');
27+
define('MYSQL_SERVER_USER', 'username');
2828
define('MYSQL_SERVER_PWD', 'password');
2929
define('MYSQL_SERVER_DB', 'test');
3030
}
3131

3232
if (!defined('PGSQL_SERVER_HOST')) {
3333
define('PGSQL_SERVER_HOST', 'pgsql');
3434
define('PGSQL_SERVER_PORT', 5432);
35-
define('PGSQL_SERVER_USER', 'root');
36-
define('PGSQL_SERVER_PWD', 'root');
35+
define('PGSQL_SERVER_USER', 'username');
36+
define('PGSQL_SERVER_PWD', 'password');
3737
define('PGSQL_SERVER_DB', 'test');
3838
}
3939

0 commit comments

Comments
 (0)