-
Couldn't load subscription status.
- Fork 217
Set up a preliminary doc build/publish pipeline #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
db22412
cba26a0
f8f546b
8283401
eaf444a
9f91113
ca4febf
f03fb80
7b5a869
21b64b8
672b627
79477e6
fb060bf
953c1f8
c8424da
45218b8
645fc39
2482fe7
8200c9b
89748a5
a38077d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| build_ctk_ver: | ||
| type: string | ||
| required: true | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build docs | ||
| # The build stage could fail but we want the CI to keep moving. | ||
| if: ${{ github.repository_owner == 'nvidia' && always() }} | ||
| # WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327) | ||
| runs-on: linux-amd64-gpu-t4-latest-1-testing | ||
| #runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| shell: bash -el {0} | ||
| steps: | ||
| # WAR: Building the doc currently requires a GPU (NVIDIA/cuda-python#326,327) | ||
| - name: Ensure GPU is working | ||
| run: nvidia-smi | ||
|
|
||
| - name: Checkout ${{ github.event.repository.name }} | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| # TODO: cache conda env to speed up the workflow once conda-incubator/setup-miniconda#267 | ||
| # is resolved | ||
|
|
||
| - name: Set up miniforge | ||
| uses: conda-incubator/setup-miniconda@v3 | ||
| with: | ||
| activate-environment: cuda-python-docs | ||
| environment-file: ./cuda_python/docs/environment-docs.yml | ||
| miniforge-version: latest | ||
| conda-remove-defaults: "true" | ||
| python-version: 3.12 | ||
|
|
||
| - name: Check conda env | ||
| run: | | ||
| conda info | ||
| conda list | ||
| conda config --show-sources | ||
| conda config --show | ||
| # WAR: Building the doc currently requires CTK installed (NVIDIA/cuda-python#326,327) | ||
| - name: Set up mini CTK | ||
| uses: ./.github/actions/fetch_ctk | ||
| continue-on-error: false | ||
| with: | ||
| host-platform: linux-64 | ||
| cuda-version: ${{ inputs.build_ctk_ver }} | ||
|
|
||
| - name: Set environment variables | ||
| run: | | ||
| PYTHON_VERSION_FORMATTED="312" # see above | ||
| REPO_DIR=$(pwd) | ||
| # make outputs from the previous job as env vars | ||
| echo "CUDA_CORE_ARTIFACT_NAME=cuda-core-python${PYTHON_VERSION_FORMATTED}-linux-64-${{ github.sha }}" >> $GITHUB_ENV | ||
| echo "CUDA_CORE_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_core/dist")" >> $GITHUB_ENV | ||
| echo "CUDA_BINDINGS_ARTIFACT_NAME=cuda-bindings-python${PYTHON_VERSION_FORMATTED}-cuda${{ inputs.build_ctk_ver }}-linux-64-${{ github.sha }}" >> $GITHUB_ENV | ||
| echo "CUDA_BINDINGS_ARTIFACTS_DIR=$(realpath "$REPO_DIR/cuda_bindings/dist")" >> $GITHUB_ENV | ||
| - name: Download cuda.bindings build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ env.CUDA_BINDINGS_ARTIFACT_NAME }} | ||
| path: ${{ env.CUDA_BINDINGS_ARTIFACTS_DIR }} | ||
|
|
||
| - name: Display structure of downloaded cuda.bindings artifacts | ||
| run: | | ||
| pwd | ||
| ls -lahR $CUDA_BINDINGS_ARTIFACTS_DIR | ||
| - name: Download cuda.core build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ env.CUDA_CORE_ARTIFACT_NAME }} | ||
| path: ${{ env.CUDA_CORE_ARTIFACTS_DIR }} | ||
|
|
||
| - name: Display structure of downloaded cuda.core build artifacts | ||
| run: | | ||
| pwd | ||
| ls -lahR $CUDA_CORE_ARTIFACTS_DIR | ||
| - name: Install all packages | ||
| run: | | ||
| pushd "${CUDA_BINDINGS_ARTIFACTS_DIR}" | ||
| pip install *.whl | ||
| popd | ||
| pushd "${CUDA_CORE_ARTIFACTS_DIR}" | ||
| pip install *.whl | ||
| popd | ||
| - name: Build all (latest) docs | ||
| id: build | ||
| run: | | ||
| pushd cuda_python/docs/ | ||
| ./build_all_docs.sh latest-only | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: This workflow currently only builds the "latest" docs; those with release versions (ex: cuda.bindings 12.6.2) need a separate step that we should add in another PR (once we figure out the release workflow). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the logic should be as simple as (I could be wrong!)
|
||
| ls -l build | ||
| popd | ||
| mkdir -p artifacts/docs | ||
| mv cuda_python/docs/build/html/* artifacts/docs/ | ||
| # Note: currently this is only for manual inspection. This step will become | ||
| # required once we switch to use GHA for doc deployment (see the bottom). | ||
| - name: Upload doc artifacts | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: artifacts/ | ||
| retention-days: 3 | ||
|
|
||
| # The steps below are not executed unless when building on main. | ||
leofang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: Configure git | ||
| if: ${{ github.ref_name == 'main' }} | ||
| run: | | ||
| git config --local user.email "[email protected]" | ||
| git config --local user.name "cuda-python-bot" | ||
| - name: Checkout the gh-pages branch | ||
| if: ${{ github.ref_name == 'main' }} | ||
| run: | | ||
| git fetch origin gh-pages | ||
| git checkout gh-pages | ||
| - name: Move artifacts to doc root | ||
| if: ${{ github.ref_name == 'main' }} | ||
| run: | | ||
| mv artifacts/docs/* docs/ | ||
| git status | ||
| - name: Commit changes | ||
| if: ${{ github.ref_name == 'main' }} | ||
| run: | | ||
| git add docs/ | ||
| git status | ||
| git commit -m "Deploy: ${{ github.sha }}" | ||
| continue-on-error: true | ||
|
|
||
| - name: Push changes | ||
| if: ${{ github.ref_name == 'main' && success() }} | ||
| run: | | ||
| git push origin gh-pages | ||
| # TODO: discuss if we want to abandon branch-based doc deployment | ||
| # deploy: | ||
| # # Only deploy the latest docs when building on main | ||
| # if: ${{ github.ref_name == 'main' }} | ||
| # environment: | ||
| # name: github-pages | ||
| # url: ${{ steps.deployment.outputs.page_url }} | ||
| # runs-on: ubuntu-latest | ||
| # needs: build | ||
| # steps: | ||
| # - name: Deploy to GitHub Pages | ||
| # id: deployment | ||
| # uses: actions/deploy-pages@v4 | ||
Uh oh!
There was an error while loading. Please reload this page.