Lines Matching +full:build +full:- +full:docs
1 :::{default-domain} bzl
4 # Read the Docs integration
7 to build for, and deploy to, Read the Docs. It does this by having Bazel do
8 all the work of building, and then the outputs are copied to where Read the Docs
10 you have more certainty that the docs you generate locally will match what
11 is created in the Read the Docs build environment.
13 Setting this up is conceptually simple: make the Read the Docs build call `bazel
19 In order for Read the Docs to call our custom commands, we have to use the
20 advanced `build.commands` setting of the config file. This needs to do two key
29 `--@rules_python//sphinxdocs:extra_env` and
30 `--@rules_python//sphinxdocs:extra_defines` flags. These are used to communicate
33 ## BUILD config
35 In your build file, the {obj}`readthedocs_install` rule handles building the
36 docs and copying the output to the Read the Docs output directory
38 target (the generated docs).
44 However, because our yaml config uses the advanced `build.commands` feature,
45 those config injections are disabled and we have to manually re-enable them.
60 build:
61 os: "ubuntu-22.04"
65 - env
66 - npm install -g @bazel/bazelisk
67 - bazel version
70 - docs/readthedocs_build.sh
74 # File: docs/BUILD
79 docs = [":docs"],
84 # File: docs/readthedocs_build.sh
88 set -eou pipefail
90 declare -a extra_env
91 while IFS='=' read -r -d '' name value; do
93 extra_env+=("--@rules_python//sphinxdocs:extra_env=$name=$value")
95 done < <(env -0)
97 # In order to get the build number, we extract it from the host name
98 extra_env+=("--@rules_python//sphinxdocs:extra_env=HOSTNAME=$HOSTNAME")
100 set -x
102 --stamp \
103 "--@rules_python//sphinxdocs:extra_defines=version=$READTHEDOCS_VERSION" \
105 //docs:readthedocs_install
109 # File: docs/conf.py
126 # The build id isn't directly available, but it appears to be encoded
128 # to be `build-X-project-Y-Z`, where:
129 # * X is an integer build id
132 _build_id = os.environ.get("HOSTNAME", "build-0-project-0-rules-python")
133 _build_id = _build_id.split("-")[1]
135 f"https://readthedocs.org/projects/rules-python/builds/{_build_id}"