diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index f375167..5e0dbb3 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -38,6 +38,29 @@ jobs: --health-retries 5 steps: + - name: Free disk space + run: | + echo "Initial disk usage:" + df -h + + # Remove unnecessary packages and files to free up space + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo rm -rf /usr/share/swift + sudo apt-get clean + sudo docker system prune -af --volumes + + # Set TMPDIR to use runner's work directory which has more space + echo "TMPDIR=${{ runner.temp }}" >> $GITHUB_ENV + + echo "Disk usage after cleanup:" + df -h + echo "Temp directory set to: ${{ runner.temp }}" + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -50,6 +73,7 @@ jobs: - name: Pre-pull Docker images for testcontainers run: | echo "Pre-pulling Docker images that testcontainers will use..." + # Only pull the specific version we're using to save space docker pull postgres:latest docker pull postgres:15 docker pull postgres:15-alpine @@ -163,7 +187,11 @@ jobs: run: | echo "Running tests with DATABASE_URL: $DATABASE_URL" echo "Environment check:" - env | grep -E "(DATABASE_URL|JWT_SECRET|API_URL)" | sort + env | grep -E "(DATABASE_URL|JWT_SECRET|API_URL|TMPDIR)" | sort + echo "Disk usage before tests:" + df -h + + # Run tests with explicit temp directory cargo test --test '*' --features test-utils --no-fail-fast -- --test-threads=1 --nocapture env: DATABASE_URL: ${{ env.DATABASE_URL }} @@ -182,6 +210,10 @@ jobs: - name: Print server logs on failure if: failure() run: | + echo "=== Disk usage on failure ===" + df -h + echo "=== Temp directory usage ===" + du -sh ${{ runner.temp }} || echo "Could not check temp directory" echo "=== Server logs ===" cat server.log || echo "No server logs found" echo "=== End of server logs ===" diff --git a/tests/integration_enhanced_ocr_tests.rs b/tests/integration_enhanced_ocr_tests.rs index f9bcad1..d7695f8 100644 --- a/tests/integration_enhanced_ocr_tests.rs +++ b/tests/integration_enhanced_ocr_tests.rs @@ -272,8 +272,10 @@ mod tests { let temp_file = NamedTempFile::with_suffix(".txt").unwrap(); // Create a file larger than the limit (50MB for text files) - let large_content = "A".repeat(60 * 1024 * 1024); // 60MB + // Using smaller size and explicit drop for CI environments + let large_content = "A".repeat(50 * 1024 * 1024 + 1024); // 50MB + 1KB (just over the limit) fs::write(temp_file.path(), &large_content).unwrap(); + drop(large_content); // Explicitly free memory let result = service .extract_text(temp_file.path().to_str().unwrap(), "text/plain", &settings) @@ -533,8 +535,10 @@ startxref let temp_file = NamedTempFile::with_suffix(".pdf").unwrap(); // Create a file larger than the 100MB PDF limit - let large_pdf_content = format!("%PDF-1.4\n{}", "A".repeat(110 * 1024 * 1024)); - fs::write(temp_file.path(), large_pdf_content).unwrap(); + // Using smaller size and explicit drop for CI environments + let large_pdf_content = format!("%PDF-1.4\n{}", "A".repeat(100 * 1024 * 1024 + 1024)); // 100MB + 1KB (just over the limit) + fs::write(temp_file.path(), &large_pdf_content).unwrap(); + drop(large_pdf_content); // Explicitly free memory let result = service .extract_text(temp_file.path().to_str().unwrap(), "application/pdf", &settings)