Skip to content

Commit

Permalink
Update build workflow to include fault detection and logging
Browse files Browse the repository at this point in the history
This revision modifies the GitHub Actions CI workflow for better failure diagnostics. It includes a timeout to the 'Run demo' step and a new step added to check for segmentation faults. It also modifies failure conditions ensuring core dumps, logs, and stderr are always displayed and uploaded as artifacts. This will greatly assist in diagnosing build issues when they occur.
  • Loading branch information
koriym committed Jun 27, 2024
1 parent a957d5d commit 323e3cd
Showing 1 changed file with 42 additions and 9 deletions.
51 changes: 42 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:

- name: Enable core dumps
run: |
sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p
ulimit -c unlimited
echo '/tmp/core-%e.%p' | sudo tee /proc/sys/kernel/core_pattern
- name: Set PHP error logging
run: |
Expand Down Expand Up @@ -62,16 +62,24 @@ jobs:
- name: Run demo
run: |
php -d extension=./modules/rayaop.so -i | grep rayaop
php -d extension=./modules/rayaop.so -d memory_limit=128M -d report_memleaks=1 -d zend.assertions=1 -d assert.exception=1 rayaop.php 2> php_stderr.log
continue-on-error: true
timeout 60s php -d extension=./modules/rayaop.so -d memory_limit=128M -d report_memleaks=1 -d zend.assertions=1 -d assert.exception=1 rayaop.php 2> php_stderr.log || true
- name: Check for segmentation fault
run: |
if grep -q "Segmentation fault" php_stderr.log; then
echo "Segmentation fault detected"
cat php_stderr.log
elif dmesg | grep -q "segfault"; then
echo "Segmentation fault detected in kernel logs"
dmesg | tail -n 20
else
echo "No segmentation fault detected"
fi
if: always()

- name: Display PHP error log
run: cat /tmp/php_errors.log
if: failure()

- name: Display stderr output
run: cat php_stderr.log
if: failure()
if: always()

- name: Check for core dump
run: |
Expand All @@ -81,4 +89,29 @@ jobs:
else
echo "No core dump found"
fi
if: failure()
if: always()

- name: Display core dump
run: |
for corefile in /tmp/core-*; do
echo "Processing core dump: $corefile"
gdb -q -c "$corefile" php -ex "thread apply all bt full" -ex "quit"
done
if: always()

- name: Upload core dump
uses: actions/upload-artifact@v2
with:
name: core-dumps
path: /tmp/core-*
if: always()

- name: Upload logs as artifacts
uses: actions/upload-artifact@v2
with:
name: debug-logs
path: |
/tmp/php_errors.log
php_stderr.log
if-no-files-found: warn
if: always()

0 comments on commit 323e3cd

Please sign in to comment.