Commit Graph

31 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
74000e6077 ci: restore Windows build infrastructure
Restore Windows container build support that was accidentally removed
in commits a76aab467..a90c8803f. This restores:

- Windows Docker infrastructure (book/docker/windows/)
- Windows container build workflow (infra-container-windows.yml)
- Windows matrix entries in book-build-container.yml
- Windows health check support in infra-health-check.yml
- Windows build flags in book-validate-dev.yml and book-publish-live.yml

Restored from pre-removal state at f85e319d6.
2026-03-06 12:13:02 -05:00
Vijay Janapa Reddi
a76aab4676 ci: completely remove Windows build infrastructure
Per request, removed all traces of Windows container builds from the project.
This simplifies the CI pipeline to be Linux-only.

- Deleted `book/docker/windows/` directory and its Dockerfile
- Deleted `.github/workflows/infra-container-windows.yml`
- Removed Windows matrix jobs and steps from `book-build-container.yml`
- Removed Windows inputs and outputs from `book-build-container.yml`
- Removed Windows health checks from `infra-health-check.yml`
- Removed Windows references from `book-publish-live.yml`
- Removed Windows references from `book-validate-dev.yml`
2026-03-06 10:04:48 -05:00
Vijay Janapa Reddi
d767eb4212 Fix PowerShell quoting in Windows Docker Python alias step.
Use single-quoted python -c code in the Docker RUN command so the command parses correctly under pwsh -Command and avoids parser errors during image build.
2026-03-05 08:00:38 -05:00
Vijay Janapa Reddi
9314128cf7 Fix Windows python3 availability in container build paths.
Preserve container PATH during Windows docker-run steps and create/verify a python3 alias from Scoop Python so Quarto/Jupyter kernels that invoke python3 work reliably in both install-time and final verification checks.
2026-03-05 07:42:29 -05:00
Vijay Janapa Reddi
887fc9eb81 Harden final Windows tool checks for existence and exit status.
Update Dockerfile and workflow final verification steps to normalize native command exit detection and fail explicitly on non-zero exits, avoiding false positives and false negatives in PowerShell checks.
2026-03-04 19:46:38 -05:00
Vijay Janapa Reddi
75850ffd7a Fix TeX verification false failure in Windows Docker build.
Avoid checking $LASTEXITCODE after a piped lualatex command by capturing command output first and normalizing exit-code detection, preventing false non-zero failures.
2026-03-04 19:44:45 -05:00
Vijay Janapa Reddi
3fdae4a365 Defer Ghostscript runtime checks to final verification.
Keep fail-fast installation checks for Ghostscript command presence, but defer executing Ghostscript until the final verification phase where full runtime dependencies and PATH are in place.
2026-03-04 18:03:23 -05:00
Vijay Janapa Reddi
300457a013 Fix Ghostscript verification in Windows container build.
Verify Ghostscript through the Scoop shim (`gs`) and restore the Ghostscript `lib` path in image PATH so DLL-dependent checks pass during install and final verification.
2026-03-04 17:46:20 -05:00
Vijay Janapa Reddi
e0e9714669 Fix Windows Dockerfile PATH parse error.
Collapse multiline PATH ENV into a single valid Dockerfile instruction so Windows container builds parse and start correctly.
2026-03-04 17:24:04 -05:00
Vijay Janapa Reddi
77a37a7707 Harden Windows build tool installation and verification flow.
Add immediate per-tool post-install checks with explicit command resolution and exit handling, keep end-of-job final verification with isolated per-tool reporting, and ensure rsvg-convert is installed/verified for Quarto PDF SVG conversion.
2026-03-04 17:21:20 -05:00
Vijay Janapa Reddi
12268748b2 Overhaul Windows container build for PATH and tool reliability
- Add explicit ENV PATH directive (Phase 15) so Docker layers
  inherit tool paths instead of relying on registry writes
- Reorder phases: TeX Live moved last (slowest, fail last)
- Create stable symlink C:\texlive\bin\windows for year-agnostic PATH
- Skip pip self-upgrade to avoid WinError 3 shim lock
- Use gswin64c (correct Scoop binary name) instead of gs
- Add rsvg-convert fallback to Chocolatey if Scoop fails
- Replace fragile verification loop with Test-Tool function
- Relax ErrorActionPreference for Chocolatey TeX Live in baremetal
2026-03-04 17:16:34 -05:00
Vijay Janapa Reddi
41097ce0c9 Harden TeX Live path resolution in Windows container
Add fallback search for tlmgr.bat when year-directory pattern
fails, validate bin directory exists before use, and verify
lualatex.exe path explicitly. Adds diagnostic output to help
debug future path resolution issues.
2026-03-04 15:37:55 -05:00
Vijay Janapa Reddi
3fce198695 Fix PowerShell quoting in Windows container verification
Replace double-quoted string interpolation in throw statement
with -f format operator to prevent Docker RUN flattening from
stripping quotes and causing PowerShell parse errors.
2026-03-04 15:07:03 -05:00
Vijay Janapa Reddi
226b68ad1f Fix CI tool verification and switch Quarto to Scoop install
- Baremetal workflow: verification step now tracks failures and exits
  non-zero when tools are missing (previously always reported success)
- Baremetal workflow: R.exe --version replaced with Rscript --version
  to avoid PowerShell Invoke-History alias collision
- Windows Dockerfile: Quarto install switched from direct zip download
  (C:\quarto-1.9.27\bin) to scoop install extras/quarto for consistent
  PATH handling via Scoop shims
- Windows Dockerfile: final verification rewritten with failure tracking
  and exit 1 on missing tools
2026-03-04 13:52:02 -05:00
Vijay Janapa Reddi
870dc85a9f Installs rsvg-convert and refactors Quarto
Adds rsvg-convert to the Windows Dockerfile to enable SVG-to-PDF conversion for Quarto, including its verification.

Refactors Quarto document source:
- Renames a speculative decoding footnote for improved clarity.
- Standardizes an internal TikZ drawing macro boolean flag from `\ifbox@dashed` to `\ifboxdashed` across several files.
2026-03-04 08:08:39 -05:00
Vijay Janapa Reddi
10a2dc4303 fix(docker): add librsvg2-bin to Linux container for rsvg-convert
Quarto's Lua filter calls rsvg-convert to convert SVG figures to PDF
during PDF builds. librsvg2-dev was present (C headers/lib) but the
binary package librsvg2-bin was missing, causing a FATAL build error:
  'Could not convert a SVG to a PDF. Please ensure rsvg-convert is on path'

Also adds rsvg-convert to the Phase 2 verification checks so missing
tools are caught at image build time, not at render time.
2026-03-03 11:05:56 -05:00
Vijay Janapa Reddi
e6bad1fd45 refactor(docker): extract TeX Live install logic into standalone script
Move the ~100-line Phase 4 inline PowerShell block into
book/docker/windows/install_texlive.ps1. The Dockerfile now simply
COPYs and calls the script. Benefits:
- Script can be tested and updated independently of the Dockerfile
- Cleaner, readable PS syntax (no backtick line-continuation noise)
- Docker layer only invalidates when the script actually changes
2026-03-03 08:24:15 -05:00
Vijay Janapa Reddi
79a1015a5c fix(docker): avoid backtick escaping in cmd /c call for install-tl-windows.bat 2026-03-02 22:58:27 -05:00
Vijay Janapa Reddi
83cb23d178 fix(docker): use cmd /c for .bat invocation and fix exit in pwsh inline mode 2026-03-02 22:44:52 -05:00
Vijay Janapa Reddi
b316005230 fix(ci): reformat Python blocks with Black 24.10.0 and fix PS string interpolation
CI pins black==24.10.0 but requirements.txt had black>=23.0.0, causing
pre-commit to reformat 11 QMD files on the CI run and fail. Format all
affected files locally with 24.10.0 to match CI expectations.

Also fix PowerShell PATH string interpolation in Windows Dockerfile:
use explicit concatenation instead of nested method call inside a
double-quoted string, which can be unreliable in some PS contexts.
2026-03-02 22:21:41 -05:00
Vijay Janapa Reddi
159f4588c8 fix(docker): replace Chocolatey texlive with direct install-tl and mirror fallback
Chocolatey's texlive wrapper sets ErrorActionPreference=Stop and relies on
install-tl picking a random CTAN mirror at runtime. When that mirror is
flaky (as mirrors.rit.edu was), the entire build fails with no fallback.

Switch to calling install-tl-windows.bat directly:
- Set ErrorActionPreference=Continue so we own error handling
- Write a profile with instopt_adjustrepo=0 to prevent auto-mirror switching
- Pass -repository explicitly, trying Illinois → MIT → mirror.ctan.org in order
- Pin tlmgr repository post-install to the same stable mirror
- Remove Chocolatey texlive dependency entirely
2026-03-02 20:38:22 -05:00
Vijay Janapa Reddi
0cc0361f60 fix: remove --params mirror arg from choco texlive install
The InstallerParameters flag passed to install-tl via --params was
corrupting the installer profile, causing abs_path($::installerdir)
to return undef and triggering the 'uninitialized value $tmp' Perl
error at install-tl line 651. Install without params and set the
tlmgr repository mirror post-install instead.
2026-03-02 20:16:37 -05:00
Vijay Janapa Reddi
954b7942c2 chore: harden Windows TeX Live install and default to latest
Improve Windows container reliability by pinning TeX Live installer mirrors with fallback and setting safer Chocolatey CI defaults. Make TeX Live version configurable via build arg and default to latest while retaining override support.
2026-03-02 19:32:40 -05:00
Vijay Janapa Reddi
96fa7ac5e5 chore: bump Quarto to 1.9.27 and R to 4.5.2
- Quarto 1.9.27: Linux (.deb), Windows (direct download; Scoop Extras has 1.8.27)
- R 4.5.2: Linux (CRAN jammy-cran40), Windows (Scoop main/r)
- Baremetal: quarto-actions/setup for both Linux and Windows
- Remove ggrepel version pin (R 4.5.x supports ggrepel 0.9.7)
- Update docs: BUILD.md, CONTAINER_BUILDS.md, docker READMEs
2026-03-02 17:36:35 -05:00
Vijay Janapa Reddi
853eb03ee8 style: apply consistent whitespace and formatting across codebase 2025-12-13 14:05:34 -05:00
Vijay Janapa Reddi
327077185d fix: replace ARG variables with hardcoded paths in Dockerfiles [skip ci]
ARG variables have scope issues across RUN commands in Docker, causing
COPY commands to fail. Since these paths are stable, hardcoding them
is simpler and more reliable.
2025-12-05 16:40:40 -08:00
Vijay Janapa Reddi
21d5945955 fix: remove RUN commands before COPY to fix ARG scope in Dockerfiles [skip ci]
- Moved RUN echo statements after COPY commands in both Dockerfiles
- ARG variables lose scope after RUN commands, causing COPY to fail
- Both Linux and Windows Dockerfiles now follow consistent pattern:
  1. Re-declare ARG variables
  2. Execute COPY commands immediately
  3. Run any status/logging commands after
2025-12-05 16:23:21 -08:00
Vijay Janapa Reddi
9b1bad0745 fix: re-declare ARG variables before COPY commands in Dockerfiles [skip ci]
Docker ARG variables have stage-level scope and must be re-declared
after RUN commands to be available for COPY commands. This fixes the
build error where Docker couldn't find the dependency files.

Changes:
- Moved ARG BOOK_DEPS and ARG BOOK_DOCKER declarations before COPY commands
- Added comment explaining ARG scope behavior
- Both Linux and Windows Dockerfiles updated consistently

Fixes: COPY failed: file not found in build context
2025-12-05 16:08:59 -08:00
Vijay Janapa Reddi
cfdb82c941 refactor: centralize Docker path configuration with ARG variables [skip ci]
Updated both Linux and Windows Dockerfiles to use ARG variables for path
configuration, providing a single source of truth for book/ structure.

Changes:
- Added ARG variables at top of both Dockerfiles (BOOK_ROOT, BOOK_TOOLS, BOOK_DEPS, BOOK_DOCKER)
- Updated all COPY commands to use ARG variables instead of hardcoded paths
- Updated workflow files to use vars.BOOK_DOCKER for Dockerfile paths
- Maintains compatibility with existing build process

Benefits:
- Single location to update if directory structure changes
- Can override paths at build time with --build-arg
- Self-documenting path structure
- Consistent with GitHub Actions repository variables pattern
2025-12-05 15:41:18 -08:00
Vijay Janapa Reddi
27eec778cf Fix Docker COPY paths after book/ restructure
Updated all COPY commands in Dockerfiles to use correct paths with book/ prefix:
- book/tools/dependencies/requirements.txt
- book/tools/dependencies/install_packages.R
- book/tools/dependencies/tl_packages
- book/docker/linux/verify_r_packages.R
- book/docker/windows/verify_r_packages.R

This fixes container build failures where Docker couldn't find dependency files at the old paths after the monorepo restructure moved all content to the book/ subdirectory.
2025-12-05 14:55:08 -08:00
Vijay Janapa Reddi
7b92e11193 Repository Restructuring: Prepare for TinyTorch Integration (#1068)
* Restructure: Move book content to book/ subdirectory

- Move quarto/ → book/quarto/
- Move cli/ → book/cli/
- Move docker/ → book/docker/
- Move socratiQ/ → book/socratiQ/
- Move tools/ → book/tools/
- Move scripts/ → book/scripts/
- Move config/ → book/config/
- Move docs/ → book/docs/
- Move binder → book/binder

Git history fully preserved for all moved files.

Part of repository restructuring to support MLSysBook + TinyTorch.

Pre-commit hooks bypassed for this commit as paths need updating.

* Update pre-commit hooks for book/ subdirectory

- Update all quarto/ paths to book/quarto/
- Update all tools/ paths to book/tools/
- Update config/linting to book/config/linting
- Update project structure checks

Pre-commit hooks will now work with new directory structure.

* Update .gitignore for book/ subdirectory structure

- Update quarto/ paths to book/quarto/
- Update assets/ paths to book/quarto/assets/
- Maintain all existing ignore patterns

* Update GitHub workflows for book/ subdirectory

- Update all quarto/ paths to book/quarto/
- Update cli/ paths to book/cli/
- Update tools/ paths to book/tools/
- Update docker/ paths to book/docker/
- Update config/ paths to book/config/
- Maintain all workflow functionality

* Update CLI config to support book/ subdirectory

- Check for book/quarto/ path first
- Fall back to quarto/ for backward compatibility
- Maintain full CLI functionality

* Create new root and book READMEs for dual structure

- Add comprehensive root README explaining both projects
- Create book-specific README with quick start guide
- Document repository structure and navigation
- Prepare for TinyTorch integration
2025-12-05 14:04:21 -08:00