Support Mac test for plugins repo
This CL:
1) enables Mac test support
2) adds args support for script
LED build: https://ci.chromium.org/raw/build/logs.chromium.org/flutter/led/keyonghan_google.com/459eedcfec89368ece5d62a7b3339ac384006ff5a94d7540dfc9e37dd21dc3d2/+/build.proto?server=chromium-swarm.appspot.com
This build is based on a new Mac target, proposed in PR: https://github.com/flutter/plugins/pull/6637
Change-Id: Ic75a9718075dc898da9f747bfc9bd2a1bf38e000
Bug: https://github.com/flutter/flutter/issues/114373
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/35303
Commit-Queue: Keyong Han <keyonghan@google.com>
Reviewed-by: Stuart Morgan <stuartmorgan@google.com>
diff --git a/recipes/plugins/plugins.expected/mac.json b/recipes/plugins/plugins.expected/mac.json
new file mode 100644
index 0000000..208e63e
--- /dev/null
+++ b/recipes/plugins/plugins.expected/mac.json
@@ -0,0 +1,423 @@
+[
+ {
+ "cmd": [],
+ "name": "checkout source code"
+ },
+ {
+ "cmd": [],
+ "name": "checkout source code.Checkout flutter/plugins",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python3",
+ "-u",
+ "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py",
+ "--path",
+ "[START_DIR]/plugins",
+ "--url",
+ "https://flutter.googlesource.com/mirrors/plugins"
+ ],
+ "name": "checkout source code.Checkout flutter/plugins.git setup",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "origin",
+ "main",
+ "--recurse-submodules",
+ "--progress",
+ "--tags"
+ ],
+ "cwd": "[START_DIR]/plugins",
+ "env": {
+ "PATH": "RECIPE_REPO[depot_tools]:<PATH>"
+ },
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/plugins.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "-f",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]/plugins",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/plugins.git checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/plugins",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/plugins.read revision",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@",
+ "@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@",
+ "@@@SET_BUILD_PROPERTY@got_revision@\"deadbeef\"@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "clean",
+ "-f",
+ "-d",
+ "-x"
+ ],
+ "cwd": "[START_DIR]/plugins",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/plugins.git clean",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "sync"
+ ],
+ "cwd": "[START_DIR]/plugins",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/plugins.submodule sync",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "update",
+ "--init",
+ "--recursive"
+ ],
+ "cwd": "[START_DIR]/plugins",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/plugins.submodule update",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "[START_DIR]/plugins/.ci/flutter_master.version",
+ "/path/to/tmp/"
+ ],
+ "infra_step": true,
+ "name": "checkout source code.read pinned version",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@flutter_master.version@refs/heads/master@@@",
+ "@@@STEP_LOG_END@flutter_master.version@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout source code.Checkout flutter/flutter",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "python3",
+ "-u",
+ "RECIPE_MODULE[depot_tools::git]/resources/git_setup.py",
+ "--path",
+ "[START_DIR]/flutter",
+ "--url",
+ "https://github.com/flutter/flutter"
+ ],
+ "name": "checkout source code.Checkout flutter/flutter.git setup",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "origin",
+ "master",
+ "--recurse-submodules",
+ "--progress",
+ "--tags"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "env": {
+ "PATH": "RECIPE_REPO[depot_tools]:<PATH>"
+ },
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/flutter.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "-f",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/flutter.git checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/flutter.read revision",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@",
+ "@@@STEP_TEXT@<br/>checked out 'deadbeef'<br/>@@@",
+ "@@@SET_BUILD_PROPERTY@got_revision@\"deadbeef\"@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "clean",
+ "-f",
+ "-d",
+ "-x"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/flutter.git clean",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "sync"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/flutter.submodule sync",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "update",
+ "--init",
+ "--recursive"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "checkout source code.Checkout flutter/flutter.submodule update",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "infra_step": true,
+ "name": "git rev-parse"
+ },
+ {
+ "cmd": [],
+ "name": "Dependencies"
+ },
+ {
+ "cmd": [],
+ "name": "prepare environment"
+ },
+ {
+ "cmd": [
+ "flutter",
+ "doctor",
+ "-v"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "env": {
+ "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+ "GIT_BRANCH": "",
+ "LUCI_BRANCH": "",
+ "LUCI_CI": "True",
+ "LUCI_PR": "",
+ "OS": "linux",
+ "PUB_CACHE": "[START_DIR]/.pub-cache",
+ "REVISION": "",
+ "SDK_CHECKOUT_PATH": "[START_DIR]/flutter"
+ },
+ "env_prefixes": {
+ "PATH": [
+ "[START_DIR]/flutter/bin",
+ "[START_DIR]/flutter/bin/cache/dart-sdk/bin"
+ ]
+ },
+ "name": "prepare environment.flutter doctor",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "flutter",
+ "update-packages"
+ ],
+ "cwd": "[START_DIR]/flutter",
+ "env": {
+ "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+ "GIT_BRANCH": "",
+ "LUCI_BRANCH": "",
+ "LUCI_CI": "True",
+ "LUCI_PR": "",
+ "OS": "linux",
+ "PUB_CACHE": "[START_DIR]/.pub-cache",
+ "REVISION": "",
+ "SDK_CHECKOUT_PATH": "[START_DIR]/flutter"
+ },
+ "env_prefixes": {
+ "PATH": [
+ "[START_DIR]/flutter/bin",
+ "[START_DIR]/flutter/bin/cache/dart-sdk/bin"
+ ]
+ },
+ "infra_step": true,
+ "name": "prepare environment.download dependencies",
+ "timeout": 300,
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "read yaml",
+ "~followup_annotations": [
+ "@@@STEP_LOG_LINE@yaml@@@@",
+ "@@@STEP_LOG_END@yaml@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "[START_DIR]/plugins/.ci/targets/tests.yaml",
+ "/path/to/tmp/"
+ ],
+ "infra_step": true,
+ "name": "read yaml.read",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_END@tests.yaml@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "RECIPE_MODULE[flutter::yaml]/resources/parse_yaml.py",
+ "--yaml_file",
+ "[START_DIR]/plugins/.ci/targets/tests.yaml",
+ "--json_file",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "name": "read yaml.parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"tasks\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"args\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"arg1\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"arg2\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ ], @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"name\": \"one\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"script\": \"myscript\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "Run plugin tests"
+ },
+ {
+ "cmd": [
+ "bash",
+ "[START_DIR]/plugins/myscript",
+ "arg1",
+ "arg2"
+ ],
+ "cwd": "[START_DIR]/plugins",
+ "env": {
+ "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
+ "GIT_BRANCH": "",
+ "LUCI_BRANCH": "",
+ "LUCI_CI": "True",
+ "LUCI_PR": "",
+ "OS": "linux",
+ "PUB_CACHE": "[START_DIR]/.pub-cache",
+ "REVISION": "",
+ "SDK_CHECKOUT_PATH": "[START_DIR]/flutter"
+ },
+ "env_prefixes": {
+ "PATH": [
+ "[START_DIR]/flutter/bin",
+ "[START_DIR]/flutter/bin/cache/dart-sdk/bin",
+ "[START_DIR]/flutter/bin",
+ "[START_DIR]/flutter/bin/cache/dart-sdk/bin"
+ ]
+ },
+ "name": "Run plugin tests.one",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipes/plugins/plugins.expected/master_channel.json b/recipes/plugins/plugins.expected/master_channel.json
index 00ca1d2..4c99539 100644
--- a/recipes/plugins/plugins.expected/master_channel.json
+++ b/recipes/plugins/plugins.expected/master_channel.json
@@ -271,36 +271,6 @@
{
"cmd": [
"flutter",
- "config",
- "--enable-windows-desktop"
- ],
- "cwd": "[START_DIR]/flutter",
- "env": {
- "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
- "LUCI_BRANCH": "",
- "LUCI_CI": "True",
- "LUCI_PR": "",
- "OS": "linux",
- "PUB_CACHE": "[START_DIR]/.pub-cache",
- "REVISION": "",
- "SDK_CHECKOUT_PATH": "[START_DIR]/flutter"
- },
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/flutter/bin",
- "[START_DIR]/flutter/bin/cache/dart-sdk/bin"
- ]
- },
- "infra_step": true,
- "name": "prepare environment.flutter config --enable-windows-desktop",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "flutter",
"doctor",
"-v"
],
@@ -399,6 +369,10 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"tasks\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"args\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"arg1\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"arg2\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ ], @@@",
"@@@STEP_LOG_LINE@json.output@ \"name\": \"one\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"script\": \"myscript\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -414,7 +388,9 @@
{
"cmd": [
"bash",
- "[START_DIR]/plugins/myscript"
+ "[START_DIR]/plugins/myscript",
+ "arg1",
+ "arg2"
],
"cwd": "[START_DIR]/plugins",
"env": {
diff --git a/recipes/plugins/plugins.expected/stable_channel.json b/recipes/plugins/plugins.expected/stable_channel.json
index 6f68d61..f49fbdb 100644
--- a/recipes/plugins/plugins.expected/stable_channel.json
+++ b/recipes/plugins/plugins.expected/stable_channel.json
@@ -252,36 +252,6 @@
{
"cmd": [
"flutter",
- "config",
- "--enable-windows-desktop"
- ],
- "cwd": "[START_DIR]/flutter",
- "env": {
- "DEPOT_TOOLS": "RECIPE_REPO[depot_tools]",
- "GIT_BRANCH": "",
- "LUCI_BRANCH": "",
- "LUCI_CI": "True",
- "LUCI_PR": "",
- "OS": "linux",
- "PUB_CACHE": "[START_DIR]/.pub-cache",
- "REVISION": "",
- "SDK_CHECKOUT_PATH": "[START_DIR]/flutter"
- },
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/flutter/bin",
- "[START_DIR]/flutter/bin/cache/dart-sdk/bin"
- ]
- },
- "infra_step": true,
- "name": "prepare environment.flutter config --enable-windows-desktop",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "flutter",
"doctor",
"-v"
],
@@ -380,6 +350,10 @@
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"tasks\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"args\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"arg1\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"arg2\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ ], @@@",
"@@@STEP_LOG_LINE@json.output@ \"name\": \"one\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"script\": \"myscript\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -395,7 +369,9 @@
{
"cmd": [
"bash",
- "[START_DIR]/plugins/myscript"
+ "[START_DIR]/plugins/myscript",
+ "arg1",
+ "arg2"
],
"cwd": "[START_DIR]/plugins",
"env": {
diff --git a/recipes/plugins/plugins.py b/recipes/plugins/plugins.py
index e1a90e4..5c847ef 100644
--- a/recipes/plugins/plugins.py
+++ b/recipes/plugins/plugins.py
@@ -5,6 +5,7 @@
DEPS = [
'flutter/flutter_deps',
'flutter/repo_util',
+ 'flutter/osx_sdk',
'flutter/yaml',
'recipe_engine/context',
'recipe_engine/file',
@@ -50,11 +51,6 @@
with api.context(env=env, env_prefixes=env_prefixes,
cwd=flutter_checkout_path):
with api.step.nest('prepare environment'):
- api.step(
- 'flutter config --enable-windows-desktop',
- ['flutter', 'config', '--enable-windows-desktop'],
- infra_step=True,
- )
api.step('flutter doctor', ['flutter', 'doctor', '-v'])
# Fail fast on dependencies problem.
timeout_secs = 300
@@ -70,14 +66,31 @@
with api.context(env=env, env_prefixes=env_prefixes,
cwd=plugins_checkout_path):
with api.step.nest('Run plugin tests'):
- for task in result.json.output['tasks']:
- script_path = plugins_checkout_path.join(task['script'])
- api.step(task['name'], cmd=['bash', script_path])
+ dep_list = {d['dependency']: d.get('version') for d in deps}
+ if 'xcode' in dep_list:
+ with api.osx_sdk('ios'):
+ api.flutter_deps.gems(
+ env, env_prefixes, flutter_checkout_path.join('dev', 'ci', 'mac')
+ )
+ with api.context(env=env, env_prefixes=env_prefixes):
+ run_test(api, result, plugins_checkout_path)
+ else:
+ run_test(api, result, plugins_checkout_path)
+
+def run_test(api, result, plugins_checkout_path):
+ """Run tests sequentially following the script"""
+ for task in result.json.output['tasks']:
+ script_path = plugins_checkout_path.join(task['script'])
+ cmd = ['bash', script_path]
+ if 'args' in task:
+ args = task['args']
+ cmd.extend(args)
+ api.step(task['name'], cmd)
def GenTests(api):
flutter_path = api.path['start_dir'].join('flutter')
- tasks_dict = {'tasks': [{'name': 'one', 'script': 'myscript'}]}
+ tasks_dict = {'tasks': [{'name': 'one', 'script': 'myscript', 'args': ['arg1', 'arg2']}]}
yield api.test(
'master_channel', api.repo_util.flutter_environment_data(flutter_path),
api.properties(
@@ -93,3 +106,12 @@
),
api.step_data('read yaml.parse', api.json.output(tasks_dict))
)
+ yield api.test(
+ 'mac', api.repo_util.flutter_environment_data(flutter_path),
+ api.properties(
+ channel='master',
+ version_file='flutter_master.version',
+ dependencies=[{'dependency': 'xcode'}],
+ ),
+ api.step_data('read yaml.parse', api.json.output(tasks_dict))
+ )