|
5 | 5 | branches:
|
6 | 6 | - main
|
7 | 7 | pull_request:
|
| 8 | + workflow_dispatch: |
8 | 9 |
|
9 | 10 | concurrency:
|
10 | 11 | group: docs-${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }}
|
11 | 12 | cancel-in-progress: true
|
12 | 13 |
|
13 | 14 | jobs:
|
14 |
| - build: |
15 |
| - name: Build Documentation |
16 |
| - runs-on: ubuntu-latest |
17 |
| - steps: |
18 |
| - - name: Checkout |
19 |
| - uses: actions/checkout@v4 |
20 |
| - with: |
21 |
| - fetch-depth: 0 |
22 |
| - submodules: recursive |
| 15 | + build-and-deploy: |
| 16 | + name: Build and Deploy Documentation |
| 17 | + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main |
| 18 | + with: |
| 19 | + timeout: 120 |
| 20 | + runner: linux.g5.4xlarge.nvidia.gpu |
| 21 | + gpu-arch-type: cuda |
| 22 | + gpu-arch-version: "12.6" |
| 23 | + submodules: recursive |
| 24 | + upload-artifact: docs |
| 25 | + script: | |
| 26 | + # Source common setup functions |
| 27 | + source scripts/common-setup.sh |
23 | 28 |
|
24 |
| - - name: Setup Python |
25 |
| - uses: actions/setup-python@v5 |
26 |
| - with: |
27 |
| - python-version: "3.10" |
28 |
| - architecture: x64 |
| 29 | + # Setup build environment (conda + system deps + rust + build deps) |
| 30 | + setup_build_environment |
29 | 31 |
|
30 |
| - - name: Setup Rust |
31 |
| - uses: dtolnay/rust-toolchain@nightly |
32 |
| - with: |
33 |
| - components: rustfmt, clippy |
34 |
| - |
35 |
| - - name: Install system dependencies |
36 |
| - run: | |
37 |
| - sudo apt-get update |
38 |
| - sudo apt-get install -y libunwind-dev |
39 |
| -
|
40 |
| - - name: Install Python dependencies |
41 |
| - run: | |
42 |
| - python -m pip install --upgrade pip |
43 |
| - pip install -r build-requirements.txt |
44 |
| - pip install -r docs/requirements.txt |
45 |
| -
|
46 |
| - - name: Generate Rust API Documentation |
47 |
| - run: | |
48 |
| - # Set environment variables for CPU-only build |
49 |
| - export USE_CUDA=0 |
50 |
| - export USE_TENSOR_ENGINE=0 |
51 |
| - export RUSTFLAGS="-Zthreads=16" |
52 |
| - export _GLIBCXX_USE_CXX11_ABI=1 |
53 |
| -
|
54 |
| - # Generate documentation for specific crates that don't depend on CUDA |
55 |
| - cargo doc --no-deps -p hyperactor -p hyperactor_macros -p hyperactor_multiprocess -p hyperactor_mesh -p hyperactor_mesh_macros |
56 |
| -
|
57 |
| - # Create an index.html file in the target/doc directory to serve as the main entry point |
58 |
| - echo '<meta http-equiv="refresh" content="0; url=hyperactor/index.html">' > target/doc/index.html |
59 |
| -
|
60 |
| - # Ensure the target/doc directory exists in the expected location for Sphinx |
61 |
| - mkdir -p docs/source/target |
62 |
| - cp -r target/doc docs/source/target/ |
63 |
| -
|
64 |
| - - name: Build Sphinx Docs |
65 |
| - working-directory: docs |
66 |
| - run: | |
67 |
| - make html |
| 32 | + # Setup Tensor Engine |
| 33 | + setup_tensor_engine |
68 | 34 |
|
69 |
| - - name: Upload Pages artifact |
70 |
| - uses: actions/upload-pages-artifact@v3 |
71 |
| - with: |
72 |
| - path: docs/build/html |
| 35 | + # Build the process allocator binary |
| 36 | + build_process_allocator |
| 37 | +
|
| 38 | + # Setup Python dependencies |
| 39 | + python -m pip install --upgrade pip |
| 40 | + pip install -r build-requirements.txt |
| 41 | + pip install -r docs/requirements.txt |
| 42 | +
|
| 43 | + # Install PyTorch with CUDA support (matching build-cuda.yml) |
| 44 | + pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu126 |
| 45 | +
|
| 46 | + # Set environment variables for CUDA build |
| 47 | + export USE_CUDA=1 |
| 48 | + export USE_TENSOR_ENGINE=1 |
| 49 | + export RUSTFLAGS="-Zthreads=16" |
| 50 | + export _GLIBCXX_USE_CXX11_ABI=1 |
| 51 | + export CUDA_LIB_DIR=/usr/lib64 |
| 52 | +
|
| 53 | + # Generate documentation for all workspace crates |
| 54 | + cargo doc --workspace --no-deps |
| 55 | +
|
| 56 | + # Prepare documentation structure for Sphinx and final output |
| 57 | + mkdir -p docs/source/target docs/build/html/rust-api |
| 58 | + cp -r target/doc docs/source/target/ |
| 59 | +
|
| 60 | + # Build Sphinx documentation |
| 61 | + cd docs && make html && cd .. |
| 62 | +
|
| 63 | + # Copy Rust API docs to final location |
| 64 | + cp -r target/doc/* docs/build/html/rust-api/ |
| 65 | +
|
| 66 | + # Copy documentation to artifact directory |
| 67 | + mkdir -p ${RUNNER_ARTIFACT_DIR} |
| 68 | + cp -r docs/build/html ${RUNNER_ARTIFACT_DIR}/docs-html |
73 | 69 |
|
74 | 70 | deploy:
|
75 |
| - needs: build |
| 71 | + needs: build-and-deploy |
76 | 72 | if: github.ref == 'refs/heads/main'
|
77 | 73 | permissions:
|
78 | 74 | pages: write
|
|
82 | 78 | url: ${{ steps.deployment.outputs.page_url }}
|
83 | 79 | runs-on: ubuntu-latest
|
84 | 80 | steps:
|
| 81 | + - name: Download build artifact |
| 82 | + uses: actions/download-artifact@v4 |
| 83 | + with: |
| 84 | + name: docs |
| 85 | + path: . |
| 86 | + |
| 87 | + - name: Upload Pages artifact |
| 88 | + uses: actions/upload-pages-artifact@v3 |
| 89 | + with: |
| 90 | + path: docs-html |
| 91 | + |
85 | 92 | - name: Deploy to GitHub Pages
|
86 | 93 | id: deployment
|
87 | 94 | uses: actions/deploy-pages@v4
|
0 commit comments