mirror of https://github.com/OpenVidu/openvidu.git
ov-components: add cleanup action to workflows for better resource management
parent
8dfb513bb0
commit
f951eddfe5
|
@ -0,0 +1,96 @@
|
|||
name: 'OpenVidu Meet Cleanup'
|
||||
description: 'Clean up OpenVidu Meet test environment'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Show pre-cleanup status
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "=== System status before cleanup ==="
|
||||
df -h
|
||||
free -h
|
||||
echo "=== Running processes ==="
|
||||
ps aux | grep -i 'npm\|node\|livekit' | grep -v grep || true
|
||||
echo "=== Docker containers ==="
|
||||
docker ps -a || true
|
||||
shell: bash
|
||||
|
||||
- name: Kill backend process
|
||||
run: pkill -f "npm run start:prod" || true
|
||||
shell: bash
|
||||
|
||||
- name: Stop OpenVidu Local Deployment containers
|
||||
continue-on-error: true
|
||||
run: |
|
||||
if [ -d "openvidu-local-deployment/community" ]; then
|
||||
cd openvidu-local-deployment/community
|
||||
docker compose down -v || echo "Warning: Failed to stop containers cleanly"
|
||||
else
|
||||
echo "Directory openvidu-local-deployment/community not found, skipping"
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Clean up temporary files
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "Cleaning temporary files..."
|
||||
rm -rf /tmp/openvidu-* || echo "Warning: Failed to clean some OpenVidu temp files"
|
||||
rm -rf /tmp/livekit-* || echo "Warning: Failed to clean some LiveKit temp files"
|
||||
shell: bash
|
||||
|
||||
- name: Check for running containers
|
||||
continue-on-error: true
|
||||
run: |
|
||||
CONTAINERS=$(docker ps -q)
|
||||
if [ -n "$CONTAINERS" ]; then
|
||||
echo "Warning: Found running containers. Stopping them before prune."
|
||||
docker stop $CONTAINERS || true
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Clean up Docker resources
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "Pruning Docker system..."
|
||||
docker system prune -f --volumes || echo "Warning: Docker system prune failed"
|
||||
shell: bash
|
||||
|
||||
- name: Kill orphaned processes
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "Checking for orphaned processes..."
|
||||
ORPHANED=$(ps aux | grep -i 'npm\|node\|livekit' | grep -v grep | awk '{print $2}')
|
||||
if [ -n "$ORPHANED" ]; then
|
||||
echo "Killing processes: $ORPHANED"
|
||||
kill -9 $ORPHANED || echo "Warning: Some processes couldn't be killed"
|
||||
else
|
||||
echo "No orphaned processes found"
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Clean specific directories
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "Cleaning specific directories..."
|
||||
# Don't try to remove the entire working directory
|
||||
# Instead, clean specific subdirectories that might cause permission issues
|
||||
|
||||
if [ -d "openvidu-local-deployment" ]; then
|
||||
sudo rm -rf openvidu-local-deployment || echo "Warning: Failed to remove openvidu-local-deployment"
|
||||
fi
|
||||
|
||||
# Clean build and cache directories
|
||||
find . -type d -name "node_modules" -exec rm -rf {} +
|
||||
find . -type d -name "dist" -exec rm -rf {} +
|
||||
find . -type d -name ".cache" -exec rm -rf {} +
|
||||
shell: bash
|
||||
|
||||
- name: Show system status
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo "=== System status after cleanup ==="
|
||||
df -h
|
||||
free -h
|
||||
docker ps -a
|
||||
echo "=== Cleanup completed ==="
|
||||
shell: bash
|
|
@ -92,6 +92,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:nested-events --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
unit_tests:
|
||||
name: Unit Tests
|
||||
|
@ -114,7 +117,9 @@ jobs:
|
|||
npm install
|
||||
- name: Run Unit Tests
|
||||
run: npm run lib:test --prefix openvidu-components-angular
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
nested_components_e2e_directives:
|
||||
needs: test_setup
|
||||
|
@ -163,6 +168,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:nested-directives --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_directives:
|
||||
needs: test_setup
|
||||
|
@ -212,6 +220,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-directives --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_chat:
|
||||
needs: test_setup
|
||||
|
@ -261,7 +272,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-chat --prefix openvidu-components-angular
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_events:
|
||||
needs: test_setup
|
||||
|
@ -311,6 +324,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-events --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_media_devices:
|
||||
needs: test_setup
|
||||
|
@ -360,6 +376,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-media-devices --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_panels:
|
||||
needs: test_setup
|
||||
|
@ -409,6 +428,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-panels --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_screen_sharing:
|
||||
needs: test_setup
|
||||
|
@ -458,7 +480,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-screensharing --prefix openvidu-components-angular
|
||||
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_stream:
|
||||
needs: test_setup
|
||||
|
@ -508,6 +532,9 @@ jobs:
|
|||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-stream --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
||||
|
||||
webcomponent_e2e_toolbar:
|
||||
needs: test_setup
|
||||
|
@ -556,4 +583,7 @@ jobs:
|
|||
- name: Run Webcomponent E2E
|
||||
env:
|
||||
LAUNCH_MODE: CI
|
||||
run: npm run e2e:webcomponent-toolbar --prefix openvidu-components-angular
|
||||
run: npm run e2e:webcomponent-toolbar --prefix openvidu-components-angular
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
uses: ./.github/actions/cleanup
|
Loading…
Reference in New Issue