mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
12593ba642
The new builder will generate the mdbook and api docs, then uploads them to GCS. BUG=b:233411583 TEST=luci-auth context ./infra/recipes.py run build_docs Change-Id: Ia22cdb20d73f9268db6299cd6f0875950d174b3f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3751832 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
67 lines
2 KiB
Python
67 lines
2 KiB
Python
# Copyright 2022 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
from recipe_engine.post_process import Filter
|
|
|
|
PYTHON_VERSION_COMPATIBILITY = "PY3"
|
|
|
|
DEPS = [
|
|
"crosvm",
|
|
"recipe_engine/file",
|
|
"recipe_engine/buildbucket",
|
|
"recipe_engine/context",
|
|
"recipe_engine/step",
|
|
"depot_tools/gsutil",
|
|
]
|
|
|
|
BOOK_URL = "gs://crosvm-dot-dev/book"
|
|
DOCS_URL = "gs://crosvm-dot-dev/api"
|
|
|
|
|
|
def RunSteps(api):
|
|
"""
|
|
Builds crosvm mdbook and api docs, then uploads them to GCS.
|
|
|
|
This recipe requires ambient luci authentication. To test locally run:
|
|
$ luci-auth context ./infra/recipes.py run build_docs
|
|
"""
|
|
with api.crosvm.container_build_context():
|
|
api.crosvm.step_in_container(
|
|
"Build mdbook", ["mdbook", "build", "docs/book/", "--dest-dir", "../target"]
|
|
)
|
|
api.crosvm.step_in_container(
|
|
"Run cargo docs",
|
|
["./tools/cargo-doc", "--target-dir", "docs/target"],
|
|
)
|
|
|
|
# Container generated files are root-owned, we need to make sure they will be readable by
|
|
# gsutil (which has to run outside the container to run with proper authentication).
|
|
api.crosvm.step_in_container(
|
|
"Make docs readable by gsutil",
|
|
["chmod", "-R", "o+r", "docs/target"],
|
|
)
|
|
|
|
api.gsutil(
|
|
["rsync", "-r", "-d", "./docs/target/html", BOOK_URL],
|
|
name="Upload book",
|
|
multithreaded=True,
|
|
)
|
|
api.gsutil(
|
|
["rsync", "-r", "-d", "./docs/target/doc", DOCS_URL],
|
|
name="Upload docs",
|
|
multithreaded=True,
|
|
)
|
|
|
|
|
|
def GenTests(api):
|
|
filter_steps = Filter(
|
|
"Build mdbook", "Run cargo docs", "gsutil Upload book", "gsutil Upload docs"
|
|
)
|
|
yield (
|
|
api.test(
|
|
"build_docs",
|
|
api.buildbucket.ci_build(project="crosvm/crosvm"),
|
|
)
|
|
+ api.post_process(filter_steps)
|
|
)
|