Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/infra/recipes/build_docs.py
5392 views
1
# Copyright 2022 The ChromiumOS Authors
2
# Use of this source code is governed by a BSD-style license that can be
3
# found in the LICENSE file.
4
5
from recipe_engine.post_process import Filter
6
7
DEPS = [
8
"crosvm",
9
"recipe_engine/file",
10
"recipe_engine/buildbucket",
11
"recipe_engine/context",
12
"recipe_engine/step",
13
"depot_tools/gsutil",
14
]
15
16
BOOK_URL = "gs://crosvm-dot-dev/book"
17
DOCS_URL = "gs://crosvm-dot-dev/doc"
18
19
20
def RunSteps(api):
21
"""
22
Builds crosvm mdbook and api docs, then uploads them to GCS.
23
24
This recipe requires ambient luci authentication. To test locally run:
25
$ luci-auth context ./infra/recipes.py run build_docs
26
"""
27
with api.crosvm.container_build_context():
28
api.crosvm.step_in_container(
29
"Build mdbook", ["mdbook", "build", "docs/book/", "--dest-dir", "../target"]
30
)
31
api.crosvm.step_in_container(
32
"Run cargo docs",
33
["./tools/cargo-doc", "--target-dir", "docs/target"],
34
)
35
36
api.gsutil(
37
["rsync", "-r", "-d", "./docs/target/html", BOOK_URL],
38
name="Upload book",
39
multithreaded=True,
40
)
41
# TODO(b/239255064): Generate the redirect HTML so we can use cleanly mirror here too.
42
api.gsutil(
43
["rsync", "-r", "./docs/target/doc", DOCS_URL],
44
name="Upload docs",
45
multithreaded=True,
46
)
47
48
49
def GenTests(api):
50
filter_steps = Filter(
51
"Build mdbook", "Run cargo docs", "gsutil Upload book", "gsutil Upload docs"
52
)
53
yield (
54
api.test(
55
"build_docs",
56
api.buildbucket.ci_build(project="crosvm/crosvm"),
57
)
58
+ api.post_process(filter_steps)
59
)
60
61