Skip to content

Commit 5b52b05

Browse files
committed
reuse docker-compose.yml in GitHub Actions CI
1 parent bc474ea commit 5b52b05

4 files changed

Lines changed: 33 additions & 189 deletions

File tree

.github/workflows/tests.yml

Lines changed: 13 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -17,84 +17,11 @@ jobs:
1717

1818
name: PHP ${{ matrix.php }} tests
1919

20-
services:
21-
mysql57:
22-
image: mysql:5.7
23-
env:
24-
MYSQL_DATABASE: dibi_test
25-
MYSQL_ROOT_PASSWORD: root
26-
ports:
27-
- 3306:3306
28-
options: >-
29-
--health-cmd "mysqladmin ping -ppass"
30-
--health-interval 10s
31-
--health-start-period 10s
32-
--health-timeout 5s
33-
--health-retries 10
34-
35-
mysql80:
36-
image: mysql:8.0
37-
ports:
38-
- 3307:3306
39-
options: >-
40-
--health-cmd="mysqladmin ping -ppass"
41-
--health-interval=10s
42-
--health-timeout=5s
43-
--health-retries=5
44-
-e MYSQL_ROOT_PASSWORD=root
45-
-e MYSQL_DATABASE=dibi_test
46-
47-
postgres96:
48-
image: postgres:9.6
49-
env:
50-
POSTGRES_USER: postgres
51-
POSTGRES_PASSWORD: postgres
52-
POSTGRES_DB: dibi_test
53-
ports:
54-
- 5432:5432
55-
options: >-
56-
--health-cmd pg_isready
57-
--health-interval 10s
58-
--health-timeout 5s
59-
--health-retries 5
60-
61-
postgres13:
62-
image: postgres:13
63-
env:
64-
POSTGRES_USER: postgres
65-
POSTGRES_PASSWORD: postgres
66-
POSTGRES_DB: dibi_test
67-
ports:
68-
- 5433:5432
69-
options: >-
70-
--health-cmd pg_isready
71-
--health-interval 10s
72-
--health-timeout 5s
73-
--health-retries 5
74-
75-
mssql:
76-
image: mcr.microsoft.com/mssql/server:latest
77-
env:
78-
ACCEPT_EULA: Y
79-
SA_PASSWORD: YourStrong!Passw0rd
80-
MSSQL_PID: Developer
81-
ports:
82-
- 1433:1433
83-
options: >-
84-
--name=mssql
85-
--health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1' -N -C"
86-
--health-interval 10s
87-
--health-timeout 5s
88-
--health-retries 5
89-
9020
steps:
9121
- uses: actions/checkout@v4
92-
- uses: shivammathur/setup-php@v2
93-
with:
94-
php-version: ${{ matrix.php }}
95-
extensions: ${{ env.php-extensions }}
96-
tools: ${{ env.php-tools }}
97-
coverage: none
22+
23+
- name: Start database containers
24+
run: docker compose up -d --wait --quiet-pull
9825

9926
- name: Install MS ODBC Driver for SQL Server
10027
run: |
@@ -117,13 +44,20 @@ jobs:
11744
sudo apt-get update
11845
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
11946
120-
# Create DB inside the MSSQL service container
121-
docker exec -i mssql /opt/mssql-tools18/bin/sqlcmd \
47+
# Create MS SQL database
48+
docker compose exec -T mssql /opt/mssql-tools18/bin/sqlcmd \
12249
-S localhost -U SA -P 'YourStrong!Passw0rd' \
12350
-Q "CREATE DATABASE dibi_test" -N -C
12451
52+
- uses: shivammathur/setup-php@v2
53+
with:
54+
php-version: ${{ matrix.php }}
55+
extensions: ${{ env.php-extensions }}
56+
tools: ${{ env.php-tools }}
57+
coverage: none
58+
12559
- name: Create databases.ini
126-
run: cp ./tests/databases.github.ini ./tests/databases.ini
60+
run: cp ./tests/databases.docker.ini ./tests/databases.ini
12761

12862
- run: composer install --no-progress --prefer-dist
12963
- run: composer tester -- -p phpdbg --coverage ./coverage.xml --coverage-src ./src

docker-compose.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ services:
4040
timeout: 5s
4141
retries: 5
4242

43-
#mssql:
44-
# image: mcr.microsoft.com/mssql/server:2022-latest
45-
# ports:
46-
# - "1434:1433"
47-
# environment:
48-
# ACCEPT_EULA: "Y"
49-
# SA_PASSWORD: "YourStrong!Passw0rd"
50-
# MSSQL_PID: Developer
51-
# healthcheck:
52-
# test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1' -N -C
53-
# interval: 10s
54-
# timeout: 5s
55-
# retries: 5
43+
mssql:
44+
image: mcr.microsoft.com/mssql/server:2022-latest
45+
ports:
46+
- "1434:1433"
47+
environment:
48+
ACCEPT_EULA: "Y"
49+
SA_PASSWORD: "YourStrong!Passw0rd"
50+
MSSQL_PID: Developer
51+
healthcheck:
52+
test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P 'YourStrong!Passw0rd' -Q 'SELECT 1' -N -C
53+
interval: 10s
54+
timeout: 5s
55+
retries: 5

tests/databases.docker.ini

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ user = postgres
5656
password = postgres
5757
system = postgre
5858

59-
;[sqlsrv]
60-
;driver = sqlsrv
61-
;host = "localhost"
62-
;username = SA
63-
;password = "YourStrong!Passw0rd"
64-
;database = dibi_test
65-
;port = 1434
66-
;system = sqlsrv
59+
[sqlsrv]
60+
driver = sqlsrv
61+
host = "localhost,1434"
62+
username = SA
63+
password = "YourStrong!Passw0rd"
64+
database = dibi_test
65+
system = sqlsrv

tests/databases.github.ini

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)