Enhance test environment setup with logging and artifact upload
Some checks are pending
CI / release (push) Waiting to run
CI / debug (push) Waiting to run
CI / release_executable (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
Some checks are pending
CI / release (push) Waiting to run
CI / debug (push) Waiting to run
CI / release_executable (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
This commit is contained in:
parent
9974ed8a1b
commit
be49c55196
1 changed files with 43 additions and 0 deletions
43
.github/workflows/ncc_workflow.yml
vendored
43
.github/workflows/ncc_workflow.yml
vendored
|
@ -331,8 +331,17 @@ jobs:
|
||||||
|
|
||||||
- name: Deploy test environment
|
- name: Deploy test environment
|
||||||
run: |
|
run: |
|
||||||
|
# Create logs directory
|
||||||
|
mkdir -p docker-logs
|
||||||
|
|
||||||
|
# Start Docker Compose in detached mode
|
||||||
|
echo "Starting Docker Compose services..."
|
||||||
docker-compose -f docker-compose.test.yml up -d
|
docker-compose -f docker-compose.test.yml up -d
|
||||||
|
|
||||||
|
# Save container IDs for later log extraction
|
||||||
|
CONTAINER_IDS=$(docker-compose -f docker-compose.test.yml ps -q)
|
||||||
|
echo "Started containers: $CONTAINER_IDS"
|
||||||
|
|
||||||
- name: Wait for services to be available
|
- name: Wait for services to be available
|
||||||
run: |
|
run: |
|
||||||
# Function to check if a service is available
|
# Function to check if a service is available
|
||||||
|
@ -364,11 +373,38 @@ jobs:
|
||||||
# Check both services
|
# Check both services
|
||||||
check_service "http://127.0.0.1:8085/" && check_service "http://127.0.0.1:8086/"
|
check_service "http://127.0.0.1:8085/" && check_service "http://127.0.0.1:8086/"
|
||||||
|
|
||||||
|
- name: Start log streaming in background
|
||||||
|
run: |
|
||||||
|
# Start a background process to stream logs to a file
|
||||||
|
docker-compose -f docker-compose.test.yml logs -f > docker-logs/live-logs.txt 2>&1 &
|
||||||
|
echo $! > .docker-logs-pid
|
||||||
|
|
||||||
|
# Also save current logs to a separate file
|
||||||
|
docker-compose -f docker-compose.test.yml logs > docker-logs/startup-logs.txt 2>&1
|
||||||
|
|
||||||
- name: Run PHPUnit tests
|
- name: Run PHPUnit tests
|
||||||
run: |
|
run: |
|
||||||
wget https://phar.phpunit.de/phpunit-11.3.phar
|
wget https://phar.phpunit.de/phpunit-11.3.phar
|
||||||
php phpunit-11.3.phar --configuration phpunit.xml --log-junit reports/junit.xml --log-teamcity reports/teamcity --testdox-html reports/testdox.html --testdox-text reports/testdox.txt
|
php phpunit-11.3.phar --configuration phpunit.xml --log-junit reports/junit.xml --log-teamcity reports/teamcity --testdox-html reports/testdox.html --testdox-text reports/testdox.txt
|
||||||
|
|
||||||
|
- name: Capture final logs
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
# Stop the background log process if it's running
|
||||||
|
if [ -f .docker-logs-pid ]; then
|
||||||
|
kill $(cat .docker-logs-pid) || true
|
||||||
|
rm .docker-logs-pid
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Capture one final set of logs
|
||||||
|
docker-compose -f docker-compose.test.yml logs > docker-logs/final-logs.txt 2>&1
|
||||||
|
|
||||||
|
# Get individual container logs as well (with timestamps)
|
||||||
|
for container in $(docker-compose -f docker-compose.test.yml ps -q); do
|
||||||
|
container_name=$(docker inspect --format='{{.Name}}' $container | sed 's/^\///')
|
||||||
|
docker logs --timestamps $container > "docker-logs/$container_name.log" 2>&1
|
||||||
|
done
|
||||||
|
|
||||||
- name: Stop test environment
|
- name: Stop test environment
|
||||||
run: |
|
run: |
|
||||||
docker-compose -f docker-compose.test.yml down
|
docker-compose -f docker-compose.test.yml down
|
||||||
|
@ -380,6 +416,13 @@ jobs:
|
||||||
name: reports
|
name: reports
|
||||||
path: reports
|
path: reports
|
||||||
|
|
||||||
|
- name: Upload Docker logs
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: docker-logs
|
||||||
|
path: docker-logs
|
||||||
|
if: always() # Always upload logs, even if tests fail
|
||||||
|
|
||||||
|
|
||||||
release-documentation:
|
release-documentation:
|
||||||
needs: generate-phpdoc
|
needs: generate-phpdoc
|
||||||
|
|
Loading…
Add table
Reference in a new issue