|
| 1 | +name: "CI: Build and update docs" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + build_ctk_ver: |
| 7 | + type: string |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build docs |
| 13 | + # The build stage could fail but we want the CI to keep moving. |
| 14 | + if: ${{ github.repository_owner == 'nvidia' && always() }} |
| 15 | + # WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327) |
| 16 | + runs-on: linux-amd64-gpu-t4-latest-1-testing |
| 17 | + #runs-on: ubuntu-latest |
| 18 | + defaults: |
| 19 | + run: |
| 20 | + shell: bash -el {0} |
| 21 | + steps: |
| 22 | + # WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327) |
| 23 | + - name: Ensure GPU is working |
| 24 | + run: nvidia-smi |
| 25 | + |
| 26 | + - name: Checkout ${{ github.event.repository.name }} |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + # TODO: cache conda env to speed up the workflow once conda-incubator/setup-miniconda#267 |
| 32 | + # is resolved |
| 33 | + |
| 34 | + - name: Set up miniforge |
| 35 | + uses: conda-incubator/setup-miniconda@v3 |
| 36 | + with: |
| 37 | + activate-environment: cuda-python-docs |
| 38 | + environment-file: ./cuda_python/docs/environment-docs.yml |
| 39 | + miniforge-version: latest |
| 40 | + conda-remove-defaults: "true" |
| 41 | + python-version: 3.12 |
| 42 | + |
| 43 | + - name: Check conda env |
| 44 | + run: | |
| 45 | + conda info |
| 46 | + conda list |
| 47 | + conda config --show-sources |
| 48 | + conda config --show |
| 49 | +
|
| 50 | + # WAR: Building the doc currently requires CTK installed (NVIDIA/cuda-python#326,327) |
| 51 | + - name: Set up mini CTK |
| 52 | + uses: ./.github/actions/fetch_ctk |
| 53 | + continue-on-error: false |
| 54 | + with: |
| 55 | + host-platform: linux-64 |
| 56 | + cuda-version: ${{ inputs.build_ctk_ver }} |
| 57 | + |
| 58 | + - name: Set environment variables |
| 59 | + run: | |
| 60 | + PYTHON_VERSION_FORMATTED="312" # see above |
| 61 | + REPO_DIR=$(pwd) |
| 62 | +
|
| 63 | + # make outputs from the previous job as env vars |
| 64 | + echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64-${{ github.sha }}" >> $GITHUB_ENV |
| 65 | + echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV |
| 66 | + echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.build_ctk_ver }}-linux-64-${{ github.sha }}" >> $GITHUB_ENV |
| 67 | + echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV |
| 68 | +
|
| 69 | + - name: Download cuda.bindings build artifacts |
| 70 | + uses: actions/download-artifact@v4 |
| 71 | + with: |
| 72 | + name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} |
| 73 | + path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} |
| 74 | + |
| 75 | + - name: Display structure of downloaded cuda.bindings artifacts |
| 76 | + run: | |
| 77 | + pwd |
| 78 | + ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR |
| 79 | +
|
| 80 | + - name: Download cuda.core build artifacts |
| 81 | + uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} |
| 84 | + path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} |
| 85 | + |
| 86 | + - name: Display structure of downloaded cuda.core build artifacts |
| 87 | + run: | |
| 88 | + pwd |
| 89 | + ls -lahR $CUDA_CORE_ARTIFACTS_DIR |
| 90 | +
|
| 91 | + - name: Install all packages |
| 92 | + run: | |
| 93 | + pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}" |
| 94 | + pip install *.whl |
| 95 | + popd |
| 96 | +
|
| 97 | + pushd "${CUDA_CORE_ARTIFACTS_DIR}" |
| 98 | + pip install *.whl |
| 99 | + popd |
| 100 | +
|
| 101 | + - name: Build all (latest) docs |
| 102 | + id: build |
| 103 | + run: | |
| 104 | + pushd cuda_python/docs/ |
| 105 | + ./build_all_docs.sh latest-only |
| 106 | + ls -l build |
| 107 | + popd |
| 108 | +
|
| 109 | + mkdir -p artifacts/docs |
| 110 | + mv cuda_python/docs/build/html/* artifacts/docs/ |
| 111 | +
|
| 112 | + # Note: currently this is only for manual inspection. This step will become |
| 113 | + # required once we switch to use GHA for doc deployment (see the bottom). |
| 114 | + - name: Upload doc artifacts |
| 115 | + uses: actions/upload-pages-artifact@v3 |
| 116 | + with: |
| 117 | + path: artifacts/ |
| 118 | + retention-days: 3 |
| 119 | + |
| 120 | + # The step below is not executed unless when building on main. |
| 121 | + - name: Deploy doc update |
| 122 | + if: ${{ github.ref_name == 'main' && success() }} |
| 123 | + uses: JamesIves/github-pages-deploy-action@v4 |
| 124 | + with: |
| 125 | + folder: artifacts/docs/ |
| 126 | + git-config-name: cuda-python-bot |
| 127 | + target-folder: docs/ |
| 128 | + commit-message: "Deploy latest docs: ${{ github.sha }}" |
| 129 | + clean: false |
0 commit comments