From 4d306bd40298f994d2a507cabc678552be44c6fa Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Mon, 28 Jul 2025 12:45:16 +0200 Subject: [PATCH] ci: Enhanced logging --- .github/workflows/wc-e2e-test.yaml | 93 ++++++++++++++++++++++++------ testapp/src/index.ts | 7 ++- 2 files changed, 80 insertions(+), 20 deletions(-) diff --git a/.github/workflows/wc-e2e-test.yaml b/.github/workflows/wc-e2e-test.yaml index ff56eef..d9795f2 100644 --- a/.github/workflows/wc-e2e-test.yaml +++ b/.github/workflows/wc-e2e-test.yaml @@ -144,15 +144,34 @@ jobs: if: always() run: | echo "=== Collecting TestApp logs ===" - if [ -f testapp/testapp.log ]; then - echo "TestApp log file found, copying..." + echo "Current directory: $(pwd)" + echo "Looking for log files..." + find . -name "testapp.log" -type f 2>/dev/null | head -10 + + # Try multiple possible locations + if [ -f testapp.log ]; then + echo "TestApp log file found at ./testapp.log" + cp testapp.log testapp-logs-webhooks.log + elif [ -f testapp/testapp.log ]; then + echo "TestApp log file found at testapp/testapp.log" cp testapp/testapp.log testapp-logs-webhooks.log + elif [ -f testapp/dist/testapp/testapp.log ]; then + echo "TestApp log file found at testapp/dist/testapp/testapp.log" + cp testapp/dist/testapp/testapp.log testapp-logs-webhooks.log + elif [ -f testapp/dist/testapp.log ]; then + echo "TestApp log file found at testapp/dist/testapp.log" + cp testapp/dist/testapp.log testapp-logs-webhooks.log else - echo "TestApp log file not found at testapp/testapp.log" - echo "Looking for log files..." - find . -name "testapp.log" -type f 2>/dev/null || echo "No testapp.log files found" + echo "TestApp log file not found in any expected locations" + echo "Root directory contents:" + ls -la | head -10 + echo "Testapp directory contents:" + ls -la testapp/ 2>/dev/null || echo "testapp directory not found" + ls -la testapp/dist/ 2>/dev/null || echo "testapp/dist directory not found" echo "Creating empty log file for artifact upload" - echo "TestApp log file not found during CI run" > testapp-logs-webhooks.log + echo "TestApp log file not found during CI run at $(date)" > testapp-logs-webhooks.log + echo "Process information that might be helpful:" + ps aux | grep -i testapp || echo "No testapp processes found" fi - name: Upload failed test videos if: always() @@ -215,15 +234,34 @@ jobs: if: always() run: | echo "=== Collecting TestApp logs ===" - if [ -f testapp/testapp.log ]; then - echo "TestApp log file found, copying..." + echo "Current directory: $(pwd)" + echo "Looking for log files..." + find . -name "testapp.log" -type f 2>/dev/null | head -10 + + # Try multiple possible locations + if [ -f testapp.log ]; then + echo "TestApp log file found at ./testapp.log" + cp testapp.log testapp-logs-ui-features.log + elif [ -f testapp/testapp.log ]; then + echo "TestApp log file found at testapp/testapp.log" cp testapp/testapp.log testapp-logs-ui-features.log + elif [ -f testapp/dist/testapp/testapp.log ]; then + echo "TestApp log file found at testapp/dist/testapp/testapp.log" + cp testapp/dist/testapp/testapp.log testapp-logs-ui-features.log + elif [ -f testapp/dist/testapp.log ]; then + echo "TestApp log file found at testapp/dist/testapp.log" + cp testapp/dist/testapp.log testapp-logs-ui-features.log else - echo "TestApp log file not found at testapp/testapp.log" - echo "Looking for log files..." - find . -name "testapp.log" -type f 2>/dev/null || echo "No testapp.log files found" + echo "TestApp log file not found in any expected locations" + echo "Root directory contents:" + ls -la | head -10 + echo "Testapp directory contents:" + ls -la testapp/ 2>/dev/null || echo "testapp directory not found" + ls -la testapp/dist/ 2>/dev/null || echo "testapp/dist directory not found" echo "Creating empty log file for artifact upload" - echo "TestApp log file not found during CI run" > testapp-logs-ui-features.log + echo "TestApp log file not found during CI run at $(date)" > testapp-logs-ui-features.log + echo "Process information that might be helpful:" + ps aux | grep -i testapp || echo "No testapp processes found" fi - name: Upload failed test videos if: always() @@ -286,15 +324,34 @@ jobs: if: always() run: | echo "=== Collecting TestApp logs ===" - if [ -f testapp/testapp.log ]; then - echo "TestApp log file found, copying..." + echo "Current directory: $(pwd)" + echo "Looking for log files..." + find . -name "testapp.log" -type f 2>/dev/null | head -10 + + # Try multiple possible locations + if [ -f testapp.log ]; then + echo "TestApp log file found at ./testapp.log" + cp testapp.log testapp-logs-recording-access.log + elif [ -f testapp/testapp.log ]; then + echo "TestApp log file found at testapp/testapp.log" cp testapp/testapp.log testapp-logs-recording-access.log + elif [ -f testapp/dist/testapp/testapp.log ]; then + echo "TestApp log file found at testapp/dist/testapp/testapp.log" + cp testapp/dist/testapp/testapp.log testapp-logs-recording-access.log + elif [ -f testapp/dist/testapp.log ]; then + echo "TestApp log file found at testapp/dist/testapp.log" + cp testapp/dist/testapp.log testapp-logs-recording-access.log else - echo "TestApp log file not found at testapp/testapp.log" - echo "Looking for log files..." - find . -name "testapp.log" -type f 2>/dev/null || echo "No testapp.log files found" + echo "TestApp log file not found in any expected locations" + echo "Root directory contents:" + ls -la | head -10 + echo "Testapp directory contents:" + ls -la testapp/ 2>/dev/null || echo "testapp directory not found" + ls -la testapp/dist/ 2>/dev/null || echo "testapp/dist directory not found" echo "Creating empty log file for artifact upload" - echo "TestApp log file not found during CI run" > testapp-logs-recording-access.log + echo "TestApp log file not found during CI run at $(date)" > testapp-logs-recording-access.log + echo "Process information that might be helpful:" + ps aux | grep -i testapp || echo "No testapp processes found" fi - name: Dump TestApp logs on failure if: failure() diff --git a/testapp/src/index.ts b/testapp/src/index.ts index a118f86..175e070 100644 --- a/testapp/src/index.ts +++ b/testapp/src/index.ts @@ -13,8 +13,11 @@ import { import { handleWebhook, joinRoom } from './controllers/roomController'; import { configService } from './services/configService'; -// Setup log file for CI debugging -const logStream = fs.createWriteStream(path.join(__dirname, '../../testapp.log'), { flags: 'a' }); +// Setup log file for CI debugging - always write to current working directory +const logPath = path.join(process.cwd(), 'testapp.log'); +console.log(`Setting up log file at: ${logPath}`); +console.log(`Current working directory: ${process.cwd()}`); +const logStream = fs.createWriteStream(logPath, { flags: 'a' }); // Override console methods to also write to log file const originalConsoleLog = console.log;