Skip to content

[TASK] Raise versions for nginx 1.26.0, PHP 8.3.7, redis 7.2.4, Maria… #32

[TASK] Raise versions for nginx 1.26.0, PHP 8.3.7, redis 7.2.4, Maria…

[TASK] Raise versions for nginx 1.26.0, PHP 8.3.7, redis 7.2.4, Maria… #32

name: Docker Compose Test
on:
push:
branches:
- master
pull_request:
branches:
- "*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and test services
run: |
docker-compose -f docker-compose.yml up --build -d
- name: Test Xdebug
run: |
sleep 10 # Wait for the containers to fully initialize
XDEBUG_OUTPUT=$(curl -s http://localhost/index.php)
if [[ ! "$XDEBUG_OUTPUT" =~ "Xdebug" ]]; then
echo "Xdebug test failed. Not found in phpinfo() output."
exit 1
else
echo "Xdebug test successful."
fi
- name: Test Redis
run: |
sleep 5
REDIS_TEST=$(docker-compose exec -T redis redis-cli ping)
if [[ "$REDIS_TEST" != "PONG" ]]; then
echo "Redis test failed. No PONG response."
exit 1
else
echo "Redis test successful."
fi
- name: Test MariaDB
run: |
sleep 5
MYSQL_TEST=$(docker-compose exec -T mariadb mysql -u${{ secrets.MARIADB_USER }} -p${{ secrets.MARIADB_PASSWORD }} -e "SHOW DATABASES;")
if [[ ! "$MYSQL_TEST" =~ "${MARIADB_DATABASE}" ]]; then
echo "MariaDB test failed. Cannot show databases."
exit 1
else
echo "MariaDB test successful."
fi
- name: Cleanup
run: |
docker-compose -f docker-compose.yml down