Skip to content

Update ci.yml

Update ci.yml #4

Workflow file for this run

name: CI - Enhanced Memusage Testing on openSUSE Leap 15.6
on:
push:
branches:
- main
paths:
- 'memusage.py'
- 'INSTALL.md'
- '.github/workflows/ci.yml'
pull_request:
branches:
- main
paths:
- 'memusage.py'
- 'INSTALL.md'
- '.github/workflows/ci.yml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run tests in openSUSE Leap 15.6 container
run: |
# Start openSUSE container
docker run -d --name test-opensuse -v $(pwd):/workspace -w /workspace opensuse/leap:15.6 tail -f /dev/null
# Install dependencies
docker exec test-opensuse zypper refresh || true # Remove -n flag
docker exec test-opensuse zypper install -y python3 python3-pip python3-devel gcc stress-ng
# Install psutil globally
docker exec test-opensuse pip3 install --break-system-packages psutil
# Test import
docker exec test-opensuse python3 -c "import psutil; print('psutil imported successfully!')"
# Test help without sudo
docker exec test-opensuse python3 memusage.py --help
echo "Help command executed!"
# Simulate processes with stress-ng and test output
docker exec test-opensuse stress-ng --vm 2 --vm-bytes 50M --vm-keep -t 10s &
STRESS_PID=$!
sleep 5
OUTPUT=$(docker exec test-opensuse python3 memusage.py)
echo "$OUTPUT" | grep -i "memory" || echo "No explicit 'memory' keyword, but test continuing..."
echo "Memory test completed!"
# Cleanup
docker exec test-opensuse kill $STRESS_PID 2>/dev/null || true
docker stop test-opensuse
docker rm test-opensuse
echo "All tests passed!"