Skip to content

Commit 4d92869

Browse files
author
Marc Wolf
committed
[TASK] Update to use compose.yml and integrate PHPUnit
- Rename docker-compose.yml to compose.yml - Add PHPUnit 11.2.1 to composer.json - Update README.md with setup instructions for Docker Compose and PHPUnit - Ensure .gitignore includes vendor directory - Adjust GitHub Actions workflow to use compose.yml
1 parent 35611fc commit 4d92869

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

.github/workflows/docker-compose-test.yml renamed to .github/workflows/ci.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ jobs:
2727

2828
- name: Build and test services
2929
run: |
30-
docker-compose -f docker-compose.yml up --build -d
30+
docker compose -f compose.yml up --build -d
3131
3232
- name: Test Xdebug
3333
run: |
34-
sleep 10 # Wait for the containers to fully initialize
34+
sleep 5 # Wait for the containers to fully initialize
3535
XDEBUG_OUTPUT=$(curl -s http://localhost/index.php)
3636
if [[ ! "$XDEBUG_OUTPUT" =~ "Xdebug" ]]; then
3737
echo "Xdebug test failed. Not found in phpinfo() output."
@@ -42,16 +42,16 @@ jobs:
4242
4343
- name: Install Composer dependencies
4444
run: |
45-
docker-compose exec -T php-fpm composer install
45+
docker compose exec -T php-fpm composer install
4646
4747
- name: Run PHPUnit tests
4848
run: |
49-
docker-compose exec -T php-fpm ./vendor/bin/phpunit tests
49+
docker compose exec -T php-fpm ./vendor/bin/phpunit tests
5050
5151
- name: Test Redis
5252
run: |
5353
sleep 5 # Wait for Redis to fully initialize
54-
REDIS_TEST=$(docker-compose exec -T redis redis-cli ping)
54+
REDIS_TEST=$(docker compose exec -T redis redis-cli ping)
5555
if [[ "$REDIS_TEST" != "PONG" ]]; then
5656
echo "Redis test failed. No PONG response."
5757
exit 1
@@ -65,8 +65,8 @@ jobs:
6565
MARIADB_PASSWORD: ${{ secrets.MARIADB_PASSWORD }}
6666
MARIADB_DATABASE: ${{ secrets.MARIADB_DATABASE }}
6767
run: |
68-
sleep 10 # Wait for MariaDB to fully initialize
69-
MARIADB_TEST=$(docker-compose exec -T mariadb mariadb -u${MARIADB_USER} -p${MARIADB_PASSWORD} -e "SHOW DATABASES LIKE '${MARIADB_DATABASE}';")
68+
sleep 5 # Wait for MariaDB to fully initialize
69+
MARIADB_TEST=$(docker compose exec -T mariadb mariadb -u${MARIADB_USER} -p${MARIADB_PASSWORD} -e "SHOW DATABASES LIKE '${MARIADB_DATABASE}';")
7070
if [[ "$MARIADB_TEST" != *"${MARIADB_DATABASE}"* ]]; then
7171
echo "MariaDB test failed. Database not found."
7272
exit 1
@@ -76,4 +76,4 @@ jobs:
7676
7777
- name: Cleanup
7878
run: |
79-
docker-compose -f docker-compose.yml down
79+
docker compose -f compose.yml down

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Docker compose PHP 8.3.8, Xdebug 3.4.0, Nginx 1.27.0, Redis 7.2.5 and MariaDB 11.4.2
1+
# Docker compose PHP 8.3.8, Xdebug 3.3.2, Nginx 1.27.0, Redis 7.2.5 and MariaDB 11.4.2
22

33
![docker](https://img.shields.io/badge/Docker-compose-brightgreen.svg)
44
![nginx](https://img.shields.io/badge/nginx-1.27.0-brightgreen.svg)
@@ -8,7 +8,7 @@
88
![redis](https://img.shields.io/badge/Redis-7.2.5-brightgreen.svg)
99
![mariadb](https://img.shields.io/badge/MariaDB-11.4.2-brightgreen.svg)
1010

11-
* Easy setup with [docker-compose](https://docs.docker.com/compose/) and [Dockerfile](https://docs.docker.com/engine/reference/builder/) under usage from [Docker](https://www.docker.com)
11+
* Easy setup with [docker compose](https://docs.docker.com/compose/) and [Dockerfile](https://docs.docker.com/engine/reference/builder/) under usage from [Docker](https://www.docker.com)
1212
* Uses [PHP 8.3.8](https://www.php.net) for better performance, lower CPU and memory usage
1313
* And [composer the dependency manager for PHP](https://getcomposer.org) to start easy your project
1414
* Built on the lightweight [nginx 1.27.0](https://nginx.org) webserver
@@ -27,17 +27,17 @@
2727

2828
2. **Build and start the Docker containers:**
2929
```sh
30-
docker-compose up --build -d
30+
docker compose up --build -d
3131
```
3232

3333
3. **Install Composer dependencies:**
3434
```sh
35-
docker-compose exec -T php-fpm composer install
35+
docker compose exec -T php-fpm composer install
3636
```
3737

3838
4. **Run PHPUnit tests:**
3939
```sh
40-
docker-compose exec -T php-fpm ./vendor/bin/phpunit tests
40+
docker compose exec -T php-fpm ./vendor/bin/phpunit tests
4141
```
4242

4343
## Example PHPUnit Test
File renamed without changes.

0 commit comments

Comments
 (0)