Repository navigation
Add skip_h2d_for_constants to keep constants in device memory (#24144) #95189
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build documentation | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - release/* | |
| tags: | |
| - v[0-9]+.[0-9]+.[0-9]+ | |
| - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| concurrency: | |
| group: docs-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| docker-image: | |
| name: Resolve CI docker image | |
| uses: ./.github/workflows/_docker-image.yml | |
| build: | |
| needs: docker-image | |
| uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main | |
| permissions: | |
| id-token: write | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| - build-tool: buck2 | |
| with: | |
| job-name: Build doc | |
| runner: mt-l-x86iavx512-8-64 | |
| docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-22.04-clang12-android-${{ needs.docker-image.outputs.ci-docker-hash }} | |
| submodules: 'recursive' | |
| repository: pytorch/executorch | |
| upload-artifact: docs | |
| timeout: 90 | |
| script: | | |
| # The generic Linux job chooses to use base env, not the one setup by the image | |
| CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]") | |
| conda activate "${CONDA_ENV}" | |
| BUILD_TOOL=${{ matrix.build-tool }} | |
| # Setup dependencies as there is no Docker support | |
| PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh --build-tool "${BUILD_TOOL}" | |
| if [[(${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then | |
| export CHANNEL=test | |
| else | |
| export CHANNEL=nightly | |
| fi | |
| # Set RELEASE environment variable for tagged releases | |
| GITHUB_REF=${{ github.ref }} | |
| if [[ "${GITHUB_REF}" =~ ^refs/tags/v[0-9]+\.[0-9]+ ]]; then | |
| export RELEASE=true | |
| echo "Building release docs (RELEASE=true)" | |
| else | |
| export RELEASE=false | |
| echo "Building main docs (RELEASE=false)" | |
| fi | |
| set -eux | |
| # clean up the ${RUNNER_DOCS_DIR} if exists: | |
| rm -rf "${RUNNER_DOCS_DIR}"/* | |
| # clean up the ${RUNNER_ARTIFACT_DIR} if exists: | |
| rm -rf "${RUNNER_ARTIFACT_DIR}"/* | |
| # Build docset: | |
| cd docs | |
| doxygen source/Doxyfile | |
| make html | |
| cd .. | |
| # Build javadoc: | |
| cd extension/android | |
| ANDROID_HOME="${ANDROID_SDK:-/opt/android/sdk}" ./gradlew :executorch_android:javaDocReleaseGeneration | |
| cp -rf executorch_android/build/intermediates/java_doc_dir/release/javaDocReleaseGeneration "${RUNNER_DOCS_DIR}/javadoc" | |
| cd ../.. | |
| # If it's main branch, add noindex tag to all .html files to exclude from Google Search indexing. | |
| echo "GitHub Ref: ${GITHUB_REF}" | |
| if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then | |
| find docs/_build/html/ -name "*.html" -print0 | xargs -0 sed -i '/<head>/a \ \ <meta name="robots" content="noindex">'; | |
| fi | |
| cp -rf docs/_build/html/* "${RUNNER_DOCS_DIR}" | |
| mv docs/_build/html "${RUNNER_ARTIFACT_DIR}" | |
| cp -rf "${RUNNER_DOCS_DIR}"/javadoc "${RUNNER_ARTIFACT_DIR}"/html | |
| ls -R "${RUNNER_ARTIFACT_DIR}"/*/*.html | |
| # linux_job_v3 uploads whatever is left in RUNNER_DOCS_DIR to the | |
| # doc-previews bucket on every pull request, and that upload | |
| # authenticates through OIDC. A fork PR has no OIDC token, so the step | |
| # fails with "Could not load credentials from any providers" and reds | |
| # the job after the docs have already built. Clear the directory so v3 | |
| # skips the upload -- a fork preview was never going to publish anyway. | |
| if [[ -n "${{ github.event.pull_request.number }}" && \ | |
| "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then | |
| echo "Fork PR: skipping the doc preview upload" | |
| rm -rf "${RUNNER_DOCS_DIR:?}"/* | |
| fi | |
| upload-gh-pages: | |
| needs: build | |
| if: github.repository == 'pytorch/executorch' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| permissions: | |
| id-token: write | |
| contents: write | |
| uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main | |
| secrets: inherit | |
| with: | |
| repository: pytorch/executorch | |
| download-artifact: docs | |
| ref: gh-pages | |
| # Publish on the host so actions/checkout's persisted credentials are | |
| # available to git push. | |
| timeout: 90 | |
| script: | | |
| set -euo pipefail | |
| # Get github.ref for the output doc folder. By default "main" | |
| # If matches a tag like refs/tags/v1.12.0-rc3 or | |
| # refs/tags/v1.12.0 convert to 1.12 | |
| export GITHUB_REF=${{ github.ref }} | |
| # Fail immediately instead of prompting for input. | |
| export GIT_TERMINAL_PROMPT=0 | |
| # Convert refs/tags/v1.12.0rc3 into 1.12. | |
| # Adopted from https://github.com/pytorch/pytorch/blob/main/.github/workflows/_docs.yml#L150C11-L155C13 | |
| if [[ "${GITHUB_REF}" =~ ^refs/tags/v([0-9]+\.[0-9]+) ]]; then | |
| TARGET_FOLDER="${BASH_REMATCH[1]}" | |
| else | |
| TARGET_FOLDER="main" | |
| fi | |
| echo "Target Folder: ${TARGET_FOLDER}" | |
| # Clean up target folder if exists and copy html output to the | |
| # Target folder | |
| if [ -d "${TARGET_FOLDER}" ]; then | |
| rm -rf "${TARGET_FOLDER}" | |
| fi | |
| mkdir -p "${TARGET_FOLDER}" | |
| mv "${RUNNER_ARTIFACT_DIR}"/html/* "${TARGET_FOLDER}" | |
| git add "${TARGET_FOLDER}" || true | |
| git config user.name 'pytorchbot' | |
| git config user.email 'soumith+bot@pytorch.org' | |
| git commit -m "Auto-generating sphinx docs" || true | |
| git push -f |