From 5719463d2db460e5cbbeb266512904dc1b475c2c Mon Sep 17 00:00:00 2001 From: Jake Awe <50372925+AyodeAwe@users.noreply.github.com> Date: Thu, 23 Feb 2023 09:12:50 -0600 Subject: [PATCH] Add docs build job (#12592) The PR adds a `docs_build` process to the PR and Build workflows for this repository. The generated docs are synced to s3 for only the build workflows. Authors: - Jake Awe (https://github.com/AyodeAwe) - AJ Schmidt (https://github.com/ajschmidt8) Approvers: - AJ Schmidt (https://github.com/ajschmidt8) - Bradley Dice (https://github.com/bdice) URL: https://github.com/rapidsai/cudf/pull/12592 --- .github/workflows/build.yaml | 11 +++++++++ .github/workflows/pr.yaml | 11 +++++++++ .gitignore | 3 +++ ci/build_docs.sh | 47 ++++++++++++++++++++++++++++++++++++ dependencies.yaml | 13 +++++++--- docs/cudf/source/conf.py | 6 ----- 6 files changed, 82 insertions(+), 9 deletions(-) create mode 100755 ci/build_docs.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index fa6704ef04e..024eb828e3c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -53,6 +53,17 @@ jobs: date: ${{ inputs.date }} sha: ${{ inputs.sha }} skip_upload_pkgs: libcudf-example + docs-build: + if: github.ref_type == 'branch' && github.event_name == 'push' + needs: python-build + secrets: inherit + uses: rapidsai/shared-action-workflows/.github/workflows/custom-job.yaml@branch-23.04 + with: + build_type: branch + node_type: "gpu-latest-1" + arch: "amd64" + container_image: "rapidsai/ci:latest" + run_script: "ci/build_docs.sh" wheel-build-cudf: secrets: inherit uses: rapidsai/shared-action-workflows/.github/workflows/wheels-manylinux-build.yml@branch-23.04 diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 73df2de20c2..952b58abda5 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -20,6 +20,7 @@ jobs: - conda-python-other-tests - conda-java-tests - conda-notebook-tests + - docs-build - wheel-build-cudf - wheel-tests-cudf - wheel-build-dask-cudf @@ -82,6 +83,16 @@ jobs: arch: "amd64" container_image: "rapidsai/ci:latest" run_script: "ci/test_notebooks.sh" + docs-build: + needs: conda-python-build + secrets: inherit + uses: rapidsai/shared-action-workflows/.github/workflows/custom-job.yaml@branch-23.04 + with: + build_type: pull-request + node_type: "gpu-latest-1" + arch: "amd64" + container_image: "rapidsai/ci:latest" + run_script: "ci/build_docs.sh" wheel-build-cudf: needs: checks secrets: inherit diff --git a/.gitignore b/.gitignore index 2d83aad7712..fb5c301fe3f 100644 --- a/.gitignore +++ b/.gitignore @@ -166,6 +166,9 @@ docs/cudf/source/api_docs/generated/* docs/cudf/source/api_docs/api/* docs/cudf/source/user_guide/example_output/* docs/cudf/source/user_guide/cudf.*Dtype.*.rst +_html +_text +jupyter_execute # cibuildwheel /wheelhouse diff --git a/ci/build_docs.sh b/ci/build_docs.sh new file mode 100755 index 00000000000..9551d98e9fe --- /dev/null +++ b/ci/build_docs.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Copyright (c) 2023, NVIDIA CORPORATION. + +set -euo pipefail + +rapids-logger "Create test conda environment" +. /opt/conda/etc/profile.d/conda.sh + +rapids-dependency-file-generator \ + --output conda \ + --file_key docs \ + --matrix "cuda=${RAPIDS_CUDA_VERSION%.*};arch=$(arch);py=${RAPIDS_PY_VERSION}" | tee env.yaml + +rapids-mamba-retry env create --force -f env.yaml -n docs +conda activate docs + +rapids-print-env + +rapids-logger "Downloading artifacts from previous jobs" +CPP_CHANNEL=$(rapids-download-conda-from-s3 cpp) +PYTHON_CHANNEL=$(rapids-download-conda-from-s3 python) +VERSION_NUMBER=$(rapids-get-rapids-version-from-git) + +rapids-mamba-retry install \ + --channel "${CPP_CHANNEL}" \ + --channel "${PYTHON_CHANNEL}" \ + libcudf cudf dask-cudf + + +rapids-logger "Build Doxygen docs" +pushd cpp/doxygen +aws s3 cp s3://rapidsai-docs/librmm/${VERSION_NUMBER}/html/rmm.tag . || echo "Failed to download rmm Doxygen tag" +doxygen Doxyfile +popd + +rapids-logger "Build Sphinx docs" +pushd docs/cudf +sphinx-build -b dirhtml source _html +sphinx-build -b text source _text +popd + + +if [[ ${RAPIDS_BUILD_TYPE} == "branch" ]]; then + aws s3 sync --delete cpp/doxygen/html "s3://rapidsai-docs/libcudf/${VERSION_NUMBER}/html" + aws s3 sync --delete docs/cudf/_html "s3://rapidsai-docs/cudf/${VERSION_NUMBER}/html" + aws s3 sync --delete docs/cudf/_text "s3://rapidsai-docs/cudf/${VERSION_NUMBER}/txt" +fi diff --git a/dependencies.yaml b/dependencies.yaml index de9795b4b39..ba6d240e069 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -9,7 +9,7 @@ files: - build - cudatoolkit - develop - - doc + - docs - notebooks - py_version - run @@ -43,6 +43,12 @@ files: includes: - develop - py_version + docs: + output: none + includes: + - cudatoolkit + - docs + - py_version channels: - rapidsai - rapidsai-nightly @@ -123,10 +129,11 @@ dependencies: - output_types: conda packages: - doxygen=1.8.20 # pre-commit hook needs a specific version. - doc: + docs: common: - - output_types: [conda, requirements] + - output_types: [conda] packages: + - doxygen=1.8.20 - myst-nb - nbsphinx - numpydoc diff --git a/docs/cudf/source/conf.py b/docs/cudf/source/conf.py index 371a8b4e1c1..3d92d955263 100644 --- a/docs/cudf/source/conf.py +++ b/docs/cudf/source/conf.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # Copyright (c) 2018-2023, NVIDIA CORPORATION. # # cudf documentation build configuration file, created by @@ -23,11 +22,6 @@ from docutils.nodes import Text from sphinx.addnodes import pending_xref -import cudf - -sys.path.insert(0, os.path.abspath(cudf.__path__[0])) -sys.path.insert(0, os.path.abspath(".")) -sys.path.insert(0, os.path.abspath("../..")) sys.path.append(os.path.abspath("./_ext")) # -- General configuration ------------------------------------------------