| # Copyright 2021 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """Recipe for building and publishing CTS artifacts. |
| |
| TODO(atyfto): Consider generalizing this recipe with prebuilt_host_tool.py. |
| """ |
| |
| from PB.recipes.fuchsia.cts_artifacts import InputProperties |
| |
| DEPS = [ |
| "fuchsia/build", |
| "fuchsia/buildbucket_util", |
| "fuchsia/checkout", |
| "fuchsia/upload", |
| "recipe_engine/buildbucket", |
| "recipe_engine/properties", |
| ] |
| |
| PROPERTIES = InputProperties |
| |
| |
| def RunSteps(api, props): |
| checkout = api.checkout.fuchsia_with_options( |
| manifest=props.manifest, remote=props.remote |
| ) |
| build_results = api.build.with_options( |
| checkout=checkout, fint_params_path=props.fint_params_path |
| ) |
| assert build_results.cts_artifacts |
| if api.buildbucket_util.is_tryjob or not props.cipd_package: |
| return |
| |
| revision = str(api.buildbucket.build.input.gitiles_commit.id) |
| assert revision |
| api.upload.cipd_package( |
| props.cipd_package, |
| build_results.build_dir, |
| [api.upload.FilePath(f) for f in build_results.cts_artifacts], |
| {"git_revision": revision}, |
| repository=props.remote, |
| step_name="upload cts artifacts to cipd", |
| ) |
| |
| |
| def GenTests(api): |
| properties = InputProperties( |
| manifest="flower", |
| remote="https://fuchsia.googlesource.com/integration", |
| cipd_package="fuchsia/cts/{platform}", |
| fint_params_path="cts-artifacts.textproto", |
| ) |
| |
| yield api.buildbucket_util.test("ci", repo="fuchsia") + api.properties(properties) |
| yield api.buildbucket_util.test("cq", tryjob=True, repo="fuchsia") + api.properties( |
| properties |
| ) |