blob: 508a3631c95717b207cc231634ae258701b58a0a [file] [log] [blame]
# Copyright (C) 2025 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEPS = [
'recipe_engine/buildbucket',
'recipe_engine/step',
'recipe_engine/path',
'recipe_engine/context',
'depot_tools/bot_update',
'depot_tools/gclient',
]
PYTHON_VERSION_COMPATIBILITY = 'PY3'
def gclient_config(api):
"""Generate a gclient configuration to check out git-repohooks.
Return: (config) A gclient recipe module configuration.
"""
cfg = api.gclient.make_config()
soln = cfg.solutions.add()
soln.name = 'git-repohooks'
soln.url = 'https://gerrit.googlesource.com/git-repohooks'
soln.revision = 'HEAD'
return cfg
def RunSteps(api):
cl = api.buildbucket.build.input.gerrit_changes[0]
project_name = cl.project
assert project_name == 'git-repohooks', f'unknown project: "{project_name}"'
api.bot_update.ensure_checkout(gclient_config=gclient_config(api))
with api.context(cwd=api.path.start_dir / project_name, env={'LUCI_CQ': 'yes'}):
# TODO(b/266734831): Use tox to run tests.
api.step('Run tests', ['vpython3', 'run_tests', '-vv'])
def GenTests(api):
yield (api.test('basic') + api.buildbucket.try_build(project='git-repohooks'))