enable web integraion test on LUCI
Change-Id: I7137ddb8d07514b0d8ef108be642b4303d41db0c
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/6860
Commit-Queue: Nurhan Turgut <nurhan@google.com>
Reviewed-by: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipes/engine/web_engine_framework.expected/linux-pre-submit.json b/recipes/engine/web_engine_framework.expected/linux-pre-submit.json
index 8ae5e00..0a2ab26 100644
--- a/recipes/engine/web_engine_framework.expected/linux-pre-submit.json
+++ b/recipes/engine/web_engine_framework.expected/linux-pre-submit.json
@@ -853,6 +853,229 @@
},
{
"cmd": [],
+ "name": "Checkout flutter/flutter"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py",
+ "--path",
+ "[CACHE]/flutter",
+ "--url",
+ "https://github.com/flutter/flutter"
+ ],
+ "name": "Checkout flutter/flutter.git setup",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "origin",
+ "master",
+ "--recurse-submodules",
+ "--progress",
+ "--tags"
+ ],
+ "cwd": "[CACHE]/flutter",
+ "env": {
+ "PATH": "RECIPE_REPO[depot_tools]:<PATH>"
+ },
+ "infra_step": true,
+ "name": "Checkout flutter/flutter.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "-f",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[CACHE]/flutter",
+ "infra_step": true,
+ "name": "Checkout flutter/flutter.git checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[CACHE]/flutter",
+ "infra_step": true,
+ "name": "Checkout flutter/flutter.read revision",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@",
+ "@@@SET_BUILD_PROPERTY@got_revision@\"deadbeef\"@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "clean",
+ "-f",
+ "-d",
+ "-x"
+ ],
+ "cwd": "[CACHE]/flutter",
+ "infra_step": true,
+ "name": "Checkout flutter/flutter.git clean",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "sync"
+ ],
+ "cwd": "[CACHE]/flutter",
+ "infra_step": true,
+ "name": "Checkout flutter/flutter.submodule sync",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "update",
+ "--init",
+ "--recursive"
+ ],
+ "cwd": "[CACHE]/flutter",
+ "infra_step": true,
+ "name": "Checkout flutter/flutter.submodule update",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "Chrome and driver dependency"
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/chrome/chrome",
+ "-ensure-file",
+ "flutter_internal/browsers/chrome/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Chrome and driver dependency.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter_internal/browsers/chrome/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[CACHE]/chrome/drivers",
+ "-ensure-file",
+ "flutter_internal/browser-drivers/chrome/${platform} latest",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "name": "Chrome and driver dependency.ensure_installed (2)",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"flutter_internal/browser-drivers/chrome/resolved-platform\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "flutter",
+ "config",
+ "--local-engine=[CACHE]/builder/src/out/host_debug_unopt",
+ "--no-analytics",
+ "--enable-web"
+ ],
+ "cwd": "[CACHE]/flutter/dev/integration_tests/web",
+ "env": {
+ "CHROME_EXECUTABLE": "[CACHE]/chrome/chrome/chrome",
+ "CHROME_NO_SANDBOX": "true",
+ "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+ "PUB_CACHE": "[CACHE]/.pub-cache"
+ },
+ "env_prefixes": {
+ "PATH": [
+ "[CACHE]/flutter/bin",
+ "[CACHE]/flutter/bin/cache/dart-sdk/bin",
+ "[CACHE]/chrome/chrome",
+ "[CACHE]/chrome/drivers"
+ ]
+ },
+ "name": "web integration tests config"
+ },
+ {
+ "cmd": [
+ "flutter",
+ "--local-engine=[CACHE]/builder/src/out/host_debug_unopt",
+ "build",
+ "web",
+ "-v"
+ ],
+ "cwd": "[CACHE]/flutter/dev/integration_tests/web",
+ "env": {
+ "CHROME_EXECUTABLE": "[CACHE]/chrome/chrome/chrome",
+ "CHROME_NO_SANDBOX": "true",
+ "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+ "PUB_CACHE": "[CACHE]/.pub-cache"
+ },
+ "env_prefixes": {
+ "PATH": [
+ "[CACHE]/flutter/bin",
+ "[CACHE]/flutter/bin/cache/dart-sdk/bin",
+ "[CACHE]/chrome/chrome",
+ "[CACHE]/chrome/drivers"
+ ]
+ },
+ "name": "run web integration tests"
+ },
+ {
+ "cmd": [],
"name": "Task Shards",
"~followup_annotations": [
"@@@STEP_LINK@@https://cr-buildbucket.appspot.com/build/8922054662172514001@@@"
@@ -883,14 +1106,6 @@
"[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
]
},
- "env_suffixes": {
- "DEPOT_TOOLS_UPDATE": [
- "0"
- ],
- "PATH": [
- "RECIPE_REPO[depot_tools]"
- ]
- },
"infra_step": true,
"name": "buildbucket.collect.wait",
"timeout": 10800,
@@ -915,14 +1130,6 @@
"[CACHE]/builder/src/third_party/dart/tools/sdks/dart-sdk/bin"
]
},
- "env_suffixes": {
- "DEPOT_TOOLS_UPDATE": [
- "0"
- ],
- "PATH": [
- "RECIPE_REPO[depot_tools]"
- ]
- },
"infra_step": true,
"name": "buildbucket.collect.get",
"stdin": "{\"requests\": [{\"getBuild\": {\"fields\": \"builder,createTime,createdBy,critical,endTime,id,input,number,output,startTime,status,updateTime\", \"id\": \"8922054662172514000\"}}, {\"getBuild\": {\"fields\": \"builder,createTime,createdBy,critical,endTime,id,input,number,output,startTime,status,updateTime\", \"id\": \"8922054662172514001\"}}]}",
diff --git a/recipes/engine/web_engine_framework.py b/recipes/engine/web_engine_framework.py
index 63a787e..6d4b2a2 100644
--- a/recipes/engine/web_engine_framework.py
+++ b/recipes/engine/web_engine_framework.py
@@ -18,6 +18,7 @@
'depot_tools/gsutil',
'flutter/display_util',
'flutter/repo_util',
+ 'flutter/flutter_deps',
'flutter/shard_util',
'fuchsia/goma',
'recipe_engine/buildbucket',
@@ -51,6 +52,7 @@
name = 'build %s' % ' '.join([config] + list(targets))
api.step(name, ninja_args)
+
def Archive(api, target):
checkout = GetCheckoutPath(api)
build_dir = checkout.join('out', target)
@@ -61,15 +63,18 @@
isolated.add_dir(isolate_dir)
return isolated.archive('Archive Flutter Engine Test Isolate')
+
def RunGN(api, *args):
checkout = GetCheckoutPath(api)
gn_cmd = ['python', checkout.join('flutter/tools/gn'), '--goma']
gn_cmd.extend(args)
api.step('gn %s' % ' '.join(args), gn_cmd)
+
def GetCheckoutPath(api):
return api.path['cache'].join('builder', 'src')
+
def RunSteps(api, properties, env_properties):
"""Steps to checkout flutter engine and execute web tests."""
cache_root = api.path['cache'].join('builder')
@@ -84,10 +89,7 @@
dart_bin = checkout.join('third_party', 'dart', 'tools', 'sdks', 'dart-sdk',
'bin')
- env = {
- 'GOMA_DIR': api.goma.goma_dir,
- 'ENGINE_PATH': cache_root
- }
+ env = {'GOMA_DIR': api.goma.goma_dir, 'ENGINE_PATH': cache_root}
env_prefixes = {'PATH': [dart_bin]}
# Checkout source code and build
@@ -106,8 +108,46 @@
# Archive build directory into isolate.
isolated_hash = Archive(api, target_name)
+ # TODO(nurhan): Use the youngest commit older than the engine.
+ ref = 'refs/heads/master'
+ url = 'https://github.com/flutter/flutter'
- builds = schedule_builds(api, isolated_hash)
+ builds = schedule_builds(api, isolated_hash, ref, url)
+
+ # Checkout flutter to run the web integration tests with the local engine.
+ flutter_checkout_path = api.path['cache'].join('flutter')
+ api.repo_util.checkout(
+ 'flutter', checkout_path=flutter_checkout_path, url=url, ref=ref)
+
+ # Create new enviromenent variables for Framework.
+ # Note that the `dart binary` location is not the same for Framework and the
+ # engine.
+ f_env, f_env_prefix = api.repo_util.flutter_environment(flutter_checkout_path)
+
+ deps = [{'dependency': 'chrome_and_driver'}]
+ api.flutter_deps.required_deps(f_env, f_env_prefix, deps)
+
+ integration_test = flutter_checkout_path.join('dev', 'integration_tests',
+ 'web')
+
+ with api.context(cwd=integration_test, env=f_env, env_prefixes=f_env_prefix):
+ build_dir = checkout.join('out', target_name)
+ api.step('web integration tests config', [
+ 'flutter',
+ 'config',
+ '--local-engine=%s' % build_dir,
+ '--no-analytics',
+ '--enable-web',
+ ])
+ api.step('run web integration tests', [
+ 'flutter',
+ '--local-engine=%s' % build_dir,
+ 'build',
+ 'web',
+ '-v',
+ ])
+
+ with api.context(cwd=cache_root, env=env, env_prefixes=env_prefixes):
builds = api.shard_util.collect_builds(builds)
api.display_util.display_builds(
step_name='display builds',
@@ -116,14 +156,12 @@
)
-def schedule_builds(api, isolated_hash):
+def schedule_builds(api, isolated_hash, ref, url):
"""Schedules one subbuild per subshard."""
reqs = []
- # TODO: Use the youngest commit older than the engine.
- ref = 'refs/heads/master'
- url = 'https://github.com/flutter/flutter'
+
shard = api.properties.get('shard')
- dependencies=[{'dependency': 'chrome_and_driver'}]
+ dependencies = [{'dependency': 'chrome_and_driver'}]
for subshard in api.properties.get('subshards'):
task_name = '%s-%s' % (shard, subshard)
drone_props = {
@@ -140,17 +178,25 @@
swarming_parent_run_id=api.swarming.task_id,
builder='%s SDK Drone' % platform_name,
properties=drone_props,
- priority=25
- )
+ priority=25)
reqs.append(req)
return api.buildbucket.schedule(reqs)
+
def GenTests(api):
- yield api.test('linux-pre-submit') + api.properties(
- dependencies=['chrome_and_drivers'],
- shard='web_tests',
- subshards=['0', '1_last'],
- goma_jobs='200',
- git_url='https://mygitrepo',
- git_ref='refs/pull/1/head',
- clobber=True) + api.platform('linux', 64)
+ yield api.test(
+ 'linux-pre-submit',
+ api.repo_util.flutter_environment_data(api.path['cache'].join('flutter')),
+ api.properties(
+ dependencies=[{
+ 'dependency': 'chrome_and_driver'
+ }],
+ shard='web_tests',
+ subshards=['0', '1_last'],
+ goma_jobs='200',
+ git_url='https://mygitrepo',
+ git_ref='refs/pull/1/head',
+ clobber=True,
+ task_name='abc'),
+ api.platform('linux', 64),
+ )