-
Notifications
You must be signed in to change notification settings - Fork 29
140 lines (123 loc) · 3.98 KB
/
continuous-integration-pecl.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Test with Ray.Aop PECL Extension
on:
push:
pull_request:
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.2', '8.3']
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl, dom, json, libxml, xml, xmlwriter, tokenizer
ini-values: memory_limit=256M
tools: phpize, composer:v2
coverage: none
- name: Install build tools and Valgrind
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake libtool bison re2c valgrind
- name: Verify Valgrind installation
run: valgrind --version
- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress
- name: Build extension
id: build_extension
run: |
git clone https://github.com/ray-di/ext-rayaop.git
cd ext-rayaop
phpize
./configure
make
continue-on-error: true
# Run the demo script
- name: Run demo script
run: |
# Running demo script under Valgrind
valgrind \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
php \
-d extension=./ext-rayaop/modules/rayaop.so \
demo/05-pecl.php
# Combined step for PHPUnit and Valgrind analysis
- name: Run Tests with Valgrind
if: success() || failure()
id: test_with_valgrind
run: |
# Create Valgrind suppression file
cat << EOF > rayaop.supp
{
php_startup_leak
Memcheck:Leak
match-leak-kinds: reachable
...
fun:php_module_startup
...
}
{
zend_mm_startup_leak
Memcheck:Leak
match-leak-kinds: reachable
...
fun:zend_mm_startup
...
}
EOF
# Run PHPUnit under Valgrind
valgrind \
--suppressions=rayaop.supp \
--leak-check=full \
--show-leak-kinds=all \
--track-origins=yes \
--verbose \
--error-exitcode=0 \
--log-file=valgrind.log \
php \
-d extension=./ext-rayaop/modules/rayaop.so \
-d memory_limit=256M \
vendor/bin/phpunit \
--coverage-clover=coverage.xml || true
# Display Valgrind log
echo "=== Valgrind Log ==="
cat valgrind.log
# Upload debug information with unique names per PHP version
- name: Upload debug logs
if: always()
uses: actions/upload-artifact@v4
with:
name: debug-logs-php${{ matrix.php-version }}
path: |
valgrind.log
coverage.xml
core*
if-no-files-found: warn
# Upload coverage report
- name: Upload coverage report
if: always()
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
- name: Final status check
if: always()
run: |
echo "PHP Version: ${{ matrix.php-version }}"
echo "Extension build status: ${{ steps.build_extension.outcome }}"
echo "Test with Valgrind status: ${{ steps.test_with_valgrind.outcome }}"
# Check for critical issues in Valgrind log
if [ -f valgrind.log ]; then
echo "=== Valgrind Error Summary ==="
grep "ERROR SUMMARY:" valgrind.log || true
grep "definitely lost:" valgrind.log || true
grep "indirectly lost:" valgrind.log || true
fi