Skip to content

Commit 7b94d09

Browse files
committed
feat(ci): add system resource monitoring to regression
Add a background system resource monitor to regression.sh that logs CPU, memory, and disk usage every 10 minutes to monitor.log. Ensure monitor is stopped on script exit. Include monitor.log as a workflow artifact for analysis.
1 parent e776da9 commit 7b94d09

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.github/regression.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,34 @@ if [ "$(echo "$PWD"/.bin/*)" != "${PWD}/.bin/*" ]; then
207207
echo
208208
fi
209209
210+
# function to monitor system resources and log them every 10 minutes
211+
monitor_system() {
212+
: > monitor.log
213+
214+
while true; do
215+
{
216+
echo "===== $(date) ====="
217+
echo "--- CPU ---"
218+
top -b -n1 | head -5
219+
echo "--- MEM ---"
220+
free -h
221+
echo "--- DISK ---"
222+
df -h .
223+
echo
224+
} >> monitor.log
225+
226+
sleep 600 # 10 minutes
227+
done
228+
}
229+
230+
# start monitor in background
231+
monitor_system &
232+
MON_PID=$!
233+
234+
# ensure cleanup on ANY exit (success, error, Ctrl-C, set -e, etc.)
235+
# shellcheck disable=SC2064
236+
trap "echo 'Stopping monitor'; kill $MON_PID 2>/dev/null || true" EXIT
237+
210238
# Run tests and generate report
211239
212240
# shellcheck disable=SC2046,SC2119

.github/workflows/regression_reusable.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ jobs:
156156
testrun-report.xml
157157
deselected_tests.txt
158158
requirements_coverage.json
159+
monitor.log
159160
- name: ↟ Upload CLI coverage
160161
uses: actions/upload-artifact@v5
161162
if: success() || failure()

0 commit comments

Comments
 (0)