[infra] Fix InfraTests recipe for other repos which use it

Change-Id: I7cd2163d316ed3b4575c7d3d05f6704c13cc46a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374258
Reviewed-by: Weston Tracey <westont@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
This commit is contained in:
Eric Boren 2021-02-23 11:53:55 -05:00
parent d1b6c37371
commit 3b31f68d2b
3 changed files with 141 additions and 6 deletions

View File

@ -360,7 +360,9 @@ Prepare the variables.
[DEPS](/infra/bots/recipes/infra.py#9): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step], [infra](#recipe_modules-infra), [vars](#recipe_modules-vars)
&mdash; **def [RunSteps](/infra/bots/recipes/infra.py#19)(api):**
&mdash; **def [RunSteps](/infra/bots/recipes/infra.py#27)(api):**
&mdash; **def [git\_init](/infra/bots/recipes/infra.py#19)(api, repo_root, env):**
### *recipes* / [infra:examples/full](/infra/bots/recipe_modules/infra/examples/full.py)
[DEPS](/infra/bots/recipe_modules/infra/examples/full.py#9): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/file][recipe_engine/recipe_modules/file], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/step][recipe_engine/recipe_modules/step], [infra](#recipe_modules-infra), [run](#recipe_modules-run), [vars](#recipe_modules-vars)

View File

@ -0,0 +1,119 @@
[
{
"cmd": [
"git",
"init"
],
"cwd": "[START_DIR]/lottie-ci",
"env": {
"CHROME_HEADLESS": "1",
"GOCACHE": "[START_DIR]/cache/go_cache",
"GOPATH": "[START_DIR]/cache/gopath",
"GOROOT": "[START_DIR]/go/go",
"PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "git init"
},
{
"cmd": [
"git",
"add",
"."
],
"cwd": "[START_DIR]/lottie-ci",
"env": {
"CHROME_HEADLESS": "1",
"GOCACHE": "[START_DIR]/cache/go_cache",
"GOPATH": "[START_DIR]/cache/gopath",
"GOROOT": "[START_DIR]/go/go",
"PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "git add ."
},
{
"cmd": [
"git",
"commit",
"-a",
"-m",
"initial commit"
],
"cwd": "[START_DIR]/lottie-ci",
"env": {
"CHROME_HEADLESS": "1",
"GOCACHE": "[START_DIR]/cache/go_cache",
"GOPATH": "[START_DIR]/cache/gopath",
"GOROOT": "[START_DIR]/go/go",
"PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "git commit"
},
{
"cmd": [
"git",
"init"
],
"cwd": "[START_DIR]/skia",
"env": {
"CHROME_HEADLESS": "1",
"GOCACHE": "[START_DIR]/cache/go_cache",
"GOPATH": "[START_DIR]/cache/gopath",
"GOROOT": "[START_DIR]/go/go",
"PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "git init (2)"
},
{
"cmd": [
"git",
"add",
"."
],
"cwd": "[START_DIR]/skia",
"env": {
"CHROME_HEADLESS": "1",
"GOCACHE": "[START_DIR]/cache/go_cache",
"GOPATH": "[START_DIR]/cache/gopath",
"GOROOT": "[START_DIR]/go/go",
"PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "git add . (2)"
},
{
"cmd": [
"git",
"commit",
"-a",
"-m",
"initial commit"
],
"cwd": "[START_DIR]/skia",
"env": {
"CHROME_HEADLESS": "1",
"GOCACHE": "[START_DIR]/cache/go_cache",
"GOPATH": "[START_DIR]/cache/gopath",
"GOROOT": "[START_DIR]/go/go",
"PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "git commit (2)"
},
{
"cmd": [
"python",
"-u",
"[START_DIR]/lottie-ci/infra/bots/infra_tests.py"
],
"cwd": "[START_DIR]/lottie-ci",
"env": {
"CHROME_HEADLESS": "1",
"GOCACHE": "[START_DIR]/cache/go_cache",
"GOPATH": "[START_DIR]/cache/gopath",
"GOROOT": "[START_DIR]/go/go",
"PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "infra_tests"
},
{
"name": "$result"
}
]

View File

@ -16,6 +16,14 @@ DEPS = [
]
def git_init(api, repo_root, env):
with api.context(cwd=repo_root, env=env):
# Some tests assume that they're being run inside a git repo.
api.step('git init', cmd=['git', 'init'])
api.step('git add .', cmd=['git', 'add', '.'])
api.step('git commit', cmd=['git', 'commit', '-a', '-m', 'initial commit'])
def RunSteps(api):
api.vars.setup()
@ -38,12 +46,11 @@ def RunSteps(api):
else:
env[k] = v
with api.context(cwd=repo_root, env=env):
# Some tests assume that they're being run inside a git repo.
api.step('git init', cmd=['git', 'init'])
api.step('git add .', cmd=['git', 'add', '.'])
api.step('git commit', cmd=['git', 'commit', '-a', '-m', 'initial commit'])
git_init(api, repo_root, env)
if repo_name != 'skia':
git_init(api, api.path['start_dir'].join('skia'), env)
with api.context(cwd=repo_root, env=env):
# Unfortunately, the recipe tests are flaky due to file removal on Windows.
# Run multiple attempts.
last_exc = None
@ -64,3 +71,10 @@ def GenTests(api):
path_config='kitchen',
swarm_out_dir='[SWARM_OUT_DIR]')
)
yield (
api.test('infra_tests_lottie_ci') +
api.properties(buildername='Housekeeper-PerCommit-InfraTests_Linux',
repository='https://skia.googlesource.com/lottie-ci.git',
path_config='kitchen',
swarm_out_dir='[SWARM_OUT_DIR]')
)