generated from koriym/ext-helloworld
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (99 loc) · 3.4 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Build and Test PHP Extension
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.0', '8.1', '8.2', '8.3']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
- name: Enable core dumps
run: |
sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p
ulimit -c unlimited
- name: Set PHP error logging
run: |
PHP_INI_DIR=$(php -i | grep "Loaded Configuration File" | sed -e "s|.*>\s*||")
PHP_INI_DIR=$(dirname "$PHP_INI_DIR")
echo "PHP INI directory: $PHP_INI_DIR"
if [ ! -d "$PHP_INI_DIR" ]; then
echo "Creating PHP INI directory"
sudo mkdir -p "$PHP_INI_DIR"
fi
echo "error_log = /tmp/php_errors.log" | sudo tee -a "$PHP_INI_DIR/php.ini"
echo "log_errors = On" | sudo tee -a "$PHP_INI_DIR/php.ini"
echo "PHP INI content:"
cat "$PHP_INI_DIR/php.ini"
- name: Display PHP Info
run: php -i
- name: Install build tools
run: sudo apt-get update && sudo apt-get install -y autoconf automake libtool bison re2c gdb
- name: Prepare build
run: |
phpize
./configure
make
- name: Run tests
run: make test
- name: Run demo
run: |
php -d extension=./modules/rayaop.so -i | grep rayaop
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 in php_stderr.log"
cat php_stderr.log
elif dmesg | grep -q "segfault"; then
echo "Segmentation fault detected in kernel logs"
dmesg | tail -n 20
elif [ -r /tmp/php_errors.log ]; then
echo "No segmentation fault detected, but php_errors.log is present"
cat /tmp/php_errors.log
else
echo "No segmentation fault detected and no php_errors.log present"
fi
if: always()
- name: Check for core dump
run: |
if ls /tmp/core-* 1> /dev/null 2>&1; then
echo "Core dump found"
ls -l /tmp/core-*
else
echo "No core dump found"
fi
if: always()
- name: Display core dump
run: |
for corefile in /tmp/core-*; do
if [ -f "$corefile" ]; then
echo "Processing core dump: $corefile"
gdb -q $(which php) "$corefile" -ex "thread apply all bt full" -ex "quit"
fi
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()