dart-sdk/tools/bots
Martin Kustermann 89fe12b12a [infra] Always re-run GN in build.py
The workflow of using tools/gn.py followed-by tools/build.py is no
longer working as it used to (the latter will override whatever the
former configured).

Instead one should pick between:

  tools/gn.py & ninja
  tools/build.py

=> Both tools/gn.py and tools/build.py suport the same options.

This CL also makes tools/build.py stop using tools/generate_buildfiles.py (which
would get just overriden by the re-run of GN).

Change-Id: Ie698d7395e8c5862ae04a479c7c820c76ac5565d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154323
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2020-07-15 09:01:28 +00:00
..
browsers Add hash for downloading Linux Chrome to tools/bots/browsers. 2018-03-16 10:35:11 +00:00
flutter [Core Libraries] Eliminate the fork in the core libraries. 2020-06-16 23:37:36 +00:00
__init__.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
android.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
aot_smoke_tests.dart [vm] Ensure create_sdk GN build has working dart2native iff AOT is supported 2019-11-04 12:01:56 +00:00
bot.py [Core Libraries] Eliminate the fork in the core libraries. 2020-06-16 23:37:36 +00:00
bot_utils.py [infra] Remove remaining GSUtil.GSUTIL_IS_SHELL_SCRIPT reference 2020-06-11 05:29:33 +00:00
compare_results.dart [infra] Remove support for approvals from compare_results 2020-06-26 11:26:55 +00:00
dart2js_dump_info.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
dart_aot_test.dart [SDK] Removes dart2aot. 2019-10-15 17:53:38 +00:00
dart_sdk.py Reland "[vm] Build dart2native dependencies with the normal "create_sdk" target" 2020-06-17 16:12:26 +00:00
dartdoc_footer.html add footer for dartdocs generated for the sdk for analytics and survey 2015-07-13 13:14:09 -07:00
ddc_tests.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
extend_results.dart [infra] Construct 'not run' records in results.json when tests disappear 2020-02-14 13:25:25 +00:00
find_base_commit.dart [beta] Support the beta channel in SDK scripts 2020-03-19 07:49:38 +00:00
get_builder_status.dart [infra] Remove trailing new-line from auth token file 2020-07-10 09:52:38 +00:00
linux_distribution_support.py [infra] Remove wheezy left overs from SDK 2020-06-04 18:32:29 +00:00
post_results_to_pubsub.dart [infra] Support posting results to staging in post_results_to_pubsub 2020-06-26 06:28:55 +00:00
pub.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
pub_integration_test.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
README.md [infra] Add support for builders to pkg/smith 2020-01-27 08:13:25 +00:00
results.dart [infra] Delete approve_results. 2020-03-25 10:27:40 +00:00
run_android_tests.sh Remove temp code to ignore "--failure-summary". 2017-06-01 15:45:55 -07:00
test_matrix.json [infra] Always re-run GN in build.py 2020-07-15 09:01:28 +00:00
try_benchmarks.sh [benchmark] Use the VM from the SDK for analyzer benchmarks. 2020-07-14 16:05:47 +00:00
update_flakiness.dart [infra] Fix update_flakiness using wrong key when computing matches. 2019-03-04 13:38:29 +00:00
upload_debian_packages.py Mass format python with yapf 2019-08-05 20:34:31 +00:00
version_checker.py [beta] Support the beta channel in SDK scripts 2020-03-19 07:49:38 +00:00

tools/bots

This folder contains scripts and configuration files used by Dart's continuous integration and testing infrastructure.

Test matrix

The file test_matrix.json defines the test configurations run by Dart's CI infrastructure. Changes to the test matrix affect all builds that include them.

Structure

The test matrix is a JSON document and consists of the "filesets" object, the "configurations" list, and the "builder_configurations" list as well as a "global" values object and a "branches" list.

Filesets

The file sets define files and/or directories that need to be present for a test configuration at runtime. Any directory specified will be included along with its subdirectories recursively. Directory names must have a / at the end. All paths are relative to the SDK checkout's root directory.

"filesets": {
  "a_fileset_name": [
    "a/directory/",
    "a/file"
  ],
  "another_fileset_name": [
    "another/directory/",
    "another/file"
  ]
}

Configurations

The configurations describe all named configurations that the CI infrastructure supports. It consists of a list of configuration descriptions.

Each configuration description defines one or more configuration names using a simple template syntax, where a group (a|b|c) means taking each of the options for a different configuration name. The set of all configuration names is the result of picking each combination of group options.

The configuration name implicitly defines the options of the configuration (system, architecture, compiler, etc.), but additional options can be given in an options field.

"configurations": {
  "unittest-(linux|win|mac)": {
    "options": {
      "compiler": "dartk",
      "mode": "release",
}},

Builder Configurations

The builder configurations describes all test configurations a specific builder must execute. Each builder configuration is an object that specifies which builders it applies to, defines the build steps for the builders, and some additional metadata. Only one builder configuration can apply to a builder.

"builder_configurations": [
  {
    "builders": [
      "a-builder",
      "another-builder"
    ],
    "meta": {
      "description": "Description of this configuration."
    },
    "steps": [
    ]
  }
]

Each step is an object and must have a name. A step may also specify a script to run instead of the default script: tools/test.py. Additional arguments may be specified. These arguments will be passed to the script.

Inside arguments, the following variables will be expanded to values extracted from the builder name:

  • ${mode}: the mode in which to run the tests; e.g., release, debug
  • ${arch}: architecture to run the tests on; e.g., ia32, x64
  • $[system}: the system on which to run the tests; e.g., win, linux, mac
  • ${runtime}: the runtime to use to run the tests; e.g., vm, chrome, d8
"steps": [
  {
    "name": "build it",
    "script": "tools/build.py",
    "arguments": ["--a-flag", "target", "another_target"]
  },
  {
    "name": "test it",
    "arguments": ["-nconfiguration-${system}"]
  }
]

A step that uses the script tools/test.py either explicitely or by default is called a "test step". Test steps must include the -n command line argument to select one of the named configurations defined in the configurations section.

A step using the default script may also be sharded across many machines using the "shards" parameter. If a step is sharded, it must specify a "fileset". Only the files and directories defined by the file set will be available to the script when it's running on a shard.

{
  "name": "shard the tests",
  "shards": 10,
  "fileset": "a_fileset_name"
}

Builders

Builder name parsing

The builder names are split by '-' and each part is then examined if it is an option. Options can be runtimes (e.g. "chrome"), architectures (e.g. x64) and operating system families (e.g. win). For each valid option, additional arguments are passed to the tools/build.py script.

Adding a new builder

To add a builder:

  1. Decide on a name.
  2. Add the builder name to a new or existing configuration.
  3. File an issue labelled "area-infrastructure" to get your builder activated.

Testing a new or modified builder

Builders can be tested using a tool called led that is included in depot_tools. Replace buildername and CL number with the correct values and run:

led get-builder luci.dart.ci:<builder name> | \
led edit-cr-cl 'https://dart-review.googlesource.com/c/<cl number>' | \
led launch

Adding a builder to the commit queue

For now, file an issue labeled "area-infrastructure" to get your builder added to the commit queue.

Glossary

Builder

A builder has a name and defines the steps the need to be run when it is executed by a bot. In general, a builder defines how to build and test software.

Bot

A physical or virtual machine (or even a docker container) that executes all commands it receives. Often, these commands are the steps defined by a builder.

Sharding

Sharded steps copy all files in a file set to as many bots as specified and runs the same command on all of the shards. Each shard has a shard number. The shard number and the total number of shards are passed as arguments to the command. The command is then responsible for running a subset of its work on each shard based on these arguments.