fix: remove remaining windows outputs from book-build-container.yml #88
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 'π§ Infra Β· β€οΈ Health Check' | ||
|
Check failure on line 1 in .github/workflows/infra-health-check.yml
|
||
| # Comprehensive health validation for build containers | ||
| # Tests essential Quarto build tools and functionality | ||
| # Runs daily to ensure container reliability | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| container_registry: | ||
| description: 'Container registry URL' | ||
| required: false | ||
| default: 'ghcr.io' | ||
| type: string | ||
| container_tag: | ||
| description: 'Container tag to test' | ||
| required: false | ||
| default: 'latest' | ||
| type: string | ||
| test_linux: | ||
| description: 'Test Linux container' | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| test_windows: | ||
| description: 'Test Windows container' | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| workflow_call: | ||
| inputs: | ||
| container_registry: | ||
| description: 'Container registry URL' | ||
| required: false | ||
| default: 'ghcr.io' | ||
| type: string | ||
| container_tag: | ||
| description: 'Container tag to test' | ||
| required: false | ||
| default: 'latest' | ||
| type: string | ||
| test_linux: | ||
| description: 'Test Linux container' | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| test_windows: | ||
| description: 'Test Windows container' | ||
| required: false | ||
| default: true | ||
| type: boolean | ||
| schedule: | ||
| # Run daily at 2 AM UTC | ||
| - cron: '0 2 * * *' | ||
| # Centralized Container Configuration - Single Source of Truth | ||
| env: | ||
| # ========================================================================== | ||
| # PATH CONFIGURATION - Uses GitHub Repository Variables (Settings > Variables) | ||
| # ========================================================================== | ||
| # MLSysBook content lives under book/ to accommodate TinyTorch at root | ||
| # Use ${{ vars.BOOK_ROOT }}, ${{ vars.BOOK_DOCKER }}, etc. in workflow steps | ||
| # Variables: BOOK_ROOT, BOOK_DOCKER, BOOK_TOOLS, BOOK_QUARTO, BOOK_DEPS | ||
| # Registry Configuration | ||
| REGISTRY: ${{ inputs.container_registry || 'ghcr.io' }} | ||
| CONTAINER_TAG: ${{ inputs.container_tag || 'latest' }} | ||
| LINUX_CONTAINER_NAME: 'quarto-linux' | ||
| # Computed full image names | ||
| LINUX_IMAGE: ${{ inputs.container_registry || 'ghcr.io' }}/${{ github.repository }}/quarto-linux:${{ inputs.container_tag || 'latest' }} | ||
| jobs: | ||
| # Matrix strategy for both container platforms | ||
| container-health-check: | ||
| runs-on: ${{ matrix.os }} | ||
| if: github.repository_owner == 'harvard-edge' | ||
| timeout-minutes: 60 | ||
| strategy: | ||
| fail-fast: false # Test both containers even if one fails | ||
| matrix: | ||
| include: | ||
| - os: ubuntu-latest | ||
| platform: linux | ||
| container_name: quarto-linux | ||
| shell: bash | ||
| env: | ||
| CONTAINER_IMAGE: ${{ inputs.container_registry || 'ghcr.io' }}/${{ github.repository }}/${{ matrix.container_name }}:${{ inputs.container_tag || 'latest' }} | ||
| PLATFORM: ${{ matrix.platform }} | ||
| # Using vars.BOOK_DOCKER (repository variable) - works in all contexts | ||
| DOCKERFILE_PATH: ./${{ vars.BOOK_DOCKER }}/${{ matrix.platform }}/Dockerfile | ||
| steps: | ||
| - name: π₯ Checkout repository | ||
| if: | | ||
| (matrix.platform == 'linux' && inputs.test_linux != false) || | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: π Log in to GitHub Container Registry | ||
| if: | | ||
| (matrix.platform == 'linux' && inputs.test_linux != false) || | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: π³ Pull Docker Image | ||
| if: | | ||
| (matrix.platform == 'linux' && inputs.test_linux != false) || | ||
| run: docker pull ${{ env.CONTAINER_IMAGE }} | ||
| - name: π Container Information | ||
| if: | | ||
| (matrix.platform == 'linux' && inputs.test_linux != false) || | ||
| run: | | ||
| echo "π === CONTAINER INFORMATION ===" | ||
| echo "π Platform: ${{ matrix.platform }}" | ||
| echo "π Image: ${{ env.CONTAINER_IMAGE }}" | ||
| echo "π Container Details:" | ||
| docker images ${{ env.CONTAINER_IMAGE }} --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}\t{{.CreatedAt}}" | ||
| echo "" | ||
| echo "π Container Size Analysis:" | ||
| docker images ${{ env.CONTAINER_IMAGE }} --format "{{.Size}}" | ||
| - name: π§ Linux Container - Tool Version Check | ||
| if: matrix.platform == 'linux' && inputs.test_linux != false | ||
| run: | | ||
| echo "π§ === LINUX CONTAINER TOOL VERSIONS ===" | ||
| echo "π Testing Linux tools with version capture:" | ||
| echo "============================================" | ||
| docker run --rm ${{ env.CONTAINER_IMAGE }} bash -c " | ||
| echo 'π === LINUX CONTAINER TOOL VERSIONS ===' | ||
| echo '' | ||
| echo 'π QUARTO:' | ||
| echo '----------' | ||
| if command -v quarto >/dev/null 2>&1; then | ||
| echo 'π Location: $(which quarto)' | ||
| echo 'π Version: $(quarto --version 2>&1 | head -1)' | ||
| echo 'β Status: OK' | ||
| else | ||
| echo 'β Status: NOT FOUND' | ||
| fi | ||
| echo '' | ||
| echo 'π PYTHON:' | ||
| echo '-----------' | ||
| if command -v python3 >/dev/null 2>&1; then | ||
| echo 'π Location: $(which python3)' | ||
| echo 'π Version: $(python3 --version 2>&1)' | ||
| echo 'β Status: OK' | ||
| else | ||
| echo 'β Status: NOT FOUND' | ||
| fi | ||
| echo '' | ||
| echo 'π R:' | ||
| echo '------' | ||
| if command -v R >/dev/null 2>&1; then | ||
| echo 'π Location: $(which R)' | ||
| echo 'π Version: $(R --version 2>&1 | head -1)' | ||
| echo 'β Status: OK' | ||
| else | ||
| echo 'β Status: NOT FOUND' | ||
| fi | ||
| echo '' | ||
| echo 'π LUALATEX:' | ||
| echo '------------' | ||
| if command -v lualatex >/dev/null 2>&1; then | ||
| echo 'π Location: $(which lualatex)' | ||
| echo 'π Version: $(lualatex --version 2>&1 | head -1)' | ||
| echo 'β Status: OK' | ||
| else | ||
| echo 'β Status: NOT FOUND' | ||
| fi | ||
| echo '' | ||
| echo 'π GHOSTSCRIPT:' | ||
| echo '---------------' | ||
| if command -v gs >/dev/null 2>&1; then | ||
| echo 'π Location: $(which gs)' | ||
| echo 'π Version: $(gs --version 2>&1)' | ||
| echo 'β Status: OK' | ||
| else | ||
| echo 'β Status: NOT FOUND' | ||
| fi | ||
| echo '' | ||
| echo 'π INKSCAPE:' | ||
| echo '------------' | ||
| if command -v inkscape >/dev/null 2>&1; then | ||
| echo 'π Location: $(which inkscape)' | ||
| echo 'π Version: $(inkscape --version 2>&1 | head -1)' | ||
| echo 'β Status: OK' | ||
| else | ||
| echo 'β Status: NOT FOUND' | ||
| fi | ||
| echo '' | ||
| echo 'π― === LINUX TOOL CHECK COMPLETE ===' | ||
| echo '' | ||
| # Summary of all tool statuses | ||
| echo 'π LINUX TOOL STATUS SUMMARY:' | ||
| echo '==============================' | ||
| # Check each tool and show status | ||
| if command -v quarto >/dev/null 2>&1; then | ||
| echo 'β Quarto: AVAILABLE' | ||
| else | ||
| echo 'β Quarto: MISSING' | ||
| fi | ||
| if command -v python3 >/dev/null 2>&1; then | ||
| echo 'β Python: AVAILABLE' | ||
| else | ||
| echo 'β Python: MISSING' | ||
| fi | ||
| if command -v R >/dev/null 2>&1; then | ||
| echo 'β R: AVAILABLE' | ||
| else | ||
| echo 'β R: MISSING' | ||
| fi | ||
| if command -v lualatex >/dev/null 2>&1; then | ||
| echo 'β LuaLaTeX: AVAILABLE' | ||
| else | ||
| echo 'β LuaLaTeX: MISSING' | ||
| fi | ||
| if command -v gs >/dev/null 2>&1; then | ||
| echo 'β Ghostscript: AVAILABLE' | ||
| else | ||
| echo 'β Ghostscript: MISSING' | ||
| fi | ||
| if command -v inkscape >/dev/null 2>&1; then | ||
| echo 'β Inkscape: AVAILABLE' | ||
| else | ||
| echo 'β Inkscape: MISSING' | ||
| fi | ||
| echo '' | ||
| # Check if any tools are missing and fail if so | ||
| FAILED_TOOLS=0 | ||
| if ! command -v quarto >/dev/null 2>&1; then | ||
| FAILED_TOOLS=$((FAILED_TOOLS + 1)) | ||
| fi | ||
| if ! command -v python3 >/dev/null 2>&1; then | ||
| FAILED_TOOLS=$((FAILED_TOOLS + 1)) | ||
| fi | ||
| if ! command -v R >/dev/null 2>&1; then | ||
| FAILED_TOOLS=$((FAILED_TOOLS + 1)) | ||
| fi | ||
| if ! command -v lualatex >/dev/null 2>&1; then | ||
| FAILED_TOOLS=$((FAILED_TOOLS + 1)) | ||
| fi | ||
| if ! command -v gs >/dev/null 2>&1; then | ||
| FAILED_TOOLS=$((FAILED_TOOLS + 1)) | ||
| fi | ||
| if ! command -v inkscape >/dev/null 2>&1; then | ||
| FAILED_TOOLS=$((FAILED_TOOLS + 1)) | ||
| fi | ||
| if [ $FAILED_TOOLS -eq 0 ]; then | ||
| echo 'π― β Linux container tool validation: PASSED' | ||
| echo 'All essential Quarto build tools are available!' | ||
| else | ||
| echo \"π― β Linux container tool validation: FAILED\" | ||
| echo \"$FAILED_TOOLS essential tool(s) are missing!\" | ||
| echo 'This container is NOT ready for Quarto builds.' | ||
| exit 1 | ||
| fi | ||
| " | tee linux-tool-versions.log | ||
| echo "π Linux tool versions saved to linux-tool-versions.log" | ||
| - name: π§ Linux Container - Quarto Check | ||
| if: matrix.platform == 'linux' && inputs.test_linux != false | ||
| continue-on-error: true # Don't fail workflow if quarto check fails | ||
| run: | | ||
| echo "π§ === LINUX QUARTO CHECK (COMPREHENSIVE) ===" | ||
| echo "π Running quarto check to validate full installation:" | ||
| echo "====================================================" | ||
| docker run --rm ${{ env.CONTAINER_IMAGE }} bash -c " | ||
| echo 'π Running quarto check with enhanced raw output capture...' | ||
| echo 'π Capturing full output for debugging...' | ||
| echo '' | ||
| # Set maximum verbosity for raw output | ||
| export QUARTO_LOG_LEVEL=DEBUG | ||
| export QUARTO_PRINT_STACK=true | ||
| echo 'β° Quarto check started at:' \$(date '+%Y-%m-%d %H:%M:%S') | ||
| echo '--- RAW QUARTO CHECK OUTPUT START ---' | ||
| echo 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ' | ||
| # Capture and display raw output with error handling | ||
| if quarto check 2>&1 | while IFS= read -r line; do echo \"β \$line\"; done; then | ||
| QUARTO_EXIT_CODE=0 | ||
| else | ||
| QUARTO_EXIT_CODE=\$? | ||
| fi | ||
| echo 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ' | ||
| echo '--- RAW QUARTO CHECK OUTPUT END ---' | ||
| echo 'β° Quarto check completed at:' \$(date '+%Y-%m-%d %H:%M:%S') | ||
| echo '' | ||
| # Determine final status | ||
| if [ \$QUARTO_EXIT_CODE -eq 0 ]; then | ||
| echo '' | ||
| echo 'β Quarto check: PASSED - All components verified!' | ||
| QUARTO_STATUS='PASSED' | ||
| else | ||
| echo '' | ||
| echo 'β Quarto check: FAILED - Issues detected!' | ||
| echo 'π This indicates potential container configuration issues.' | ||
| echo 'π Check the full output above for specific error details.' | ||
| QUARTO_STATUS='FAILED' | ||
| fi | ||
| echo '' | ||
| echo \"π QUARTO CHECK SUMMARY: \$QUARTO_STATUS\" | ||
| " | tee linux-quarto-check.log | ||
| echo "π Linux quarto check results saved to linux-quarto-check.log" | ||
| # Also extract just the raw quarto check output for easy viewing | ||
| if [ -f "linux-quarto-check.log" ]; then | ||
| echo "π Extracting raw Quarto output..." | ||
| grep -A 1000 "RAW QUARTO CHECK OUTPUT START" linux-quarto-check.log | \ | ||
| grep -B 1000 "RAW QUARTO CHECK OUTPUT END" | \ | ||
| sed '1d;$d' > linux-quarto-raw-output.txt || echo "Could not extract raw output" | ||
| if [ -f "linux-quarto-raw-output.txt" ]; then | ||
| echo "π Raw Quarto output extracted to linux-quarto-raw-output.txt" | ||
| echo "π Raw output preview (first 10 lines):" | ||
| head -10 linux-quarto-raw-output.txt | sed 's/^/ /' | ||
| fi | ||
| fi | ||
| } | ||
| } | ||
| - name: π Linux Container Analysis | ||
| if: matrix.platform == 'linux' && inputs.test_linux != false | ||
| run: | | ||
| echo "LINUX CONTAINER TEST SUMMARY" | ||
| echo "β Container pulled successfully" | ||
| echo "β Essential tools validated with pass/fail status (Quarto, Python, R, LaTeX, Ghostscript, Inkscape)" | ||
| echo "β Quarto check completed" | ||
| echo "β Container size displayed" | ||
| echo "β Tool validation enforced - will FAIL if any essential tool missing" | ||
| echo "LINUX CONTAINER TESTS COMPLETE" | ||
| - name: π€ Upload Test Artifacts | ||
| if: always() && matrix.platform == 'linux' && inputs.test_linux != false | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: ${{ matrix.platform }}-container-test-results | ||
| path: | | ||
| linux-tool-versions.log | ||
| linux-quarto-check.log | ||
| linux-quarto-raw-output.txt | ||
| if-no-files-found: warn | ||
| # Final summary job | ||
| final-summary: | ||
| needs: container-health-check | ||
| runs-on: ubuntu-latest | ||
| if: always() # Always run to provide summary | ||
| steps: | ||
| - name: π― Final Container Health Summary | ||
| run: | | ||
| echo "π― === FINAL CONTAINER HEALTH SUMMARY ===" | ||
| echo "==========================================" | ||
| echo "" | ||
| # Get container sizes | ||
| LINUX_IMAGE="${{ inputs.container_registry || 'ghcr.io' }}/${{ github.repository }}/quarto-linux:${{ inputs.container_tag || 'latest' }}" | ||
| LINUX_SIZE=$(docker images "$LINUX_IMAGE" --format "{{.Size}}" 2>/dev/null || echo "Not available") | ||
| echo "π¦ CONTAINER SIZES:" | ||
| echo "------------------" | ||
| echo "π§ Linux: $LINUX_SIZE" | ||
| echo "" | ||
| echo "π TEST RESULTS:" | ||
| echo "---------------" | ||
| echo "β Container health checks completed" | ||
| echo "β All test artifacts uploaded" | ||
| echo "" | ||
| echo "π― FINAL STATUS:" | ||
| echo "---------------" | ||
| echo "π’ CONTAINER TESTING: COMPLETED SUCCESSFULLY β " | ||
| echo "π Containers validated and ready for production use" | ||
| echo "π Detailed logs available in artifacts" | ||
| echo "========================================" | ||