-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (124 loc) · 3.77 KB
/
valgrind.yml
File metadata and controls
145 lines (124 loc) · 3.77 KB
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
141
142
143
144
145
name: Valgrind Memory Check
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
# Run nightly at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
jobs:
valgrind:
name: Memory Leak Detection
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
# GCC 13+ on Ubuntu 24.04 has full std::format support
sudo apt-get install -y \
cmake \
ninja-build \
g++ \
valgrind
- name: Checkout common_system (optional)
continue-on-error: true
run: |
cd ..
if [ ! -d "common_system" ]; then
git clone https://github.com/kcenon/common_system.git || echo "common_system not available"
fi
- name: Configure CMake
run: |
BUILD_WITH_COMMON="OFF"
if [ -d "../common_system" ]; then
BUILD_WITH_COMMON="ON"
fi
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-g -O0" \
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON \
-DBUILD_TESTS=ON \
-DBUILD_EXAMPLES=OFF \
-DBUILD_BENCHMARKS=OFF
- name: Build
run: cmake --build build --parallel
- name: Run Valgrind on Unit Tests
run: |
chmod +x scripts/run_valgrind.sh
./scripts/run_valgrind.sh --unit-tests
- name: Run Valgrind on Integration Tests
run: |
./scripts/run_valgrind.sh --integration-tests
- name: Generate Valgrind Report
if: always()
run: |
./scripts/run_valgrind.sh --generate-report
- name: Upload Valgrind Results
if: always()
uses: actions/upload-artifact@v4
with:
name: valgrind-results
path: |
build/valgrind-*.xml
build/valgrind-report.txt
retention-days: 30
- name: Check for Memory Leaks
run: |
if grep -q "definitely lost: [1-9]" build/valgrind-report.txt 2>/dev/null; then
echo "::error::Memory leaks detected!"
cat build/valgrind-report.txt
exit 1
fi
echo "No memory leaks detected"
valgrind-stress:
name: Extended Stress Test
runs-on: ubuntu-24.04
timeout-minutes: 120
# Only run on schedule or manual trigger
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
# GCC 13+ on Ubuntu 24.04 has full std::format support
sudo apt-get install -y cmake ninja-build g++ valgrind
- name: Checkout common_system (optional)
continue-on-error: true
run: |
cd ..
if [ ! -d "common_system" ]; then
git clone https://github.com/kcenon/common_system.git || echo "common_system not available"
fi
- name: Configure and Build
run: |
BUILD_WITH_COMMON="OFF"
if [ -d "../common_system" ]; then
BUILD_WITH_COMMON="ON"
fi
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_FLAGS="-g -O0" \
-DBUILD_WITH_COMMON_SYSTEM=$BUILD_WITH_COMMON \
-DBUILD_TESTS=ON
cmake --build build --parallel
- name: Run Extended Valgrind Stress Test
run: |
./scripts/run_valgrind.sh --stress-test --duration=3600
- name: Upload Stress Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: valgrind-stress-results
path: build/valgrind-stress-*.xml
retention-days: 30