| 1 |
// Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style license that can be |
| 3 |
// found in the LICENSE file. |
| 4 |
|
| 5 |
package gen_tasks_logic |
| 6 |
|
| 7 |
/* |
| 8 |
Generate the tasks.json file. |
| 9 |
*/ |
| 10 |
|
| 11 |
import ( |
| 12 |
"encoding/json" |
| 13 |
"fmt" |
| 14 |
"log" |
| 15 |
"os" |
| 16 |
"path/filepath" |
| 17 |
"regexp" |
| 18 |
"runtime" |
| 19 |
"sort" |
| 20 |
"strconv" |
| 21 |
"strings" |
| 22 |
"time" |
| 23 |
|
| 24 |
"go.skia.org/infra/go/cas/rbe" |
| 25 |
"go.skia.org/infra/go/cipd" |
| 26 |
"go.skia.org/infra/task_scheduler/go/specs" |
| 27 |
"go.skia.org/skia/bazel/device_specific_configs" |
| 28 |
) |
| 29 |
|
| 30 |
const ( |
| 31 |
CAS_BAZEL = "bazel" |
| 32 |
CAS_CANVASKIT = "canvaskit" |
| 33 |
CAS_COMPILE = "compile" |
| 34 |
CAS_EMPTY = "empty" // TODO(borenet): It'd be nice if this wasn't necessary. |
| 35 |
CAS_LOTTIE_CI = "lottie-ci" |
| 36 |
CAS_LOTTIE_WEB = "lottie-web" |
| 37 |
CAS_PERF = "perf" |
| 38 |
CAS_PUPPETEER = "puppeteer" |
| 39 |
CAS_RUN_RECIPE = "run-recipe" |
| 40 |
CAS_RECIPES = "recipes" |
| 41 |
CAS_RECREATE_SKPS = "recreate-skps" |
| 42 |
CAS_SKOTTIE_WASM = "skottie-wasm" |
| 43 |
CAS_TASK_DRIVERS = "task-drivers" |
| 44 |
CAS_TEST = "test" |
| 45 |
CAS_WASM_GM = "wasm-gm" |
| 46 |
CAS_WHOLE_REPO = "whole-repo" |
| 47 |
|
| 48 |
BUILD_TASK_DRIVERS_PREFIX = "Housekeeper-PerCommit-BuildTaskDrivers" |
| 49 |
BUNDLE_RECIPES_NAME = "Housekeeper-PerCommit-BundleRecipes" |
| 50 |
ISOLATE_GCLOUD_LINUX_NAME = "Housekeeper-PerCommit-IsolateGCloudLinux" |
| 51 |
ISOLATE_SKIMAGE_NAME = "Housekeeper-PerCommit-IsolateSkImage" |
| 52 |
ISOLATE_SKP_NAME = "Housekeeper-PerCommit-IsolateSKP" |
| 53 |
ISOLATE_MSKP_NAME = "Housekeeper-PerCommit-IsolateMSKP" |
| 54 |
ISOLATE_SVG_NAME = "Housekeeper-PerCommit-IsolateSVG" |
| 55 |
ISOLATE_NDK_LINUX_NAME = "Housekeeper-PerCommit-IsolateAndroidNDKLinux" |
| 56 |
ISOLATE_SDK_LINUX_NAME = "Housekeeper-PerCommit-IsolateAndroidSDKLinux" |
| 57 |
ISOLATE_WIN_TOOLCHAIN_NAME = "Housekeeper-PerCommit-IsolateWinToolchain" |
| 58 |
|
| 59 |
DEBIAN_11_OS = "Debian-11.5" |
| 60 |
DEBIAN_10_OS = "Debian-10.10" |
| 61 |
DEFAULT_OS_LINUX_GCE = UBUNTU_24_04_OS |
| 62 |
DEFAULT_OS_MAC = "Mac-15.7" |
| 63 |
DEFAULT_OS_WIN_GCE = "Windows-11-22631" |
| 64 |
UBUNTU_20_04_OS = "Ubuntu-20.04" |
| 65 |
UBUNTU_22_04_OS = "Ubuntu-22.04" |
| 66 |
UBUNTU_24_04_OS = "Ubuntu-24.04" |
| 67 |
|
| 68 |
// Small is a 2-core machine. |
| 69 |
// TODO(dogben): Would n1-standard-1 or n1-standard-2 be sufficient? |
| 70 |
MACHINE_TYPE_SMALL = "n1-highmem-2" |
| 71 |
// Medium is a 16-core machine |
| 72 |
MACHINE_TYPE_MEDIUM = "n1-standard-16" |
| 73 |
// Large is a 64-core machine. (We use "highcpu" because we don't need more than 57GB memory for |
| 74 |
// any of our tasks.) |
| 75 |
MACHINE_TYPE_LARGE = "n1-highcpu-64" |
| 76 |
|
| 77 |
// Swarming output dirs. |
| 78 |
OUTPUT_NONE = "output_ignored" // This will result in outputs not being isolated. |
| 79 |
OUTPUT_BUILD = "build" |
| 80 |
OUTPUT_BUILD_NOPATCH = "build_nopatch" |
| 81 |
OUTPUT_TEST = "test" |
| 82 |
OUTPUT_PERF = "perf" |
| 83 |
OUTPUT_BAZEL = "bazel_output" |
| 84 |
|
| 85 |
// Name prefix for upload jobs. |
| 86 |
PREFIX_UPLOAD = "Upload" |
| 87 |
|
| 88 |
// This will have to kept in sync with the kMin_Version in |
| 89 |
// src/core/SkPicturePriv.h |
| 90 |
// See the comment in that file on how to find the version to use here. |
| 91 |
oldestSupportedSkpVersion = 293 |
| 92 |
|
| 93 |
// bazelCacheDirOnGCELinux is the path where Bazel should write its cache on Linux GCE machines. |
| 94 |
// The Bazel cache can grow large (>10GB), so this should be in a partition with enough free |
| 95 |
// space. |
| 96 |
bazelCacheDirOnGCELinux = "/home/chrome-bot/bazel_cache" |
| 97 |
bazelCacheDirOnMac = "/Volumes/Work/s/w/bazel_cache" |
| 98 |
|
| 99 |
// bazelCacheDirOnSkoloLinux is like bazelCacheDirOnGCELinux for Skolo Linux machines. Unlike GCE |
| 100 |
// Linux machines, the partition mounted at / on Skolo Linux machines is large enough. While |
| 101 |
// using the default Bazel cache path would work, our Bazel task drivers demand an explicit path. |
| 102 |
// We store the Bazel cache at /home/chrome-bot/bazel_cache rather than on the default location |
| 103 |
// of /home/chrome-bot/cache/.bazel to make it obvious to someone examining a Skolo machine that |
| 104 |
// we are overriding the default location. |
| 105 |
bazelCacheDirOnSkoloLinux = "/home/chrome-bot/bazel_cache" |
| 106 |
|
| 107 |
// bazelCacheDirOnWindows is like bazelCacheDirOnSkoloLinux. Unlike GCE Linux machines, we only |
| 108 |
// have a single partition. While using the default cache path would work, our Bazel task |
| 109 |
// drivers demand an explicit path. We store the Bazel cache at /home/chrome-bot/bazel_cache |
| 110 |
// rather than on the default location of %APPDATA% to make it obvious to someone examining a |
| 111 |
// Skolo machine that we are overriding the default location. Note that double-escaping the |
| 112 |
// path separator is necessary because this string is passed to Bazel via multiple levels of |
| 113 |
// subprocesses. |
| 114 |
bazelCacheDirOnWindows = `C:\\Users\\chrome-bot\\bazel_cache` |
| 115 |
) |
| 116 |
|
| 117 |
var ( |
| 118 |
// "Constants" |
| 119 |
|
| 120 |
// Named caches used by tasks. |
| 121 |
CACHES_GIT = []*specs.Cache{ |
| 122 |
{ |
| 123 |
Name: "git", |
| 124 |
Path: "cache/git", |
| 125 |
}, |
| 126 |
{ |
| 127 |
Name: "git_cache", |
| 128 |
Path: "cache/git_cache", |
| 129 |
}, |
| 130 |
} |
| 131 |
CACHES_GO = []*specs.Cache{ |
| 132 |
{ |
| 133 |
Name: "go_cache", |
| 134 |
Path: "cache/go_cache", |
| 135 |
}, |
| 136 |
{ |
| 137 |
Name: "gopath", |
| 138 |
Path: "cache/gopath", |
| 139 |
}, |
| 140 |
} |
| 141 |
CACHES_WORKDIR = []*specs.Cache{ |
| 142 |
{ |
| 143 |
Name: "work", |
| 144 |
Path: "cache/work", |
| 145 |
}, |
| 146 |
} |
| 147 |
CACHES_CCACHE = []*specs.Cache{ |
| 148 |
{ |
| 149 |
Name: "ccache", |
| 150 |
Path: "cache/ccache", |
| 151 |
}, |
| 152 |
} |
| 153 |
// The "docker" cache is used as a persistent working directory for |
| 154 |
// tasks which use Docker. It is not to be confused with Docker's own |
| 155 |
// cache, which stores images. We do not currently use a named Swarming |
| 156 |
// cache for the latter. |
| 157 |
// TODO(borenet): We should ensure that any task which uses Docker does |
| 158 |
// not also use the normal "work" cache, to prevent issues like |
| 159 |
// https://bugs.chromium.org/p/skia/issues/detail?id=9749. |
| 160 |
CACHES_DOCKER = []*specs.Cache{ |
| 161 |
{ |
| 162 |
Name: "docker", |
| 163 |
Path: "cache/docker", |
| 164 |
}, |
| 165 |
} |
| 166 |
|
| 167 |
// CAS_SPEC_LOTTIE_CI is a CasSpec which includes the files needed for |
| 168 |
// lottie-ci. This is global so that it can be overridden by other |
| 169 |
// repositories which import this file. |
| 170 |
CAS_SPEC_LOTTIE_CI = &specs.CasSpec{ |
| 171 |
Root: "..", |
| 172 |
Paths: []string{ |
| 173 |
"skia/.vpython3", |
| 174 |
"skia/infra/bots/run_recipe.py", |
| 175 |
"skia/infra/lottiecap", |
| 176 |
"skia/tools/lottie-web-perf", |
| 177 |
"skia/tools/lottiecap", |
| 178 |
}, |
| 179 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 180 |
} |
| 181 |
|
| 182 |
// CAS_SPEC_WHOLE_REPO is a CasSpec which includes the entire repo. This is |
| 183 |
// global so that it can be overridden by other repositories which import |
| 184 |
// this file. |
| 185 |
CAS_SPEC_WHOLE_REPO = &specs.CasSpec{ |
| 186 |
Root: "..", |
| 187 |
Paths: []string{"skia"}, |
| 188 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 189 |
} |
| 190 |
|
| 191 |
// TODO(borenet): This hacky and bad. |
| 192 |
CIPD_PKG_LUCI_AUTH = cipd.MustGetPackage("infra/tools/luci-auth/${platform}") |
| 193 |
|
| 194 |
CIPD_PKGS_GOLDCTL = cipd.MustGetPackage("skia/tools/goldctl/${platform}") |
| 195 |
|
| 196 |
// These properties are required by some tasks, eg. for running |
| 197 |
// bot_update, but they prevent de-duplication, so they should only be |
| 198 |
// used where necessary. |
| 199 |
EXTRA_PROPS = map[string]string{ |
| 200 |
"buildbucket_build_id": specs.PLACEHOLDER_BUILDBUCKET_BUILD_ID, |
| 201 |
"patch_issue": specs.PLACEHOLDER_ISSUE_INT, |
| 202 |
"patch_ref": specs.PLACEHOLDER_PATCH_REF, |
| 203 |
"patch_repo": specs.PLACEHOLDER_PATCH_REPO, |
| 204 |
"patch_set": specs.PLACEHOLDER_PATCHSET_INT, |
| 205 |
"patch_storage": specs.PLACEHOLDER_PATCH_STORAGE, |
| 206 |
"repository": specs.PLACEHOLDER_REPO, |
| 207 |
"revision": specs.PLACEHOLDER_REVISION, |
| 208 |
"task_id": specs.PLACEHOLDER_TASK_ID, |
| 209 |
} |
| 210 |
|
| 211 |
// ISOLATE_ASSET_MAPPING maps the name of an asset to the configuration |
| 212 |
// for how the CIPD package should be installed for a given task. |
| 213 |
ISOLATE_ASSET_MAPPING = map[string]uploadAssetCASCfg{ |
| 214 |
"gcloud_linux": { |
| 215 |
uploadTaskName: ISOLATE_GCLOUD_LINUX_NAME, |
| 216 |
path: "gcloud_linux", |
| 217 |
}, |
| 218 |
"skimage": { |
| 219 |
uploadTaskName: ISOLATE_SKIMAGE_NAME, |
| 220 |
path: "skimage", |
| 221 |
}, |
| 222 |
"skp": { |
| 223 |
uploadTaskName: ISOLATE_SKP_NAME, |
| 224 |
path: "skp", |
| 225 |
}, |
| 226 |
"svg": { |
| 227 |
uploadTaskName: ISOLATE_SVG_NAME, |
| 228 |
path: "svg", |
| 229 |
}, |
| 230 |
"mskp": { |
| 231 |
uploadTaskName: ISOLATE_MSKP_NAME, |
| 232 |
path: "mskp", |
| 233 |
}, |
| 234 |
"android_ndk_linux": { |
| 235 |
uploadTaskName: ISOLATE_NDK_LINUX_NAME, |
| 236 |
path: "android_ndk_linux", |
| 237 |
}, |
| 238 |
"android_sdk_linux": { |
| 239 |
uploadTaskName: ISOLATE_SDK_LINUX_NAME, |
| 240 |
path: "android_sdk_linux", |
| 241 |
}, |
| 242 |
"win_toolchain": { |
| 243 |
alwaysIsolate: true, |
| 244 |
uploadTaskName: ISOLATE_WIN_TOOLCHAIN_NAME, |
| 245 |
path: "win_toolchain", |
| 246 |
}, |
| 247 |
} |
| 248 |
|
| 249 |
// Set dontReduceOpsTaskSplitting option on these models |
| 250 |
DONT_REDUCE_OPS_TASK_SPLITTING_MODELS = []string{ |
| 251 |
"NUC5PPYH", |
| 252 |
} |
| 253 |
) |
| 254 |
|
| 255 |
// Config contains general configuration information. |
| 256 |
type Config struct { |
| 257 |
// Directory containing assets. Assumed to be relative to the directory |
| 258 |
// which contains the calling gen_tasks.go file. If not specified, uses |
| 259 |
// the infra/bots/assets from this repo. |
| 260 |
AssetsDir string `json:"assets_dir"` |
| 261 |
|
| 262 |
// Path to the builder name schema JSON file. Assumed to be relative to |
| 263 |
// the directory which contains the calling gen_tasks.go file. If not |
| 264 |
// specified, uses infra/bots/recipe_modules/builder_name_schema/builder_name_schema.json |
| 265 |
// from this repo. |
| 266 |
BuilderNameSchemaFile string `json:"builder_name_schema"` |
| 267 |
|
| 268 |
// URL of the Skia Gold known hashes endpoint. |
| 269 |
GoldHashesURL string `json:"gold_hashes_url"` |
| 270 |
|
| 271 |
// GCS bucket used for GM results. |
| 272 |
GsBucketGm string `json:"gs_bucket_gm"` |
| 273 |
|
| 274 |
// GCS bucket used for Nanobench results. |
| 275 |
GsBucketNano string `json:"gs_bucket_nano"` |
| 276 |
|
| 277 |
// Optional function which returns a bot ID for internal devices. |
| 278 |
InternalHardwareLabel func(parts map[string]string) *int `json:"-"` |
| 279 |
|
| 280 |
// List of task names for which we'll never upload results. |
| 281 |
NoUpload []string `json:"no_upload"` |
| 282 |
|
| 283 |
// PathToSkia is the relative path from the root of the current checkout to |
| 284 |
// the root of the Skia checkout. |
| 285 |
PathToSkia string `json:"path_to_skia"` |
| 286 |
|
| 287 |
// Swarming pool used for triggering tasks. |
| 288 |
Pool string `json:"pool"` |
| 289 |
|
| 290 |
// LUCI project associated with this repo. |
| 291 |
Project string `json:"project"` |
| 292 |
|
| 293 |
// Service accounts. |
| 294 |
ServiceAccountCanary string `json:"service_account_canary"` |
| 295 |
ServiceAccountCompile string `json:"service_account_compile"` |
| 296 |
ServiceAccountHousekeeper string `json:"service_account_housekeeper"` |
| 297 |
ServiceAccountRecreateSKPs string `json:"service_account_recreate_skps"` |
| 298 |
ServiceAccountUploadBinary string `json:"service_account_upload_binary"` |
| 299 |
ServiceAccountUploadGM string `json:"service_account_upload_gm"` |
| 300 |
ServiceAccountUploadNano string `json:"service_account_upload_nano"` |
| 301 |
|
| 302 |
// Optional override function which derives Swarming bot dimensions |
| 303 |
// from parts of task names. |
| 304 |
SwarmDimensions func(parts map[string]string) []string `json:"-"` |
| 305 |
// Optional function called just before adding a task. |
| 306 |
AddTaskCallback func(tb *TaskBuilder) |
| 307 |
} |
| 308 |
|
| 309 |
// JobInfo is the type of each entry in the jobs.json file. |
| 310 |
type JobInfo struct { |
| 311 |
// The name of the job. |
| 312 |
Name string `json:"name"` |
| 313 |
|
| 314 |
// The optional CQ config of this job. If the CQ config is missing then the |
| 315 |
// job will not be added to the CQ of this branch. |
| 316 |
CQConfig *specs.CommitQueueJobConfig `json:"cq_config,omitempty"` |
| 317 |
} |
| 318 |
|
| 319 |
// LoadConfig loads the Config from a cfg.json file which is the sibling of the |
| 320 |
// calling gen_tasks.go file. |
| 321 |
func LoadConfig() *Config { |
| 322 |
cfgDir := getCallingDirName() |
| 323 |
var cfg Config |
| 324 |
LoadJSON(filepath.Join(cfgDir, "cfg.json"), &cfg) |
| 325 |
return &cfg |
| 326 |
} |
| 327 |
|
| 328 |
// CheckoutRoot is a wrapper around specs.GetCheckoutRoot which prevents the |
| 329 |
// caller from needing a dependency on the specs package. |
| 330 |
func CheckoutRoot() string { |
| 331 |
root, err := specs.GetCheckoutRoot() |
| 332 |
if err != nil { |
| 333 |
log.Fatal(err) |
| 334 |
} |
| 335 |
return root |
| 336 |
} |
| 337 |
|
| 338 |
// LoadJSON loads JSON from the given file and unmarshals it into the given destination. |
| 339 |
func LoadJSON(filename string, dest interface{}) { |
| 340 |
b, err := os.ReadFile(filename) |
| 341 |
if err != nil { |
| 342 |
log.Fatalf("Unable to read %q: %s", filename, err) |
| 343 |
} |
| 344 |
if err := json.Unmarshal(b, dest); err != nil { |
| 345 |
log.Fatalf("Unable to parse %q: %s", filename, err) |
| 346 |
} |
| 347 |
} |
| 348 |
|
| 349 |
// In returns true if |s| is *in* |a| slice. |
| 350 |
// TODO(borenet): This is copied from go.skia.org/infra/go/util to avoid the |
| 351 |
// huge set of additional dependencies added by that package. |
| 352 |
func In(s string, a []string) bool { |
| 353 |
for _, x := range a { |
| 354 |
if x == s { |
| 355 |
return true |
| 356 |
} |
| 357 |
} |
| 358 |
return false |
| 359 |
} |
| 360 |
|
| 361 |
// GenTasks regenerates the tasks.json file. Loads the job list from a jobs.json |
| 362 |
// file which is the sibling of the calling gen_tasks.go file. If cfg is nil, it |
| 363 |
// is similarly loaded from a cfg.json file which is the sibling of the calling |
| 364 |
// gen_tasks.go file. |
| 365 |
func FormatJobsJSON(jobsFilePath string) []*JobInfo { |
| 366 |
var jobsWithInfo []*JobInfo |
| 367 |
LoadJSON(jobsFilePath, &jobsWithInfo) |
| 368 |
|
| 369 |
// Deduplicate jobs based on the "name" key. |
| 370 |
seen := make(map[string]bool) |
| 371 |
uniqueJobs := make([]*JobInfo, 0) |
| 372 |
for _, job := range jobsWithInfo { |
| 373 |
if _, ok := seen[job.Name]; !ok { |
| 374 |
seen[job.Name] = true |
| 375 |
uniqueJobs = append(uniqueJobs, job) |
| 376 |
} |
| 377 |
} |
| 378 |
jobsWithInfo = uniqueJobs |
| 379 |
|
| 380 |
// Sort the jobs by the "name" key. |
| 381 |
sort.Slice(jobsWithInfo, func(i, j int) bool { |
| 382 |
return jobsWithInfo[i].Name < jobsWithInfo[j].Name |
| 383 |
}) |
| 384 |
|
| 385 |
// Pretty print and write back to jobs.json. |
| 386 |
updatedJobsJson, err := json.MarshalIndent(jobsWithInfo, "", " ") |
| 387 |
if err != nil { |
| 388 |
log.Fatalf("Unable to marshal jobs.json: %s", err) |
| 389 |
} |
| 390 |
if err := os.WriteFile(jobsFilePath, updatedJobsJson, 0644); err != nil { |
| 391 |
log.Fatalf("Unable to write jobs.json: %s", err) |
| 392 |
} |
| 393 |
return jobsWithInfo |
| 394 |
} |
| 395 |
|
| 396 |
func GenTasks(cfg *Config) { |
| 397 |
b := specs.MustNewTasksCfgBuilder() |
| 398 |
|
| 399 |
// Find the paths to the infra/bots directories in this repo and the |
| 400 |
// repo of the calling file. |
| 401 |
relpathTargetDir := getThisDirName() |
| 402 |
relpathBaseDir := getCallingDirName() |
| 403 |
|
| 404 |
// Format and load jobs.json. |
| 405 |
jobsFilePath := filepath.Join(relpathBaseDir, "jobs.json") |
| 406 |
jobsWithInfo := FormatJobsJSON(jobsFilePath) |
| 407 |
// Create a slice with only job names. |
| 408 |
jobs := []string{} |
| 409 |
for _, j := range jobsWithInfo { |
| 410 |
jobs = append(jobs, j.Name) |
| 411 |
} |
| 412 |
|
| 413 |
if cfg == nil { |
| 414 |
cfg = new(Config) |
| 415 |
LoadJSON(filepath.Join(relpathBaseDir, "cfg.json"), cfg) |
| 416 |
} |
| 417 |
|
| 418 |
// Create the JobNameSchema. |
| 419 |
builderNameSchemaFile := filepath.Join(relpathTargetDir, "recipe_modules", "builder_name_schema", "builder_name_schema.json") |
| 420 |
if cfg.BuilderNameSchemaFile != "" { |
| 421 |
builderNameSchemaFile = filepath.Join(relpathBaseDir, cfg.BuilderNameSchemaFile) |
| 422 |
} |
| 423 |
schema, err := NewJobNameSchema(builderNameSchemaFile) |
| 424 |
if err != nil { |
| 425 |
log.Fatal(err) |
| 426 |
} |
| 427 |
|
| 428 |
// Set the assets dir. |
| 429 |
assetsDir := filepath.Join(relpathTargetDir, "assets") |
| 430 |
if cfg.AssetsDir != "" { |
| 431 |
assetsDir = filepath.Join(relpathBaseDir, cfg.AssetsDir) |
| 432 |
} |
| 433 |
b.SetAssetsDir(assetsDir) |
| 434 |
|
| 435 |
// Create Tasks and Jobs. |
| 436 |
builder := &builder{ |
| 437 |
TasksCfgBuilder: b, |
| 438 |
cfg: cfg, |
| 439 |
jobNameSchema: schema, |
| 440 |
jobs: jobs, |
| 441 |
} |
| 442 |
for _, j := range jobsWithInfo { |
| 443 |
jb := newJobBuilder(builder, j.Name) |
| 444 |
jb.genTasksForJob() |
| 445 |
jb.finish() |
| 446 |
|
| 447 |
// Add the CQ spec if it is a CQ job. |
| 448 |
if j.CQConfig != nil { |
| 449 |
b.MustAddCQJob(j.Name, j.CQConfig) |
| 450 |
} |
| 451 |
} |
| 452 |
|
| 453 |
// Create CasSpecs. |
| 454 |
b.MustAddCasSpec(CAS_BAZEL, &specs.CasSpec{ |
| 455 |
Root: "..", |
| 456 |
Paths: []string{ |
| 457 |
// Source code. |
| 458 |
"skia/example", |
| 459 |
"skia/experimental", |
| 460 |
"skia/include", |
| 461 |
"skia/modules", |
| 462 |
"skia/rust", |
| 463 |
"skia/src", |
| 464 |
"skia/tests", |
| 465 |
"skia/third_party", |
| 466 |
"skia/tools", |
| 467 |
// Needed for tests. |
| 468 |
"skia/bench", // Needed to run benchmark tests with Bazel. |
| 469 |
"skia/dm", // Needed to run tests with Bazel. |
| 470 |
"skia/gm", // Needed to run GMs with Bazel. |
| 471 |
"skia/gn", // Some Python scripts still live here. |
| 472 |
"skia/resources", |
| 473 |
"skia/package.json", |
| 474 |
"skia/package-lock.json", |
| 475 |
"skia/DEPS", // Needed to check generation. |
| 476 |
"skia/infra", // Many Go tests and Bazel tools live here. |
| 477 |
"skia/go.mod", // Needed by Gazelle. |
| 478 |
"skia/go.sum", // Needed by Gazelle. |
| 479 |
// Needed to run Bazel. |
| 480 |
"skia/.bazelignore", |
| 481 |
"skia/.bazelrc", |
| 482 |
"skia/.bazeliskrc", |
| 483 |
"skia/.bazelversion", |
| 484 |
"skia/BUILD.bazel", |
| 485 |
"skia/LICENSE", // Referred to by default_applicable_licenses |
| 486 |
"skia/MODULE.bazel", |
| 487 |
"skia/MODULE.bazel.lock", |
| 488 |
"skia/WORKSPACE.bazel", |
| 489 |
"skia/bazel", |
| 490 |
"skia/requirements.txt", |
| 491 |
"skia/toolchain", |
| 492 |
}, |
| 493 |
Excludes: []string{ |
| 494 |
rbe.ExcludeGitDir, |
| 495 |
"skia/third_party/externals", |
| 496 |
}, |
| 497 |
}) |
| 498 |
b.MustAddCasSpec(CAS_CANVASKIT, &specs.CasSpec{ |
| 499 |
Root: "..", |
| 500 |
Paths: []string{ |
| 501 |
"skia/.vpython3", |
| 502 |
"skia/infra/bots/run_recipe.py", |
| 503 |
"skia/infra/canvaskit", |
| 504 |
"skia/modules/canvaskit", |
| 505 |
}, |
| 506 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 507 |
}) |
| 508 |
b.MustAddCasSpec(CAS_EMPTY, specs.EmptyCasSpec) |
| 509 |
b.MustAddCasSpec(CAS_LOTTIE_CI, CAS_SPEC_LOTTIE_CI) |
| 510 |
b.MustAddCasSpec(CAS_LOTTIE_WEB, &specs.CasSpec{ |
| 511 |
Root: "..", |
| 512 |
Paths: []string{ |
| 513 |
"skia/.vpython3", |
| 514 |
"skia/infra/bots/run_recipe.py", |
| 515 |
"skia/tools/lottie-web-perf", |
| 516 |
}, |
| 517 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 518 |
}) |
| 519 |
b.MustAddCasSpec(CAS_PERF, &specs.CasSpec{ |
| 520 |
Root: "..", |
| 521 |
Paths: []string{ |
| 522 |
"skia/.vpython3", |
| 523 |
"skia/infra/bots/assets", |
| 524 |
"skia/infra/bots/run_recipe.py", |
| 525 |
"skia/platform_tools/ios/bin", |
| 526 |
"skia/resources", |
| 527 |
}, |
| 528 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 529 |
}) |
| 530 |
b.MustAddCasSpec(CAS_PUPPETEER, &specs.CasSpec{ |
| 531 |
Root: "../skia", // Needed for other repos. |
| 532 |
Paths: []string{ |
| 533 |
".vpython3", |
| 534 |
"tools/perf-canvaskit-puppeteer", |
| 535 |
}, |
| 536 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 537 |
}) |
| 538 |
b.MustAddCasSpec(CAS_RECIPES, &specs.CasSpec{ |
| 539 |
Root: "..", |
| 540 |
Paths: []string{ |
| 541 |
"skia/.vpython3", |
| 542 |
"skia/infra/config/recipes.cfg", |
| 543 |
"skia/infra/bots/bundle_recipes.sh", |
| 544 |
"skia/infra/bots/README.recipes.md", |
| 545 |
"skia/infra/bots/recipe_modules", |
| 546 |
"skia/infra/bots/recipes", |
| 547 |
"skia/infra/bots/recipes.py", |
| 548 |
}, |
| 549 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 550 |
}) |
| 551 |
b.MustAddCasSpec(CAS_RUN_RECIPE, &specs.CasSpec{ |
| 552 |
Root: "..", |
| 553 |
Paths: []string{ |
| 554 |
"skia/.vpython3", |
| 555 |
"skia/infra/bots/run_recipe.py", |
| 556 |
}, |
| 557 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 558 |
}) |
| 559 |
b.MustAddCasSpec(CAS_SKOTTIE_WASM, &specs.CasSpec{ |
| 560 |
Root: "..", |
| 561 |
Paths: []string{ |
| 562 |
"skia/.vpython3", |
| 563 |
"skia/infra/bots/run_recipe.py", |
| 564 |
"skia/tools/skottie-wasm-perf", |
| 565 |
}, |
| 566 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 567 |
}) |
| 568 |
b.MustAddCasSpec(CAS_TASK_DRIVERS, &specs.CasSpec{ |
| 569 |
Root: "..", |
| 570 |
Paths: []string{ |
| 571 |
// Deps needed to use Bazel |
| 572 |
"skia/.bazelrc", |
| 573 |
"skia/.bazeliskrc", |
| 574 |
"skia/.bazelversion", |
| 575 |
"skia/BUILD.bazel", |
| 576 |
"skia/LICENSE", |
| 577 |
"skia/MODULE.bazel", |
| 578 |
"skia/MODULE.bazel.lock", |
| 579 |
"skia/WORKSPACE.bazel", |
| 580 |
"skia/bazel", |
| 581 |
"skia/go.mod", |
| 582 |
"skia/go.sum", |
| 583 |
"skia/include/config", // There's a Bazel workspace in here |
| 584 |
"skia/requirements.txt", |
| 585 |
"skia/toolchain", |
| 586 |
// Needed for icu_utils bazel_dep |
| 587 |
"skia/third_party", |
| 588 |
// Actually needed to build the task drivers |
| 589 |
"skia/infra/bots/BUILD.bazel", |
| 590 |
"skia/infra/bots/build_task_drivers.sh", |
| 591 |
"skia/infra/bots/task_drivers", |
| 592 |
}, |
| 593 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 594 |
}) |
| 595 |
b.MustAddCasSpec(CAS_TEST, &specs.CasSpec{ |
| 596 |
Root: "..", |
| 597 |
Paths: []string{ |
| 598 |
"skia/.vpython3", |
| 599 |
"skia/infra/bots/assets", |
| 600 |
"skia/infra/bots/run_recipe.py", |
| 601 |
"skia/platform_tools/ios/bin", |
| 602 |
"skia/resources", |
| 603 |
}, |
| 604 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 605 |
}) |
| 606 |
b.MustAddCasSpec(CAS_WASM_GM, &specs.CasSpec{ |
| 607 |
Root: "../skia", // Needed for other repos. |
| 608 |
Paths: []string{ |
| 609 |
".vpython3", |
| 610 |
"resources", |
| 611 |
"tools/run-wasm-gm-tests", |
| 612 |
}, |
| 613 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 614 |
}) |
| 615 |
b.MustAddCasSpec(CAS_WHOLE_REPO, CAS_SPEC_WHOLE_REPO) |
| 616 |
b.MustAddCasSpec(CAS_RECREATE_SKPS, &specs.CasSpec{ |
| 617 |
Root: "..", |
| 618 |
Paths: []string{ |
| 619 |
"skia/.vpython3", |
| 620 |
"skia/DEPS", |
| 621 |
"skia/bin/fetch-sk", |
| 622 |
"skia/infra/bots/assets/skp", |
| 623 |
"skia/infra/bots/utils.py", |
| 624 |
"skia/tools/skp", |
| 625 |
}, |
| 626 |
Excludes: []string{rbe.ExcludeGitDir}, |
| 627 |
}) |
| 628 |
generateCompileCAS(b, cfg) |
| 629 |
|
| 630 |
builder.MustFinish() |
| 631 |
} |
| 632 |
|
| 633 |
// getThisDirName returns the infra/bots directory which is an ancestor of this |
| 634 |
// file. |
| 635 |
func getThisDirName() string { |
| 636 |
_, thisFileName, _, ok := runtime.Caller(0) |
| 637 |
if !ok { |
| 638 |
log.Fatal("Unable to find path to current file.") |
| 639 |
} |
| 640 |
return filepath.Dir(filepath.Dir(thisFileName)) |
| 641 |
} |
| 642 |
|
| 643 |
// getCallingDirName returns the infra/bots directory which is an ancestor of |
| 644 |
// the calling gen_tasks.go file. WARNING: assumes that the calling gen_tasks.go |
| 645 |
// file appears two steps up the stack; do not call from a function which is not |
| 646 |
// directly called by gen_tasks.go. |
| 647 |
func getCallingDirName() string { |
| 648 |
_, callingFileName, _, ok := runtime.Caller(2) |
| 649 |
if !ok { |
| 650 |
log.Fatal("Unable to find path to calling file.") |
| 651 |
} |
| 652 |
return filepath.Dir(callingFileName) |
| 653 |
} |
| 654 |
|
| 655 |
// builder is a wrapper for specs.TasksCfgBuilder. |
| 656 |
type builder struct { |
| 657 |
*specs.TasksCfgBuilder |
| 658 |
cfg *Config |
| 659 |
jobNameSchema *JobNameSchema |
| 660 |
jobs []string |
| 661 |
} |
| 662 |
|
| 663 |
// marshalJson encodes the given data as JSON and fixes escaping of '<' which Go |
| 664 |
// does by default. |
| 665 |
func marshalJson(data interface{}) string { |
| 666 |
j, err := json.Marshal(data) |
| 667 |
if err != nil { |
| 668 |
log.Fatal(err) |
| 669 |
} |
| 670 |
return strings.Replace(string(j), "\\u003c", "<", -1) |
| 671 |
} |
| 672 |
|
| 673 |
// kitchenTaskNoBundle sets up the task to run a recipe via Kitchen, without the |
| 674 |
// recipe bundle. |
| 675 |
func (b *TaskBuilder) kitchenTaskNoBundle(recipe string, outputDir string) { |
| 676 |
b.usesLUCIAuth() |
| 677 |
b.cipd(cipd.MustGetPackage("infra/tools/luci/kitchen/${platform}")) |
| 678 |
b.env("RECIPES_USE_PY3", "true") |
| 679 |
b.envPrefixes("VPYTHON_DEFAULT_SPEC", "skia/.vpython3") |
| 680 |
b.usesPython() |
| 681 |
b.recipeProp("swarm_out_dir", outputDir) |
| 682 |
if outputDir != OUTPUT_NONE { |
| 683 |
b.output(outputDir) |
| 684 |
} |
| 685 |
const python = "cipd_bin_packages/vpython3${EXECUTABLE_SUFFIX}" |
| 686 |
b.cmd(python, "-u", "skia/infra/bots/run_recipe.py", "${ISOLATED_OUTDIR}", recipe, b.getRecipeProps(), b.cfg.Project) |
| 687 |
// Most recipes want this isolate; they can override if necessary. |
| 688 |
b.cas(CAS_RUN_RECIPE) |
| 689 |
b.timeout(time.Hour) |
| 690 |
b.Spec.ExtraTags = map[string]string{ |
| 691 |
"log_location": fmt.Sprintf("logdog://logs.chromium.org/%s/${SWARMING_TASK_ID}/+/annotations", b.cfg.Project), |
| 692 |
} |
| 693 |
|
| 694 |
// Attempts. |
| 695 |
if !b.Role("Build", "Upload") && b.ExtraConfig("ASAN", "HWASAN", "MSAN", "TSAN") { |
| 696 |
// Sanitizers often find non-deterministic issues that retries would hide. |
| 697 |
b.attempts(1) |
| 698 |
} else { |
| 699 |
// Retry by default to hide random bot/hardware failures. |
| 700 |
b.attempts(2) |
| 701 |
} |
| 702 |
} |
| 703 |
|
| 704 |
// kitchenTask sets up the task to run a recipe via Kitchen. |
| 705 |
func (b *TaskBuilder) kitchenTask(recipe string, outputDir string) { |
| 706 |
b.kitchenTaskNoBundle(recipe, outputDir) |
| 707 |
b.dep(b.bundleRecipes()) |
| 708 |
} |
| 709 |
|
| 710 |
// internalHardwareLabel returns the internal ID for the bot, if any. |
| 711 |
func (b *TaskBuilder) internalHardwareLabel() *int { |
| 712 |
if b.cfg.InternalHardwareLabel != nil { |
| 713 |
return b.cfg.InternalHardwareLabel(b.Parts) |
| 714 |
} |
| 715 |
return nil |
| 716 |
} |
| 717 |
|
| 718 |
// getLinuxGceDimensions returns a map of default Swarming bot dimensions for |
| 719 |
// Linux GCE instances. |
| 720 |
func (b *TaskBuilder) getLinuxGceDimensions(machineType string) map[string]string { |
| 721 |
return map[string]string{ |
| 722 |
// Specify CPU to avoid running builds on bots with a more unique CPU. |
| 723 |
"cpu": "x86-64-Haswell_GCE", |
| 724 |
"gpu": "none", |
| 725 |
// Currently all Linux GCE tasks run on 16-CPU machines. |
| 726 |
"machine_type": machineType, |
| 727 |
"os": DEFAULT_OS_LINUX_GCE, |
| 728 |
"pool": b.cfg.Pool, |
| 729 |
} |
| 730 |
} |
| 731 |
|
| 732 |
// linuxGceDimensions adds the Swarming bot dimensions for Linux GCE instances. |
| 733 |
func (b *TaskBuilder) linuxGceDimensions(machineType string) { |
| 734 |
dims := b.getLinuxGceDimensions(machineType) |
| 735 |
dimsSlice := make([]string, 0, len(dims)) |
| 736 |
for k, v := range dims { |
| 737 |
dimsSlice = append(dimsSlice, fmt.Sprintf("%s:%s", k, v)) |
| 738 |
} |
| 739 |
sort.Strings(dimsSlice) |
| 740 |
b.dimension(dimsSlice...) |
| 741 |
} |
| 742 |
|
| 743 |
// codesizeTaskNameRegexp captures the "CodeSize-<binary name>-" prefix of a CodeSize task name. |
| 744 |
var codesizeTaskNameRegexp = regexp.MustCompile("^CodeSize-[a-zA-Z0-9_]+-") |
| 745 |
|
| 746 |
// deriveCompileTaskName returns the name of a compile task based on the given |
| 747 |
// job name. |
| 748 |
func (b *jobBuilder) deriveCompileTaskName() string { |
| 749 |
if b.Role("Test", "Perf") { |
| 750 |
task_os := b.Parts["os"] |
| 751 |
ec := []string{} |
| 752 |
if val := b.Parts["extra_config"]; val != "" { |
| 753 |
ec = strings.Split(val, "_") |
| 754 |
ignore := []string{ |
| 755 |
"AbandonGpuContext", "PreAbandonGpuContext", |
| 756 |
"FailFlushTimeCallbacks", "ReleaseAndAbandonGpuContext", |
| 757 |
"NativeFonts", "GDI", "NoGPUThreads", "DDL1", "DDL3", |
| 758 |
"DDLRecord", "BonusConfigs", "ColorSpaces", "GL", |
| 759 |
"SkottieTracing", "SkottieWASM", "GpuTess", "DMSAAStats", "Docker", "PDF", |
| 760 |
"Puppeteer", "SkottieFrames", "RenderSKP", "CanvasPerf", "AllPathsVolatile", |
| 761 |
"WebGL2", "i5", "OldestSupportedSkpVersion", "FakeWGPU", "Protected", |
| 762 |
"AndroidNDKFonts", "Upload", "TestPrecompile"} |
| 763 |
keep := make([]string, 0, len(ec)) |
| 764 |
for _, part := range ec { |
| 765 |
if !In(part, ignore) { |
| 766 |
keep = append(keep, part) |
| 767 |
} |
| 768 |
} |
| 769 |
ec = keep |
| 770 |
} |
| 771 |
if b.MatchOs("Android") { |
| 772 |
if !In("Android", ec) { |
| 773 |
ec = append([]string{"Android"}, ec...) |
| 774 |
} |
| 775 |
task_os = DEFAULT_OS_LINUX_GCE |
| 776 |
} else if b.Os("ChromeOS") { |
| 777 |
ec = append([]string{"Chromebook", "GLES"}, ec...) |
| 778 |
task_os = UBUNTU_22_04_OS |
| 779 |
} else if b.MatchOs("iOS") { |
| 780 |
ec = append([]string{task_os}, ec...) |
| 781 |
task_os = "Mac" |
| 782 |
} else if b.MatchOs("Win") { |
| 783 |
task_os = "Win" |
| 784 |
} else if b.ExtraConfig("WasmGMTests") { |
| 785 |
task_os = DEFAULT_OS_LINUX_GCE |
| 786 |
} else if b.Compiler("GCC") { |
| 787 |
// GCC compiles are now on a Docker container. We use the same OS and |
| 788 |
// version to compile as to test. |
| 789 |
ec = append([]string{"Docker"}, ec...) |
| 790 |
} else if b.MatchOs("Mac") { |
| 791 |
task_os = "Mac" |
| 792 |
} |
| 793 |
jobNameMap := map[string]string{ |
| 794 |
"role": "Build", |
| 795 |
"os": strings.ReplaceAll(task_os, "-", ""), |
| 796 |
"compiler": b.Parts["compiler"], |
| 797 |
"target_arch": b.Parts["arch"], |
| 798 |
"configuration": b.Parts["configuration"], |
| 799 |
} |
| 800 |
if b.ExtraConfig("CanvasKit", "SkottieWASM", "Puppeteer") { |
| 801 |
if b.CPU() { |
| 802 |
ec = []string{"CanvasKit_CPU"} |
| 803 |
} else { |
| 804 |
ec = []string{"CanvasKit"} |
| 805 |
} |
| 806 |
// We prefer to compile this in the cloud because we have more resources there |
| 807 |
jobNameMap["os"] = strings.ReplaceAll(DEFAULT_OS_LINUX_GCE, "-", "") |
| 808 |
} |
| 809 |
if len(ec) > 0 { |
| 810 |
jobNameMap["extra_config"] = strings.Join(ec, "_") |
| 811 |
} |
| 812 |
name, err := b.jobNameSchema.MakeJobName(jobNameMap) |
| 813 |
if err != nil { |
| 814 |
log.Fatal(err) |
| 815 |
} |
| 816 |
return name |
| 817 |
} else if b.Role("BuildStats") { |
| 818 |
return strings.Replace(b.Name, "BuildStats", "Build", 1) |
| 819 |
} else if b.Role("CodeSize") { |
| 820 |
return codesizeTaskNameRegexp.ReplaceAllString(b.Name, "Build-") |
| 821 |
} else { |
| 822 |
return b.Name |
| 823 |
} |
| 824 |
} |
| 825 |
|
| 826 |
// swarmDimensions generates swarming bot dimensions for the given task. |
| 827 |
func (b *TaskBuilder) swarmDimensions() { |
| 828 |
if b.cfg.SwarmDimensions != nil { |
| 829 |
dims := b.cfg.SwarmDimensions(b.Parts) |
| 830 |
if dims != nil { |
| 831 |
b.dimension(dims...) |
| 832 |
return |
| 833 |
} |
| 834 |
} |
| 835 |
b.defaultSwarmDimensions() |
| 836 |
} |
| 837 |
|
| 838 |
// androidDeviceInfo maps Android models (as in the "model" part of a task) to the device_type and |
| 839 |
// device_os Swarming dimensions. |
| 840 |
var androidDeviceInfos = map[string][]string{ |
| 841 |
"AndroidOne": {"sprout", "MOB30Q"}, |
| 842 |
"GalaxyS7_G930FD": {"herolte", "R16NW"}, // This is Oreo. |
| 843 |
"GalaxyS9": {"exynos9810", "QP1A.190711.020"}, |
| 844 |
"GalaxyS20": {"exynos990", "QP1A.190711.020"}, |
| 845 |
"GalaxyS24": {"pineapple", "UP1A.231005.007"}, |
| 846 |
"JioNext": {"msm8937", "RKQ1.210602.002"}, |
| 847 |
"Mokey": {"mokey", "UP1A.231105.001"}, |
| 848 |
"MokeyGo32": {"mokey_go32", "UQ1A.240105.003.A1"}, |
| 849 |
"MotoG73": {"devonf", "U1TN34.82-12-17"}, |
| 850 |
"Nexus5": {"hammerhead", "M4B30Z_3437181"}, |
| 851 |
"Nexus7": {"grouper", "LMY47V"}, // 2012 Nexus 7 |
| 852 |
"P30": {"HWELE", "HUAWEIELE-L29"}, |
| 853 |
"Pixel3a": {"sargo", "QP1A.190711.020"}, |
| 854 |
"Pixel4": {"flame", "RPB2.200611.009"}, // R Preview |
| 855 |
"Pixel4a": {"sunfish", "AOSP.MASTER"}, // Pixel4a flashed with an Android HWASan build. |
| 856 |
"Pixel4XL": {"coral", "QD1A.190821.011.C4"}, |
| 857 |
"Pixel5": {"redfin", "RD1A.200810.022.A4"}, |
| 858 |
"Pixel6": {"oriole", "SD1A.210817.037"}, |
| 859 |
"Pixel7": {"panther", "AP4A.241205.013"}, |
| 860 |
"Pixel7Pro": {"cheetah", "TD1A.221105.002"}, |
| 861 |
"Pixel9": {"tokay", "AP4A.241205.013"}, |
| 862 |
"Pixel10": {"frankel", "BP41.250916.012.A1"}, |
| 863 |
"TecnoSpark3Pro": {"TECNO-KB8", "PPR1.180610.011"}, |
| 864 |
"Wembley": {"wembley", "SP2A.220505.008"}, |
| 865 |
} |
| 866 |
|
| 867 |
// defaultSwarmDimensions generates default swarming bot dimensions for the given task. |
| 868 |
func (b *TaskBuilder) defaultSwarmDimensions() { |
| 869 |
d := map[string]string{ |
| 870 |
"pool": b.cfg.Pool, |
| 871 |
} |
| 872 |
if os, ok := b.Parts["os"]; ok { |
| 873 |
d["os"], ok = map[string]string{ |
| 874 |
"Android": "Android", |
| 875 |
"Android12": "Android", |
| 876 |
"ChromeOS": "ChromeOS", |
| 877 |
"Debian9": DEFAULT_OS_LINUX_GCE, // Runs in Deb9 Docker. |
| 878 |
"Debian11": DEBIAN_11_OS, |
| 879 |
"Mac": DEFAULT_OS_MAC, |
| 880 |
"Mac11": "Mac-11", |
| 881 |
"Mac12": "Mac-12", |
| 882 |
"Mac13": "Mac-13", |
| 883 |
"Mac14": "Mac-14.7", // Builds run on 14.5, tests on 14.7. |
| 884 |
"Mac15": "Mac-15.7", |
| 885 |
"Mokey": "Android", |
| 886 |
"MokeyGo32": "Android", |
| 887 |
"Ubuntu20.04": UBUNTU_20_04_OS, |
| 888 |
"Ubuntu22.04": UBUNTU_22_04_OS, |
| 889 |
"Ubuntu24.04": UBUNTU_24_04_OS, |
| 890 |
"Win": DEFAULT_OS_WIN_GCE, |
| 891 |
"Win10": "Windows-10-19045", |
| 892 |
"Win11": "Windows-11-26100.1742", |
| 893 |
"iOS": "iOS-13.3.1", |
| 894 |
"iOS18": "iOS-18.2.1", |
| 895 |
}[os] |
| 896 |
if !ok { |
| 897 |
log.Fatalf("Entry %q not found in OS mapping.", os) |
| 898 |
} |
| 899 |
if os == "Debian11" && b.ExtraConfig("Docker") { |
| 900 |
d["os"] = DEFAULT_OS_LINUX_GCE |
| 901 |
d["gce"] = "1" |
| 902 |
} |
| 903 |
if os == "Win11" && b.Model("GCE") { |
| 904 |
d["os"] = DEFAULT_OS_WIN_GCE |
| 905 |
d["gce"] = "1" |
| 906 |
} |
| 907 |
if os == "Win11" && b.GPU("IntelUHDGraphics770") { |
| 908 |
d["os"] = "Windows-11-26200.6584" |
| 909 |
} |
| 910 |
if strings.Contains(os, "iOS") { |
| 911 |
d["pool"] = "SkiaIOS" |
| 912 |
if b.Model("iPhone11") { |
| 913 |
d["os"] = "iOS-18.4" |
| 914 |
} |
| 915 |
} |
| 916 |
if b.Parts["model"] == "iPadPro" { |
| 917 |
d["os"] = "iOS-13.6" |
| 918 |
} |
| 919 |
} else { |
| 920 |
d["os"] = DEFAULT_OS_LINUX_GCE |
| 921 |
} |
| 922 |
if b.Role("Test", "Perf") { |
| 923 |
if b.Os("Android") { |
| 924 |
// For Android, the device type is a better dimension |
| 925 |
// than CPU or GPU. |
| 926 |
deviceInfo, ok := androidDeviceInfos[b.Parts["model"]] |
| 927 |
if !ok { |
| 928 |
log.Fatalf("Entry %q not found in Android mapping.", b.Parts["model"]) |
| 929 |
} |
| 930 |
d["device_type"] = deviceInfo[0] |
| 931 |
d["device_os"] = deviceInfo[1] |
| 932 |
} else if b.Os("Android12") { |
| 933 |
// For Android, the device type is a better dimension |
| 934 |
// than CPU or GPU. |
| 935 |
deviceInfo, ok := map[string][]string{ |
| 936 |
"Pixel5": {"redfin", "SP2A.220305.012"}, |
| 937 |
}[b.Parts["model"]] |
| 938 |
if !ok { |
| 939 |
log.Fatalf("Entry %q not found in Android mapping.", b.Parts["model"]) |
| 940 |
} |
| 941 |
d["device_type"] = deviceInfo[0] |
| 942 |
d["device_os"] = deviceInfo[1] |
| 943 |
|
| 944 |
// Tests using Android's HWAddress Sanitizer require an HWASan build of Android. |
| 945 |
// See https://developer.android.com/ndk/guides/hwasan. |
| 946 |
if b.ExtraConfig("HWASAN") { |
| 947 |
d["android_hwasan_build"] = "1" |
| 948 |
} |
| 949 |
} else if b.Os("ChromeOS") { |
| 950 |
deviceOS, ok := map[string]string{ |
| 951 |
"Cherry": "16002.30.0", |
| 952 |
"Guybrush": "16002.27.0", |
| 953 |
"Octopus": "16002.21.0", |
| 954 |
"Corsola": "16200.0.0", |
| 955 |
"Trogdor": "16002.26.0", |
| 956 |
}[b.Parts["model"]] |
| 957 |
if !ok { |
| 958 |
log.Fatalf("Entry %q not found in ChromeOS mapping.", b.Parts["model"]) |
| 959 |
} |
| 960 |
d["device_os"] = deviceOS |
| 961 |
d["device_type"] = strings.ToLower(b.Parts["model"]) |
| 962 |
} else if b.MatchOs("iOS") { |
| 963 |
device, ok := map[string]string{ |
| 964 |
"iPadMini4": "iPad5,1", |
| 965 |
"iPhone11": "iPhone12,1", |
| 966 |
"iPhone15Pro": "iPhone16,1", |
| 967 |
"iPhone7": "iPhone9,1", |
| 968 |
"iPhone8": "iPhone10,1", |
| 969 |
"iPadPro": "iPad6,3", |
| 970 |
}[b.Parts["model"]] |
| 971 |
if !ok { |
| 972 |
log.Fatalf("Entry %q not found in iOS mapping.", b.Parts["model"]) |
| 973 |
} |
| 974 |
d["device"] = device |
| 975 |
} else if b.CPU() || b.ExtraConfig("CanvasKit", "Docker", "SwiftShader") { |
| 976 |
modelMapping, ok := map[string]map[string]map[string]string{ |
| 977 |
"AppleM1": { |
| 978 |
"MacMini9.1": {"cpu": "arm64-64-Apple_M1"}, |
| 979 |
}, |
| 980 |
"AppleM3": { |
| 981 |
"MacBookPro15.3": {"cpu": "arm64-64-Apple_M3"}, |
| 982 |
}, |
| 983 |
"AppleM4": { |
| 984 |
"MacMini16.10": {"cpu": "arm64-64-Apple_M4"}, |
| 985 |
}, |
| 986 |
"AppleIntel": { |
| 987 |
"MacBookPro15.1": {"cpu": "x86-64"}, |
| 988 |
"MacBookPro16.2": {"cpu": "x86-64"}, |
| 989 |
}, |
| 990 |
"AVX": { |
| 991 |
"VMware7.1": {"cpu": "x86-64"}, |
| 992 |
}, |
| 993 |
"AVX2": { |
| 994 |
"GCE": {"cpu": "x86-64-Haswell_GCE"}, |
| 995 |
"Golo": {"cpu": "x86-64-E3-1230_v5"}, |
| 996 |
"MacBookAir7.2": {"cpu": "x86-64-i5-5350U"}, |
| 997 |
"MacBookPro11.5": {"cpu": "x86-64-i7-4870HQ"}, |
| 998 |
"MacMini7.1": {"cpu": "x86-64-i5-4278U"}, |
| 999 |
"MacMini8.1": {"cpu": "x86-64-i7-8700B"}, |
| 1000 |
"NUC5i7RYH": {"cpu": "x86-64-i7-5557U"}, |
| 1001 |
"NUC9i7QN": {"cpu": "x86-64-i7-9750H"}, |
| 1002 |
// Unfortunately, these machines don't have a more-specific |
| 1003 |
// CPU dimension we can use. However, they do have integrated |
| 1004 |
// GPUs whose models differ from our other machines, so we |
| 1005 |
// specify the GPU dimension even when running CPU tests. |
| 1006 |
"NUC11TZi5": {"cpu": "x86-64", "gpu": "8086:9a49"}, |
| 1007 |
}, |
| 1008 |
"AVX512": { |
| 1009 |
"GCE": {"cpu": "x86-64-Skylake_GCE"}, |
| 1010 |
"Golo": {"cpu": "Intel64_Family_6_Model_85_Stepping_7__GenuineIntel"}, |
| 1011 |
}, |
| 1012 |
"Rome": { |
| 1013 |
"GCE": {"cpu": "x86-64"}, |
| 1014 |
}, |
| 1015 |
"SwiftShader": { |
| 1016 |
"GCE": {"cpu": "x86-64-Haswell_GCE"}, |
| 1017 |
}, |
| 1018 |
}[b.Parts["cpu_or_gpu_value"]] |
| 1019 |
if !ok { |
| 1020 |
log.Fatalf("Entry %q not found in CPU mapping.", b.Parts["cpu_or_gpu_value"]) |
| 1021 |
} |
| 1022 |
dims, ok := modelMapping[b.Parts["model"]] |
| 1023 |
if !ok { |
| 1024 |
log.Fatalf("Entry %q not found in %q model mapping.", b.Parts["model"], b.Parts["cpu_or_gpu_value"]) |
| 1025 |
} |
| 1026 |
for k, v := range dims { |
| 1027 |
d[k] = v |
| 1028 |
} |
| 1029 |
if b.Model("GCE") && b.MatchOs("Debian") { |
| 1030 |
d["os"] = DEFAULT_OS_LINUX_GCE |
| 1031 |
} |
| 1032 |
if b.Model("GCE") && d["cpu"] == "x86-64-Haswell_GCE" { |
| 1033 |
d["machine_type"] = MACHINE_TYPE_MEDIUM |
| 1034 |
} |
| 1035 |
if b.Model("GCE") && b.CPU("Rome") { |
| 1036 |
d["machine_type"] = "n2d-standard-16" |
| 1037 |
} |
| 1038 |
} else { |
| 1039 |
// It's a GPU job. |
| 1040 |
if b.MatchOs("Win") { |
| 1041 |
gpu, ok := map[string]string{ |
| 1042 |
"GTX1660": "10de:2184-31.0.15.4601", |
| 1043 |
"IntelHD4400": "8086:0a16-10.0.26100.1", |
| 1044 |
"IntelIris540": "8086:1926-31.0.101.2115", |
| 1045 |
"IntelIris6100": "8086:162b-20.19.15.5171", |
| 1046 |
"IntelIris655": "8086:3ea5-26.20.100.7463", |
| 1047 |
"IntelIrisXe": "8086:9a49-31.0.101.5333", |
| 1048 |
"IntelUHDGraphics770": "8086:a780-31.0.101.5333", |
| 1049 |
"RadeonHD7770": "1002:683d-26.20.13031.18002", |
| 1050 |
"RadeonR9M470X": "1002:6646-21.19.136.0", |
| 1051 |
"QuadroP400": "10de:1cb3-31.0.15.5222", |
| 1052 |
"RadeonVega6": "1002:1636-31.0.14057.5006", |
| 1053 |
"RadeonVega8": "1002:1638-31.0.21916.2", |
| 1054 |
"RTX3060": "10de:2489-32.0.15.7270", |
| 1055 |
}[b.Parts["cpu_or_gpu_value"]] |
| 1056 |
if !ok { |
| 1057 |
log.Fatalf("Entry %q not found in Win GPU mapping.", b.Parts["cpu_or_gpu_value"]) |
| 1058 |
} |
| 1059 |
// TODO(borenet): Remove this block once these machines are all |
| 1060 |
// migrated. |
| 1061 |
if b.Os("Win10") && b.Parts["cpu_or_gpu_value"] == "RTX3060" { |
| 1062 |
gpu = "10de:2489-32.0.15.6094" |
| 1063 |
} |
| 1064 |
d["gpu"] = gpu |
| 1065 |
} else if b.IsLinux() { |
| 1066 |
gpu, ok := map[string]string{ |
| 1067 |
// Intel drivers come from CIPD, so no need to specify the version here. |
| 1068 |
"IntelHD405": "8086:22b1", |
| 1069 |
// The version is not set on these as of Nov 5 2025 |
| 1070 |
"QuadroP400": "10de:1cb3", |
| 1071 |
"IntelIrisXe": "8086:9a49", |
| 1072 |
"RadeonVega8": "1002:1638-23.2.1", |
| 1073 |
}[b.Parts["cpu_or_gpu_value"]] |
| 1074 |
if !ok { |
| 1075 |
log.Fatalf("Entry %q not found in Linux GPU mapping.", b.Parts["cpu_or_gpu_value"]) |
| 1076 |
} |
| 1077 |
d["gpu"] = gpu |
| 1078 |
} else if b.MatchOs("Mac") { |
| 1079 |
gpu, ok := map[string]string{ |
| 1080 |
"AppleM1": "AppleM1", |
| 1081 |
"AppleM3": "apple:m3", |
| 1082 |
"AppleM4": "apple:m4", |
| 1083 |
"IntelHD6000": "8086:1626", |
| 1084 |
"IntelHD615": "8086:591e", |
| 1085 |
"IntelIris5100": "8086:0a2e", |
| 1086 |
"IntelIrisPlus": "8086:8a53", |
| 1087 |
"IntelUHDGraphics630": "8086:3e9b", |
| 1088 |
"RadeonHD8870M": "1002:6821-4.0.20-3.2.8", |
| 1089 |
}[b.Parts["cpu_or_gpu_value"]] |
| 1090 |
if !ok { |
| 1091 |
log.Fatalf("Entry %q not found in Mac GPU mapping.", b.Parts["cpu_or_gpu_value"]) |
| 1092 |
} |
| 1093 |
if gpu == "AppleM1" { |
| 1094 |
// No GPU dimension yet, but we can constrain by CPU. |
| 1095 |
d["cpu"] = "arm64-64-Apple_M1" |
| 1096 |
} else { |
| 1097 |
d["gpu"] = gpu |
| 1098 |
} |
| 1099 |
// We have two different types of MacMini7,1 with the same GPU but different CPUs. |
| 1100 |
if b.GPU("IntelIris5100") { |
| 1101 |
if b.ExtraConfig("i5") { |
| 1102 |
// If we say "i5", run on our MacMini7,1s in the Skolo: |
| 1103 |
d["cpu"] = "x86-64-i5-4278U" |
| 1104 |
} else { |
| 1105 |
// Otherwise, run on Golo machines, just because that's |
| 1106 |
// where those jobs have always run. Plus, some of them |
| 1107 |
// are Perf jobs, which we want to keep consistent. |
| 1108 |
d["cpu"] = "x86-64-i7-4578U" |
| 1109 |
} |
| 1110 |
} |
| 1111 |
} else { |
| 1112 |
log.Fatalf("Unknown GPU mapping for OS %q.", b.Parts["os"]) |
| 1113 |
} |
| 1114 |
} |
| 1115 |
if b.MatchOs("Mac") { |
| 1116 |
// TODO(borenet): Remove empty and nested entries after all Macs |
| 1117 |
// are migrated to the new lab. |
| 1118 |
if macModel, ok := map[string]interface{}{ |
| 1119 |
"MacBookAir7.2": "", |
| 1120 |
"MacBookPro11.5": "MacBookPro11,5", |
| 1121 |
"MacBookPro15.1": "MacBookPro15,1", |
| 1122 |
"MacBookPro15.3": "Mac15,3", |
| 1123 |
"MacBookPro16.2": "", |
| 1124 |
"MacMini7.1": "", |
| 1125 |
"MacMini8.1": "Macmini8,1", |
| 1126 |
"MacMini9.1": map[string]string{ |
| 1127 |
"Mac12": "", |
| 1128 |
"Mac13": "", |
| 1129 |
"Mac14": "Macmini9,1", |
| 1130 |
}, |
| 1131 |
"MacMini16.10": "Mac16,10", |
| 1132 |
// TODO(borenet): This is currently resolving to multiple |
| 1133 |
// different actual device types. |
| 1134 |
"VMware7.1": "", |
| 1135 |
}[b.Parts["model"]]; ok { |
| 1136 |
if macModel != "" { |
| 1137 |
macModelDim, ok := macModel.(string) |
| 1138 |
if !ok { |
| 1139 |
macModelDim = macModel.(map[string]string)[b.Parts["os"]] |
| 1140 |
} |
| 1141 |
if macModelDim != "" { |
| 1142 |
d["mac_model"] = macModelDim |
| 1143 |
} |
| 1144 |
} |
| 1145 |
} else { |
| 1146 |
log.Fatalf("No mac_model found for %q", b.Parts["model"]) |
| 1147 |
} |
| 1148 |
} |
| 1149 |
} else { |
| 1150 |
d["gpu"] = "none" |
| 1151 |
if d["os"] == DEFAULT_OS_LINUX_GCE { |
| 1152 |
if b.ExtraConfig("CanvasKit", "CMake", "Docker") || b.Role("BuildStats", "CodeSize") { |
| 1153 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 1154 |
} else { |
| 1155 |
// Use many-core machines for Build tasks. |
| 1156 |
b.linuxGceDimensions(MACHINE_TYPE_LARGE) |
| 1157 |
} |
| 1158 |
} else if d["os"] == DEFAULT_OS_WIN_GCE { |
| 1159 |
// Windows CPU bots. |
| 1160 |
d["cpu"] = "x86-64-Haswell_GCE" |
| 1161 |
d["gce"] = "1" |
| 1162 |
// Use many-core machines for Build tasks. |
| 1163 |
d["machine_type"] = MACHINE_TYPE_LARGE |
| 1164 |
} else if d["os"] == DEFAULT_OS_MAC { |
| 1165 |
if b.MatchExtraConfig("iOS") { |
| 1166 |
// TODO(borenet): Remove this special case (and the associated |
| 1167 |
// machines) once the new machines have the certs needed to |
| 1168 |
// build for iOS. |
| 1169 |
d["os"] = "Mac-14.5" |
| 1170 |
d["cpu"] = "x86-64" |
| 1171 |
d["cores"] = "12" |
| 1172 |
delete(d, "gpu") |
| 1173 |
} else { |
| 1174 |
d["mac_model"] = "Mac16,10" |
| 1175 |
delete(d, "gpu") |
| 1176 |
} |
| 1177 |
} |
| 1178 |
} |
| 1179 |
|
| 1180 |
dims := make([]string, 0, len(d)) |
| 1181 |
for k, v := range d { |
| 1182 |
dims = append(dims, fmt.Sprintf("%s:%s", k, v)) |
| 1183 |
} |
| 1184 |
sort.Strings(dims) |
| 1185 |
b.dimension(dims...) |
| 1186 |
} |
| 1187 |
|
| 1188 |
// bundleRecipes generates the task to bundle and isolate the recipes. Returns |
| 1189 |
// the name of the task, which may be added as a dependency. |
| 1190 |
func (b *jobBuilder) bundleRecipes() string { |
| 1191 |
b.addTask(BUNDLE_RECIPES_NAME, func(b *TaskBuilder) { |
| 1192 |
b.usesGit() |
| 1193 |
b.cmd("/bin/bash", "skia/infra/bots/bundle_recipes.sh", specs.PLACEHOLDER_ISOLATED_OUTDIR) |
| 1194 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1195 |
b.idempotent() |
| 1196 |
b.cas(CAS_RECIPES) |
| 1197 |
b.usesPython() |
| 1198 |
}) |
| 1199 |
return BUNDLE_RECIPES_NAME |
| 1200 |
} |
| 1201 |
|
| 1202 |
// buildTaskDrivers generates the task to compile the task driver code to run on |
| 1203 |
// all platforms. Returns the name of the task, which may be added as a |
| 1204 |
// dependency. |
| 1205 |
func (b *jobBuilder) buildTaskDrivers(goos, goarch string) string { |
| 1206 |
name := BUILD_TASK_DRIVERS_PREFIX + "_" + goos + "_" + goarch |
| 1207 |
b.addTask(name, func(b *TaskBuilder) { |
| 1208 |
b.cmd( |
| 1209 |
"luci-auth", "context", |
| 1210 |
"/bin/bash", "skia/infra/bots/build_task_drivers.sh", |
| 1211 |
specs.PLACEHOLDER_ISOLATED_OUTDIR, |
| 1212 |
goos+"_"+goarch) |
| 1213 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 1214 |
b.usesBazel("linux_x64") |
| 1215 |
b.usesLUCIAuth() |
| 1216 |
b.idempotent() |
| 1217 |
b.cas(CAS_TASK_DRIVERS) |
| 1218 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 1219 |
}) |
| 1220 |
return name |
| 1221 |
} |
| 1222 |
|
| 1223 |
var iosRegex = regexp.MustCompile(`os:iOS-(.*)`) |
| 1224 |
|
| 1225 |
func (b *TaskBuilder) maybeAddIosDevImage() { |
| 1226 |
for _, dim := range b.Spec.Dimensions { |
| 1227 |
if m := iosRegex.FindStringSubmatch(dim); len(m) >= 2 { |
| 1228 |
var asset string |
| 1229 |
switch m[1] { |
| 1230 |
// Other patch versions can be added to the same case. |
| 1231 |
case "11.4.1": |
| 1232 |
asset = "ios-dev-image-11.4" |
| 1233 |
case "13.3.1": |
| 1234 |
asset = "ios-dev-image-13.3" |
| 1235 |
case "13.4.1": |
| 1236 |
asset = "ios-dev-image-13.4" |
| 1237 |
case "13.5.1": |
| 1238 |
asset = "ios-dev-image-13.5" |
| 1239 |
case "13.6": |
| 1240 |
asset = "ios-dev-image-13.6" |
| 1241 |
case "18.2.1", "18.4": |
| 1242 |
// Newer iOS versions don't use a pre-packaged dev image. |
| 1243 |
default: |
| 1244 |
log.Fatalf("Unable to determine correct ios-dev-image asset for %s. If %s is a new iOS release, you must add a CIPD package containing the corresponding iOS dev image; see ios-dev-image-11.4 for an example.", b.Name, m[1]) |
| 1245 |
} |
| 1246 |
if asset != "" { |
| 1247 |
b.asset(asset) |
| 1248 |
} |
| 1249 |
break |
| 1250 |
} else if strings.Contains(dim, "iOS") { |
| 1251 |
log.Fatalf("Must specify iOS version for %s to obtain correct dev image; os dimension is missing version: %s", b.Name, dim) |
| 1252 |
} |
| 1253 |
} |
| 1254 |
} |
| 1255 |
|
| 1256 |
// compile generates a compile task. Returns the name of the compile task. |
| 1257 |
func (b *jobBuilder) compile() string { |
| 1258 |
name := b.deriveCompileTaskName() |
| 1259 |
if b.ExtraConfig("WasmGMTests") { |
| 1260 |
b.compileWasmGMTests(name) |
| 1261 |
} else { |
| 1262 |
b.addTask(name, func(b *TaskBuilder) { |
| 1263 |
recipe := "compile" |
| 1264 |
casSpec := CAS_COMPILE |
| 1265 |
if b.ExtraConfig("NoDEPS", "CMake", "Flutter", "NoPatch") || b.shellsOutToBazel() { |
| 1266 |
recipe = "sync_and_compile" |
| 1267 |
casSpec = CAS_RUN_RECIPE |
| 1268 |
b.recipeProps(EXTRA_PROPS) |
| 1269 |
b.usesGit() |
| 1270 |
if !b.ExtraConfig("NoDEPS") { |
| 1271 |
b.cache(CACHES_WORKDIR...) |
| 1272 |
} |
| 1273 |
} else { |
| 1274 |
b.idempotent() |
| 1275 |
} |
| 1276 |
if b.ExtraConfig("NoPatch") { |
| 1277 |
b.kitchenTask(recipe, OUTPUT_BUILD_NOPATCH) |
| 1278 |
} else { |
| 1279 |
b.kitchenTask(recipe, OUTPUT_BUILD) |
| 1280 |
} |
| 1281 |
b.cas(casSpec) |
| 1282 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 1283 |
b.swarmDimensions() |
| 1284 |
if b.ExtraConfig("Docker", "LottieWeb", "CMake") || b.Compiler("EMCC") { |
| 1285 |
b.usesDocker() |
| 1286 |
b.cache(CACHES_DOCKER...) |
| 1287 |
} |
| 1288 |
if b.ExtraConfig("Dawn") { |
| 1289 |
// https://dawn.googlesource.com/dawn/+/516701da8184655a47c92a573cc84da7db5e69d4/generator/dawn_version_generator.py#21 |
| 1290 |
b.usesGit() |
| 1291 |
b.usesCMake() |
| 1292 |
} |
| 1293 |
|
| 1294 |
// Android bots require a toolchain. |
| 1295 |
if b.ExtraConfig("Android") { |
| 1296 |
if b.MatchOs("Mac") { |
| 1297 |
b.asset("android_ndk_darwin") |
| 1298 |
} else if b.MatchOs("Win") { |
| 1299 |
pkg := b.MustGetCipdPackageFromAsset("android_ndk_windows") |
| 1300 |
pkg.Path = "n" |
| 1301 |
b.cipd(pkg) |
| 1302 |
} else { |
| 1303 |
b.asset("android_ndk_linux") |
| 1304 |
} |
| 1305 |
} else if b.ExtraConfig("Chromebook") { |
| 1306 |
b.asset("clang_linux") |
| 1307 |
if b.Arch("x86_64") { |
| 1308 |
b.asset("chromebook_x86_64_gles") |
| 1309 |
} else if b.Arch("arm") { |
| 1310 |
b.asset("armhf_sysroot") |
| 1311 |
b.asset("chromebook_arm_gles") |
| 1312 |
} else if b.Arch("arm64") { |
| 1313 |
b.asset("arm64_sysroot") |
| 1314 |
b.asset("chromebook_arm64_gles") |
| 1315 |
} else { |
| 1316 |
panic(fmt.Sprintf("Unknown arch %q for Chromebook", b.Parts["arch"])) |
| 1317 |
} |
| 1318 |
} else if b.IsLinux() { |
| 1319 |
if b.Compiler("Clang") { |
| 1320 |
if b.ExtraConfig("MSAN") { |
| 1321 |
b.asset("clang_ubuntu_noble") |
| 1322 |
} else { |
| 1323 |
b.asset("clang_linux") |
| 1324 |
} |
| 1325 |
} |
| 1326 |
if b.ExtraConfig("SwiftShader") { |
| 1327 |
b.usesCMake() |
| 1328 |
} |
| 1329 |
b.asset("ccache_linux") |
| 1330 |
b.usesCCache() |
| 1331 |
if b.shellsOutToBazel() { |
| 1332 |
b.usesBazel("linux_x64") |
| 1333 |
b.attempts(1) |
| 1334 |
} |
| 1335 |
} else if b.MatchOs("Win") { |
| 1336 |
b.asset("win_toolchain") |
| 1337 |
if b.Compiler("Clang") { |
| 1338 |
b.asset("clang_win") |
| 1339 |
} |
| 1340 |
if b.ExtraConfig("DWriteCore") { |
| 1341 |
b.asset("dwritecore") |
| 1342 |
} |
| 1343 |
} else if b.MatchOs("Mac") { |
| 1344 |
b.usesXCode() |
| 1345 |
// b.asset("ccache_mac") |
| 1346 |
// b.usesCCache() |
| 1347 |
if b.MatchExtraConfig("iOS.*") { |
| 1348 |
b.asset("provisioning_profile_ios") |
| 1349 |
} |
| 1350 |
if b.shellsOutToBazel() { |
| 1351 |
// All of our current Mac compile machines are arm64 Mac only. |
| 1352 |
b.usesBazel("mac_arm64") |
| 1353 |
b.attempts(1) |
| 1354 |
} |
| 1355 |
} |
| 1356 |
}) |
| 1357 |
} |
| 1358 |
|
| 1359 |
// All compile tasks are runnable as their own Job. Assert that the Job |
| 1360 |
// is listed in jobs. |
| 1361 |
if !In(name, b.jobs) { |
| 1362 |
log.Fatalf("Job %q is missing from the jobs list! Derived from: %q", name, b.Name) |
| 1363 |
} |
| 1364 |
|
| 1365 |
return name |
| 1366 |
} |
| 1367 |
|
| 1368 |
// recreateSKPs generates a RecreateSKPs task. |
| 1369 |
func (b *jobBuilder) recreateSKPs() { |
| 1370 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1371 |
cmd := []string{ |
| 1372 |
b.taskDriver("recreate_skps", false), |
| 1373 |
"--local=false", |
| 1374 |
"--project_id", "skia-swarming-bots", |
| 1375 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1376 |
"--task_name", b.Name, |
| 1377 |
"--skia_revision", specs.PLACEHOLDER_REVISION, |
| 1378 |
"--patch_ref", specs.PLACEHOLDER_PATCH_REF, |
| 1379 |
"--git_cache", "cache/git", |
| 1380 |
"--checkout_root", "cache/work", |
| 1381 |
"--dm_path", "build/dm", |
| 1382 |
} |
| 1383 |
if b.MatchExtraConfig("DryRun") { |
| 1384 |
cmd = append(cmd, "--dry_run") |
| 1385 |
} |
| 1386 |
|
| 1387 |
b.cas(CAS_RECREATE_SKPS) |
| 1388 |
// We use a build task To get DM. |
| 1389 |
b.dep("Build-Ubuntu24.04-Clang-x86_64-Release") |
| 1390 |
b.cmd(cmd...) |
| 1391 |
b.usesLUCIAuth() |
| 1392 |
b.serviceAccount(b.cfg.ServiceAccountRecreateSKPs) |
| 1393 |
b.dimension( |
| 1394 |
"pool:Skia", |
| 1395 |
"cpu:x86-64-Haswell_GCE", |
| 1396 |
// TODO(borenet): It'd be much faster to run this on n1-highcpu-64, |
| 1397 |
// for which we do have have capacity, but the task gets OOM-killed |
| 1398 |
// while building Chrome, presumably because the ratio of RAM to CPU |
| 1399 |
// cores is too low. |
| 1400 |
"machine_type:n1-standard-16", |
| 1401 |
"gce:1", |
| 1402 |
fmt.Sprintf("os:%s", DEFAULT_OS_LINUX_GCE), |
| 1403 |
) |
| 1404 |
b.usesGo() |
| 1405 |
b.cache(CACHES_WORKDIR...) |
| 1406 |
b.timeout(8 * time.Hour) |
| 1407 |
b.usesPython() |
| 1408 |
b.attempts(2) |
| 1409 |
}) |
| 1410 |
} |
| 1411 |
|
| 1412 |
// checkGeneratedFiles verifies that no generated SKSL files have been edited by hand, and that |
| 1413 |
// we do not get any diffs after regenerating all files (go generate, Gazelle, etc.). |
| 1414 |
func (b *jobBuilder) checkGeneratedFiles() { |
| 1415 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1416 |
b.cas(CAS_BAZEL) |
| 1417 |
b.cmd( |
| 1418 |
"luci-auth", "context", |
| 1419 |
b.taskDriver("check_generated_files", false), |
| 1420 |
"--local=false", |
| 1421 |
"--git_path=cipd_bin_packages/git", |
| 1422 |
"--project_id", "skia-swarming-bots", |
| 1423 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1424 |
"--task_name", b.Name, |
| 1425 |
"--bazel_cache_dir", bazelCacheDirOnGCELinux, |
| 1426 |
"--bazel_arg=--config=for_linux_x64_with_rbe", |
| 1427 |
"--bazel_arg=--jobs=100", |
| 1428 |
) |
| 1429 |
b.usesBazel("linux_x64") |
| 1430 |
b.usesGit() |
| 1431 |
b.usesLUCIAuth() |
| 1432 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 1433 |
b.serviceAccount(b.cfg.ServiceAccountHousekeeper) |
| 1434 |
}) |
| 1435 |
} |
| 1436 |
|
| 1437 |
// goLinters runs various Go linters (gofmt, errcheck, etc.) and fails if there are any errors or |
| 1438 |
// diffs. |
| 1439 |
func (b *jobBuilder) goLinters() { |
| 1440 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1441 |
b.cas(CAS_BAZEL) |
| 1442 |
b.cmd( |
| 1443 |
"luci-auth", "context", |
| 1444 |
b.taskDriver("go_linters", false), |
| 1445 |
"--local=false", |
| 1446 |
"--git_path=cipd_bin_packages/git", |
| 1447 |
"--project_id", "skia-swarming-bots", |
| 1448 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1449 |
"--task_name", b.Name, |
| 1450 |
"--bazel_cache_dir", bazelCacheDirOnGCELinux, |
| 1451 |
"--bazel_arg=--config=for_linux_x64_with_rbe", |
| 1452 |
"--bazel_arg=--jobs=100", |
| 1453 |
) |
| 1454 |
b.usesBazel("linux_x64") |
| 1455 |
b.usesGit() |
| 1456 |
b.usesLUCIAuth() |
| 1457 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 1458 |
b.serviceAccount(b.cfg.ServiceAccountHousekeeper) |
| 1459 |
}) |
| 1460 |
} |
| 1461 |
|
| 1462 |
// checkGnToBp verifies that the gn_to_bp.py script continues to work. |
| 1463 |
func (b *jobBuilder) checkGnToBp() { |
| 1464 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1465 |
b.cas(CAS_COMPILE) |
| 1466 |
b.cmd( |
| 1467 |
b.taskDriver("run_gn_to_bp", false), |
| 1468 |
"--local=false", |
| 1469 |
"--project_id", "skia-swarming-bots", |
| 1470 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1471 |
"--task_name", b.Name, |
| 1472 |
) |
| 1473 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1474 |
b.usesPython() |
| 1475 |
b.serviceAccount(b.cfg.ServiceAccountHousekeeper) |
| 1476 |
}) |
| 1477 |
} |
| 1478 |
|
| 1479 |
// housekeeper generates a Housekeeper task. |
| 1480 |
func (b *jobBuilder) housekeeper() { |
| 1481 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1482 |
b.recipeProps(EXTRA_PROPS) |
| 1483 |
b.kitchenTask("housekeeper", OUTPUT_NONE) |
| 1484 |
b.serviceAccount(b.cfg.ServiceAccountHousekeeper) |
| 1485 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1486 |
b.usesGit() |
| 1487 |
b.cache(CACHES_WORKDIR...) |
| 1488 |
}) |
| 1489 |
} |
| 1490 |
|
| 1491 |
// g3FrameworkCanary generates a G3 Framework Canary task. Returns |
| 1492 |
// the name of the last task in the generated chain of tasks, which the Job |
| 1493 |
// should add as a dependency. |
| 1494 |
func (b *jobBuilder) g3FrameworkCanary() { |
| 1495 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1496 |
b.cas(CAS_EMPTY) |
| 1497 |
b.cmd( |
| 1498 |
b.taskDriver("g3_canary", false), |
| 1499 |
"--local=false", |
| 1500 |
"--project_id", "skia-swarming-bots", |
| 1501 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1502 |
"--task_name", b.Name, |
| 1503 |
"--repo", specs.PLACEHOLDER_REPO, |
| 1504 |
"--revision", specs.PLACEHOLDER_REVISION, |
| 1505 |
"--patch_issue", specs.PLACEHOLDER_ISSUE, |
| 1506 |
"--patch_set", specs.PLACEHOLDER_PATCHSET, |
| 1507 |
"--patch_server", specs.PLACEHOLDER_CODEREVIEW_SERVER, |
| 1508 |
) |
| 1509 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1510 |
b.usesLUCIAuth() |
| 1511 |
b.serviceAccount("skia-g3-framework-compile@skia-swarming-bots.iam.gserviceaccount.com") |
| 1512 |
b.timeout(3 * time.Hour) |
| 1513 |
b.attempts(1) |
| 1514 |
}) |
| 1515 |
} |
| 1516 |
|
| 1517 |
// infra generates an infra_tests task. |
| 1518 |
func (b *jobBuilder) infra() { |
| 1519 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1520 |
if b.MatchOs("Win") || b.MatchExtraConfig("Win") { |
| 1521 |
b.dimension( |
| 1522 |
// Specify CPU to avoid running builds on bots with a more unique CPU. |
| 1523 |
"cpu:x86-64-Haswell_GCE", |
| 1524 |
"gpu:none", |
| 1525 |
fmt.Sprintf("machine_type:%s", MACHINE_TYPE_MEDIUM), // We don't have any small Windows instances. |
| 1526 |
fmt.Sprintf("os:%s", DEFAULT_OS_WIN_GCE), |
| 1527 |
fmt.Sprintf("pool:%s", b.cfg.Pool), |
| 1528 |
) |
| 1529 |
} else { |
| 1530 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1531 |
} |
| 1532 |
b.recipeProp("repository", specs.PLACEHOLDER_REPO) |
| 1533 |
b.kitchenTask("infra", OUTPUT_NONE) |
| 1534 |
b.cas(CAS_WHOLE_REPO) |
| 1535 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 1536 |
b.usesGSUtil() |
| 1537 |
b.idempotent() |
| 1538 |
b.usesGo() |
| 1539 |
}) |
| 1540 |
} |
| 1541 |
|
| 1542 |
// buildstats generates a builtstats task, which compiles code and generates |
| 1543 |
// statistics about the build. |
| 1544 |
func (b *jobBuilder) buildstats() { |
| 1545 |
compileTaskName := b.compile() |
| 1546 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1547 |
b.recipeProps(EXTRA_PROPS) |
| 1548 |
b.kitchenTask("compute_buildstats", OUTPUT_PERF) |
| 1549 |
b.dep(compileTaskName) |
| 1550 |
b.asset("bloaty") |
| 1551 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 1552 |
b.usesDocker() |
| 1553 |
b.usesGit() |
| 1554 |
b.cache(CACHES_WORKDIR...) |
| 1555 |
}) |
| 1556 |
// Upload release results (for tracking in perf) |
| 1557 |
// We have some jobs that are FYI (e.g. Debug-CanvasKit, tree-map generator) |
| 1558 |
if b.Release() && !b.Arch("x86_64") { |
| 1559 |
uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, b.jobNameSchema.Sep, b.Name) |
| 1560 |
depName := b.Name |
| 1561 |
b.addTask(uploadName, func(b *TaskBuilder) { |
| 1562 |
b.recipeProp("gs_bucket", b.cfg.GsBucketNano) |
| 1563 |
b.recipeProps(EXTRA_PROPS) |
| 1564 |
// TODO(borenet): I'm not sure why the upload task is |
| 1565 |
// using the BuildStats task name, but I've done this |
| 1566 |
// to maintain existing behavior. |
| 1567 |
b.Name = depName |
| 1568 |
b.kitchenTask("upload_buildstats_results", OUTPUT_NONE) |
| 1569 |
b.Name = uploadName |
| 1570 |
b.serviceAccount(b.cfg.ServiceAccountUploadNano) |
| 1571 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1572 |
b.usesGSUtil() |
| 1573 |
b.dep(depName) |
| 1574 |
}) |
| 1575 |
} |
| 1576 |
} |
| 1577 |
|
| 1578 |
// codesize generates a codesize task, which takes binary produced by a |
| 1579 |
// compile task, runs Bloaty against it, and uploads the resulting code size |
| 1580 |
// statistics to the GCS bucket belonging to the codesize.skia.org service. |
| 1581 |
func (b *jobBuilder) codesize() { |
| 1582 |
compileTaskName := b.compile() |
| 1583 |
compileTaskNameNoPatch := compileTaskName |
| 1584 |
if b.ExtraConfig("Android") { |
| 1585 |
compileTaskNameNoPatch += "_NoPatch" // add a second "extra config" |
| 1586 |
} else { |
| 1587 |
compileTaskNameNoPatch += "-NoPatch" // add the only "extra config" |
| 1588 |
} |
| 1589 |
|
| 1590 |
bloatyCipdPkg := b.MustGetCipdPackageFromAsset("bloaty") |
| 1591 |
|
| 1592 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1593 |
b.cas(CAS_EMPTY) |
| 1594 |
b.dep(compileTaskName) |
| 1595 |
b.dep(compileTaskNameNoPatch) |
| 1596 |
cmd := []string{ |
| 1597 |
b.taskDriver("codesize", false), |
| 1598 |
"--local=false", |
| 1599 |
"--project_id", "skia-swarming-bots", |
| 1600 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1601 |
"--task_name", b.Name, |
| 1602 |
"--compile_task_name", compileTaskName, |
| 1603 |
"--compile_task_name_no_patch", compileTaskNameNoPatch, |
| 1604 |
// Note: the binary name cannot contain dashes, otherwise the naming |
| 1605 |
// schema logic will partition it into multiple parts. |
| 1606 |
// |
| 1607 |
// If we ever need to define a CodeSize-* task for a binary with |
| 1608 |
// dashes in its name (e.g. "my-binary"), a potential workaround is to |
| 1609 |
// create a mapping from a new, non-dashed binary name (e.g. "my_binary") |
| 1610 |
// to the actual binary name with dashes. This mapping can be hardcoded |
| 1611 |
// in this function; no changes to the task driver would be necessary. |
| 1612 |
"--binary_name", b.Parts["binary_name"], |
| 1613 |
"--bloaty_cipd_version", bloatyCipdPkg.Version, |
| 1614 |
"--bloaty_binary", "bloaty/bloaty", |
| 1615 |
|
| 1616 |
"--repo", specs.PLACEHOLDER_REPO, |
| 1617 |
"--revision", specs.PLACEHOLDER_REVISION, |
| 1618 |
"--patch_issue", specs.PLACEHOLDER_ISSUE, |
| 1619 |
"--patch_set", specs.PLACEHOLDER_PATCHSET, |
| 1620 |
"--patch_server", specs.PLACEHOLDER_CODEREVIEW_SERVER, |
| 1621 |
} |
| 1622 |
if strings.Contains(compileTaskName, "Android") { |
| 1623 |
b.asset("android_ndk_linux") |
| 1624 |
cmd = append(cmd, "--strip_binary", |
| 1625 |
"android_ndk_linux/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip") |
| 1626 |
} else { |
| 1627 |
cmd = append(cmd, "--strip_binary", "/usr/bin/strip") |
| 1628 |
} |
| 1629 |
b.cmd(cmd...) |
| 1630 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1631 |
b.cache(CACHES_WORKDIR...) |
| 1632 |
b.usesLUCIAuth() |
| 1633 |
b.asset("bloaty") |
| 1634 |
b.serviceAccount("skia-external-codesize@skia-swarming-bots.iam.gserviceaccount.com") |
| 1635 |
b.timeout(20 * time.Minute) |
| 1636 |
b.attempts(1) |
| 1637 |
}) |
| 1638 |
} |
| 1639 |
|
| 1640 |
// doUpload indicates whether the given Job should upload its results. |
| 1641 |
func (b *jobBuilder) doUpload() bool { |
| 1642 |
if b.ExtraConfig("Upload") { |
| 1643 |
return true |
| 1644 |
} |
| 1645 |
for _, s := range b.cfg.NoUpload { |
| 1646 |
m, err := regexp.MatchString(s, b.Name) |
| 1647 |
if err != nil { |
| 1648 |
log.Fatal(err) |
| 1649 |
} |
| 1650 |
if m { |
| 1651 |
return false |
| 1652 |
} |
| 1653 |
} |
| 1654 |
return true |
| 1655 |
} |
| 1656 |
|
| 1657 |
// commonTestPerfAssets adds the assets needed by Test and Perf tasks. |
| 1658 |
func (b *TaskBuilder) commonTestPerfAssets() { |
| 1659 |
// Docker-based tests don't need the standard CIPD assets |
| 1660 |
if b.ExtraConfig("CanvasKit") || (b.Role("Test") && b.ExtraConfig("LottieWeb")) { |
| 1661 |
return |
| 1662 |
} |
| 1663 |
if b.Os("Android", "ChromeOS", "iOS") { |
| 1664 |
b.asset("skp", "svg", "skimage") |
| 1665 |
} else if b.ExtraConfig("OldestSupportedSkpVersion") { |
| 1666 |
b.cipd(&specs.CipdPackage{ |
| 1667 |
Name: "skia/bots/skp", |
| 1668 |
Path: "skp", |
| 1669 |
Version: fmt.Sprintf("skp_min_version:%d", oldestSupportedSkpVersion), |
| 1670 |
}) |
| 1671 |
} else { |
| 1672 |
// for desktop machines |
| 1673 |
b.asset("skimage", "skp", "svg") |
| 1674 |
} |
| 1675 |
|
| 1676 |
if b.IsLinux() && b.MatchExtraConfig("SAN") { |
| 1677 |
if b.ExtraConfig("MSAN") { |
| 1678 |
b.asset("clang_ubuntu_noble") |
| 1679 |
} else { |
| 1680 |
b.asset("clang_linux") |
| 1681 |
} |
| 1682 |
} |
| 1683 |
|
| 1684 |
if b.IsLinux() { |
| 1685 |
if b.ExtraConfig("Vulkan") { |
| 1686 |
b.asset("linux_vulkan_sdk") |
| 1687 |
} |
| 1688 |
if b.MatchGpu("Intel") { |
| 1689 |
if b.MatchGpu("IrisXe") { |
| 1690 |
b.asset("mesa_intel_driver_linux_22") |
| 1691 |
} else { |
| 1692 |
// Use this for legacy drivers that were culled in v22 of Mesa. |
| 1693 |
// https://www.phoronix.com/scan.php?page=news_item&px=Mesa-22.0-Drops-OpenSWR |
| 1694 |
b.asset("mesa_intel_driver_linux") |
| 1695 |
} |
| 1696 |
} |
| 1697 |
} |
| 1698 |
|
| 1699 |
if b.MatchOs("Win") && b.ExtraConfig("DWriteCore") { |
| 1700 |
b.asset("dwritecore") |
| 1701 |
} |
| 1702 |
} |
| 1703 |
|
| 1704 |
// directUpload adds prerequisites for uploading to GCS. |
| 1705 |
func (b *TaskBuilder) directUpload(gsBucket, serviceAccount string) { |
| 1706 |
b.recipeProp("gs_bucket", gsBucket) |
| 1707 |
b.serviceAccount(serviceAccount) |
| 1708 |
b.usesGSUtil() |
| 1709 |
} |
| 1710 |
|
| 1711 |
// dm generates a Test task using dm. |
| 1712 |
func (b *jobBuilder) dm() { |
| 1713 |
compileTaskName := "" |
| 1714 |
// LottieWeb doesn't require anything in Skia to be compiled. |
| 1715 |
if !b.ExtraConfig("LottieWeb") { |
| 1716 |
compileTaskName = b.compile() |
| 1717 |
} |
| 1718 |
directUpload := false |
| 1719 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1720 |
cas := CAS_TEST |
| 1721 |
recipe := "test" |
| 1722 |
if b.ExtraConfig("CanvasKit") { |
| 1723 |
cas = CAS_CANVASKIT |
| 1724 |
recipe = "test_canvaskit" |
| 1725 |
if b.doUpload() { |
| 1726 |
b.directUpload(b.cfg.GsBucketGm, b.cfg.ServiceAccountUploadGM) |
| 1727 |
directUpload = true |
| 1728 |
} |
| 1729 |
} else if b.ExtraConfig("LottieWeb") { |
| 1730 |
// CAS_LOTTIE_CI differs from CAS_LOTTIE_WEB in that it includes |
| 1731 |
// more of the files, especially those brought in via DEPS in the |
| 1732 |
// lottie-ci repo. The main difference between Perf.+LottieWeb and |
| 1733 |
// Test.+LottieWeb is that the former pulls in the lottie build via |
| 1734 |
// npm and the latter always tests at lottie's |
| 1735 |
// ToT. |
| 1736 |
cas = CAS_LOTTIE_CI |
| 1737 |
recipe = "test_lottie_web" |
| 1738 |
if b.doUpload() { |
| 1739 |
b.directUpload(b.cfg.GsBucketGm, b.cfg.ServiceAccountUploadGM) |
| 1740 |
directUpload = true |
| 1741 |
} |
| 1742 |
} else { |
| 1743 |
// Default recipe supports direct upload. |
| 1744 |
// TODO(skbug.com/40042855): Windows jobs are unable to extract gsutil. |
| 1745 |
// https://bugs.chromium.org/p/chromium/issues/detail?id=1192611 |
| 1746 |
if b.doUpload() && !b.MatchOs("Win") { |
| 1747 |
b.directUpload(b.cfg.GsBucketGm, b.cfg.ServiceAccountUploadGM) |
| 1748 |
directUpload = true |
| 1749 |
} |
| 1750 |
if b.MatchOs("iOS") { |
| 1751 |
b.Spec.Caches = append(b.Spec.Caches, &specs.Cache{ |
| 1752 |
Name: "xcode", |
| 1753 |
Path: "cache/Xcode.app", |
| 1754 |
}) |
| 1755 |
} |
| 1756 |
} |
| 1757 |
b.recipeProp("gold_hashes_url", b.cfg.GoldHashesURL) |
| 1758 |
b.recipeProps(EXTRA_PROPS) |
| 1759 |
iid := b.internalHardwareLabel() |
| 1760 |
iidStr := "" |
| 1761 |
if iid != nil { |
| 1762 |
iidStr = strconv.Itoa(*iid) |
| 1763 |
b.recipeProp("internal_hardware_label", iidStr) |
| 1764 |
} |
| 1765 |
if recipe == "test" { |
| 1766 |
b.dmFlags(iidStr) |
| 1767 |
} |
| 1768 |
b.kitchenTask(recipe, OUTPUT_TEST) |
| 1769 |
b.cas(cas) |
| 1770 |
b.swarmDimensions() |
| 1771 |
if b.ExtraConfig("CanvasKit", "Docker", "LottieWeb") { |
| 1772 |
b.usesDocker() |
| 1773 |
} |
| 1774 |
if compileTaskName != "" { |
| 1775 |
b.dep(compileTaskName) |
| 1776 |
} |
| 1777 |
if b.MatchOs("Android") && b.ExtraConfig("ASAN") { |
| 1778 |
b.asset("android_ndk_linux") |
| 1779 |
} |
| 1780 |
if b.ExtraConfig("NativeFonts") && !b.MatchOs("Android") { |
| 1781 |
b.needsFontsForParagraphTests() |
| 1782 |
} |
| 1783 |
if b.ExtraConfig("Fontations") { |
| 1784 |
b.cipd(&specs.CipdPackage{ |
| 1785 |
Name: "chromium/third_party/googlefonts_testdata", |
| 1786 |
Path: "googlefonts_testdata", |
| 1787 |
Version: "version:20230913", |
| 1788 |
}) |
| 1789 |
} |
| 1790 |
b.commonTestPerfAssets() |
| 1791 |
if b.MatchExtraConfig("Lottie") { |
| 1792 |
b.asset("lottie-samples") |
| 1793 |
} |
| 1794 |
b.expiration(20 * time.Hour) |
| 1795 |
|
| 1796 |
b.timeout(4 * time.Hour) |
| 1797 |
if b.ExtraConfig("MSAN") { |
| 1798 |
b.timeout(9 * time.Hour) |
| 1799 |
} else if b.Arch("x86") && b.Debug() { |
| 1800 |
// skbug.com/40037952 |
| 1801 |
b.timeout(6 * time.Hour) |
| 1802 |
} else if b.MatchOs("Mac14") { |
| 1803 |
b.timeout(30 * time.Minute) |
| 1804 |
} |
| 1805 |
b.maybeAddIosDevImage() |
| 1806 |
}) |
| 1807 |
|
| 1808 |
// Upload results if necessary. TODO(kjlubick): If we do coverage analysis at the same |
| 1809 |
// time as normal tests (which would be nice), cfg.json needs to have Coverage removed. |
| 1810 |
if b.doUpload() && !directUpload { |
| 1811 |
uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, b.jobNameSchema.Sep, b.Name) |
| 1812 |
depName := b.Name |
| 1813 |
b.addTask(uploadName, func(b *TaskBuilder) { |
| 1814 |
b.recipeProp("gs_bucket", b.cfg.GsBucketGm) |
| 1815 |
b.recipeProps(EXTRA_PROPS) |
| 1816 |
b.kitchenTask("upload_dm_results", OUTPUT_NONE) |
| 1817 |
b.serviceAccount(b.cfg.ServiceAccountUploadGM) |
| 1818 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1819 |
b.usesGSUtil() |
| 1820 |
b.dep(depName) |
| 1821 |
}) |
| 1822 |
} |
| 1823 |
} |
| 1824 |
|
| 1825 |
// canary generates a task that uses TaskDrivers to trigger canary manual rolls on autorollers. |
| 1826 |
// Canary-G3 does not use this path because it is very different from other autorollers. |
| 1827 |
func (b *jobBuilder) canary(rollerName, canaryCQKeyword, targetProjectBaseURL string) { |
| 1828 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1829 |
b.cas(CAS_EMPTY) |
| 1830 |
b.cmd( |
| 1831 |
b.taskDriver("canary", false), |
| 1832 |
"--local=false", |
| 1833 |
"--project_id", "skia-swarming-bots", |
| 1834 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1835 |
"--task_name", b.Name, |
| 1836 |
"--roller_name", rollerName, |
| 1837 |
"--cq_keyword", canaryCQKeyword, |
| 1838 |
"--target_project_base_url", targetProjectBaseURL, |
| 1839 |
"--repo", specs.PLACEHOLDER_REPO, |
| 1840 |
"--revision", specs.PLACEHOLDER_REVISION, |
| 1841 |
"--patch_issue", specs.PLACEHOLDER_ISSUE, |
| 1842 |
"--patch_set", specs.PLACEHOLDER_PATCHSET, |
| 1843 |
"--patch_server", specs.PLACEHOLDER_CODEREVIEW_SERVER, |
| 1844 |
) |
| 1845 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1846 |
b.usesLUCIAuth() |
| 1847 |
b.serviceAccount(b.cfg.ServiceAccountCanary) |
| 1848 |
b.timeout(3 * time.Hour) |
| 1849 |
b.attempts(1) |
| 1850 |
}) |
| 1851 |
} |
| 1852 |
|
| 1853 |
// puppeteer generates a task that uses TaskDrivers combined with a node script and puppeteer to |
| 1854 |
// benchmark something using Chromium (e.g. CanvasKit, LottieWeb). |
| 1855 |
func (b *jobBuilder) puppeteer() { |
| 1856 |
compileTaskName := b.compile() |
| 1857 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1858 |
b.defaultSwarmDimensions() |
| 1859 |
b.usesNode() |
| 1860 |
b.usesLUCIAuth() |
| 1861 |
b.dep(compileTaskName) |
| 1862 |
b.output(OUTPUT_PERF) |
| 1863 |
b.timeout(60 * time.Minute) |
| 1864 |
b.cas(CAS_PUPPETEER) |
| 1865 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 1866 |
|
| 1867 |
webglversion := "2" |
| 1868 |
if b.ExtraConfig("WebGL1") { |
| 1869 |
webglversion = "1" |
| 1870 |
} |
| 1871 |
|
| 1872 |
if b.ExtraConfig("SkottieFrames") { |
| 1873 |
b.cmd( |
| 1874 |
b.taskDriver("perf_puppeteer_skottie_frames", false), |
| 1875 |
"--project_id", "skia-swarming-bots", |
| 1876 |
"--git_hash", specs.PLACEHOLDER_REVISION, |
| 1877 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1878 |
"--task_name", b.Name, |
| 1879 |
"--canvaskit_bin_path", "./build", |
| 1880 |
"--lotties_path", "./lotties_with_assets", |
| 1881 |
"--node_bin_path", "./node/node/bin", |
| 1882 |
"--benchmark_path", "./tools/perf-canvaskit-puppeteer", |
| 1883 |
"--output_path", OUTPUT_PERF, |
| 1884 |
"--os_trace", b.Parts["os"], |
| 1885 |
"--model_trace", b.Parts["model"], |
| 1886 |
"--cpu_or_gpu_trace", b.Parts["cpu_or_gpu"], |
| 1887 |
"--cpu_or_gpu_value_trace", b.Parts["cpu_or_gpu_value"], |
| 1888 |
"--webgl_version", webglversion, // ignore when running with cpu backend |
| 1889 |
) |
| 1890 |
b.needsLottiesWithAssets() |
| 1891 |
} else if b.ExtraConfig("RenderSKP") { |
| 1892 |
b.cmd( |
| 1893 |
b.taskDriver("perf_puppeteer_render_skps", false), |
| 1894 |
"--project_id", "skia-swarming-bots", |
| 1895 |
"--git_hash", specs.PLACEHOLDER_REVISION, |
| 1896 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1897 |
"--task_name", b.Name, |
| 1898 |
"--canvaskit_bin_path", "./build", |
| 1899 |
"--skps_path", "./skp", |
| 1900 |
"--node_bin_path", "./node/node/bin", |
| 1901 |
"--benchmark_path", "./tools/perf-canvaskit-puppeteer", |
| 1902 |
"--output_path", OUTPUT_PERF, |
| 1903 |
"--os_trace", b.Parts["os"], |
| 1904 |
"--model_trace", b.Parts["model"], |
| 1905 |
"--cpu_or_gpu_trace", b.Parts["cpu_or_gpu"], |
| 1906 |
"--cpu_or_gpu_value_trace", b.Parts["cpu_or_gpu_value"], |
| 1907 |
"--webgl_version", webglversion, |
| 1908 |
) |
| 1909 |
b.asset("skp") |
| 1910 |
} else if b.ExtraConfig("CanvasPerf") { // refers to the canvas_perf.js test suite |
| 1911 |
b.cmd( |
| 1912 |
b.taskDriver("perf_puppeteer_canvas", false), |
| 1913 |
"--project_id", "skia-swarming-bots", |
| 1914 |
"--git_hash", specs.PLACEHOLDER_REVISION, |
| 1915 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 1916 |
"--task_name", b.Name, |
| 1917 |
"--canvaskit_bin_path", "./build", |
| 1918 |
"--node_bin_path", "./node/node/bin", |
| 1919 |
"--benchmark_path", "./tools/perf-canvaskit-puppeteer", |
| 1920 |
"--output_path", OUTPUT_PERF, |
| 1921 |
"--os_trace", b.Parts["os"], |
| 1922 |
"--model_trace", b.Parts["model"], |
| 1923 |
"--cpu_or_gpu_trace", b.Parts["cpu_or_gpu"], |
| 1924 |
"--cpu_or_gpu_value_trace", b.Parts["cpu_or_gpu_value"], |
| 1925 |
"--webgl_version", webglversion, |
| 1926 |
) |
| 1927 |
b.asset("skp") |
| 1928 |
} |
| 1929 |
|
| 1930 |
}) |
| 1931 |
|
| 1932 |
// Upload results to Perf after. |
| 1933 |
// TODO(kjlubick,borenet) deduplicate this with the logic in perf(). |
| 1934 |
uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, b.jobNameSchema.Sep, b.Name) |
| 1935 |
depName := b.Name |
| 1936 |
b.addTask(uploadName, func(b *TaskBuilder) { |
| 1937 |
b.recipeProp("gs_bucket", b.cfg.GsBucketNano) |
| 1938 |
b.recipeProps(EXTRA_PROPS) |
| 1939 |
// TODO(borenet): I'm not sure why the upload task is |
| 1940 |
// using the Perf task name, but I've done this to |
| 1941 |
// maintain existing behavior. |
| 1942 |
b.Name = depName |
| 1943 |
b.kitchenTask("upload_nano_results", OUTPUT_NONE) |
| 1944 |
b.Name = uploadName |
| 1945 |
b.serviceAccount(b.cfg.ServiceAccountUploadNano) |
| 1946 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 1947 |
b.usesGSUtil() |
| 1948 |
b.dep(depName) |
| 1949 |
}) |
| 1950 |
} |
| 1951 |
|
| 1952 |
// perf generates a Perf task. |
| 1953 |
func (b *jobBuilder) perf() { |
| 1954 |
compileTaskName := "" |
| 1955 |
// LottieWeb doesn't require anything in Skia to be compiled. |
| 1956 |
if !b.ExtraConfig("LottieWeb") { |
| 1957 |
compileTaskName = b.compile() |
| 1958 |
} |
| 1959 |
doUpload := !b.Debug() && b.doUpload() |
| 1960 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 1961 |
recipe := "perf" |
| 1962 |
cas := CAS_PERF |
| 1963 |
if b.ExtraConfig("CanvasKit") { |
| 1964 |
cas = CAS_CANVASKIT |
| 1965 |
recipe = "perf_canvaskit" |
| 1966 |
} else if b.ExtraConfig("SkottieTracing") { |
| 1967 |
recipe = "perf_skottietrace" |
| 1968 |
} else if b.ExtraConfig("SkottieWASM") { |
| 1969 |
recipe = "perf_skottiewasm_lottieweb" |
| 1970 |
cas = CAS_SKOTTIE_WASM |
| 1971 |
} else if b.ExtraConfig("LottieWeb") { |
| 1972 |
recipe = "perf_skottiewasm_lottieweb" |
| 1973 |
cas = CAS_LOTTIE_WEB |
| 1974 |
} else if b.MatchOs("iOS") { |
| 1975 |
// We need a service account in order to download the xcode CIPD |
| 1976 |
// packages. |
| 1977 |
b.serviceAccount(b.cfg.ServiceAccountUploadNano) |
| 1978 |
b.Spec.Caches = append(b.Spec.Caches, &specs.Cache{ |
| 1979 |
Name: "xcode", |
| 1980 |
Path: "cache/Xcode.app", |
| 1981 |
}) |
| 1982 |
} |
| 1983 |
b.recipeProps(EXTRA_PROPS) |
| 1984 |
if recipe == "perf" { |
| 1985 |
b.nanobenchFlags(doUpload) |
| 1986 |
} |
| 1987 |
iid := b.internalHardwareLabel() |
| 1988 |
if iid != nil { |
| 1989 |
b.recipeProp("internal_hardware_label", strconv.Itoa(*iid)) |
| 1990 |
} |
| 1991 |
b.kitchenTask(recipe, OUTPUT_PERF) |
| 1992 |
b.cas(cas) |
| 1993 |
b.swarmDimensions() |
| 1994 |
if b.ExtraConfig("Docker") { |
| 1995 |
b.usesDocker() |
| 1996 |
} |
| 1997 |
if compileTaskName != "" { |
| 1998 |
b.dep(compileTaskName) |
| 1999 |
} |
| 2000 |
b.commonTestPerfAssets() |
| 2001 |
b.expiration(20 * time.Hour) |
| 2002 |
b.timeout(4 * time.Hour) |
| 2003 |
|
| 2004 |
if b.ExtraConfig("MSAN") { |
| 2005 |
b.timeout(9 * time.Hour) |
| 2006 |
} else if b.Parts["arch"] == "x86" && b.Parts["configuration"] == "Debug" { |
| 2007 |
// skbug.com/40037952 |
| 2008 |
b.timeout(6 * time.Hour) |
| 2009 |
} else if b.MatchOs("Mac14") { |
| 2010 |
b.timeout(30 * time.Minute) |
| 2011 |
} |
| 2012 |
|
| 2013 |
if b.ExtraConfig("LottieWeb", "SkottieWASM") { |
| 2014 |
b.asset("node", "lottie-samples") |
| 2015 |
} else if b.MatchExtraConfig("SkottieTracing") { |
| 2016 |
b.needsLottiesWithAssets() |
| 2017 |
} else if b.MatchExtraConfig("Skottie") { |
| 2018 |
b.asset("lottie-samples") |
| 2019 |
} |
| 2020 |
|
| 2021 |
if b.MatchOs("Android") && b.CPU() { |
| 2022 |
b.asset("text_blob_traces") |
| 2023 |
} |
| 2024 |
b.maybeAddIosDevImage() |
| 2025 |
}) |
| 2026 |
|
| 2027 |
// Upload results if necessary. |
| 2028 |
if doUpload { |
| 2029 |
uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, b.jobNameSchema.Sep, b.Name) |
| 2030 |
depName := b.Name |
| 2031 |
b.addTask(uploadName, func(b *TaskBuilder) { |
| 2032 |
b.recipeProp("gs_bucket", b.cfg.GsBucketNano) |
| 2033 |
b.recipeProps(EXTRA_PROPS) |
| 2034 |
// TODO(borenet): I'm not sure why the upload task is |
| 2035 |
// using the Perf task name, but I've done this to |
| 2036 |
// maintain existing behavior. |
| 2037 |
b.Name = depName |
| 2038 |
b.kitchenTask("upload_nano_results", OUTPUT_NONE) |
| 2039 |
b.Name = uploadName |
| 2040 |
b.serviceAccount(b.cfg.ServiceAccountUploadNano) |
| 2041 |
b.linuxGceDimensions(MACHINE_TYPE_SMALL) |
| 2042 |
b.usesGSUtil() |
| 2043 |
b.dep(depName) |
| 2044 |
}) |
| 2045 |
} |
| 2046 |
} |
| 2047 |
|
| 2048 |
// presubmit generates a task which runs the presubmit for this repo. |
| 2049 |
func (b *jobBuilder) presubmit() { |
| 2050 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 2051 |
b.recipeProps(map[string]string{ |
| 2052 |
"category": "cq", |
| 2053 |
"patch_gerrit_url": "https://skia-review.googlesource.com", |
| 2054 |
"patch_project": "skia", |
| 2055 |
"patch_ref": specs.PLACEHOLDER_PATCH_REF, |
| 2056 |
"reason": "CQ", |
| 2057 |
"repo_name": "skia", |
| 2058 |
}) |
| 2059 |
b.recipeProps(EXTRA_PROPS) |
| 2060 |
b.kitchenTaskNoBundle("run_presubmit", OUTPUT_NONE) |
| 2061 |
b.cas(CAS_RUN_RECIPE) |
| 2062 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 2063 |
// Use MACHINE_TYPE_LARGE because it seems to save time versus |
| 2064 |
// MEDIUM and we want presubmit to be fast. |
| 2065 |
b.linuxGceDimensions(MACHINE_TYPE_LARGE) |
| 2066 |
b.usesGit() |
| 2067 |
b.cipd(&specs.CipdPackage{ |
| 2068 |
Name: "infra/recipe_bundles/chromium.googlesource.com/chromium/tools/build", |
| 2069 |
Path: "recipe_bundle", |
| 2070 |
Version: "git_revision:bb122cd16700ab80bfcbd494b605dd11d4f5902d", |
| 2071 |
}) |
| 2072 |
}) |
| 2073 |
} |
| 2074 |
|
| 2075 |
// compileWasmGMTests uses a task driver to compile the GMs and unit tests for Web Assembly (WASM). |
| 2076 |
// We can use the same build for both CPU and GPU tests since the latter requires the code for the |
| 2077 |
// former anyway. |
| 2078 |
func (b *jobBuilder) compileWasmGMTests(compileName string) { |
| 2079 |
b.addTask(compileName, func(b *TaskBuilder) { |
| 2080 |
b.attempts(1) |
| 2081 |
b.usesDocker() |
| 2082 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 2083 |
b.usesLUCIAuth() |
| 2084 |
b.output("wasm_out") |
| 2085 |
b.timeout(60 * time.Minute) |
| 2086 |
b.cas(CAS_COMPILE) |
| 2087 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 2088 |
b.cache(CACHES_DOCKER...) |
| 2089 |
// For now, we only have one compile mode - a GPU release mode. This should be sufficient to |
| 2090 |
// run CPU, WebGL1, and WebGL2 tests. Debug mode is not needed for the waterfall because |
| 2091 |
// when using puppeteer, stacktraces from exceptions are hard to get access to, so we do not |
| 2092 |
// even bother. |
| 2093 |
b.cmd( |
| 2094 |
b.taskDriver("compile_wasm_gm_tests", false), |
| 2095 |
"--project_id", "skia-swarming-bots", |
| 2096 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 2097 |
"--task_name", compileName, |
| 2098 |
"--out_path", "./wasm_out", |
| 2099 |
"--skia_path", "./skia", |
| 2100 |
"--work_path", "./cache/docker/wasm_gm", |
| 2101 |
) |
| 2102 |
}) |
| 2103 |
} |
| 2104 |
|
| 2105 |
// compileWasmGMTests uses a task driver to compile the GMs and unit tests for Web Assembly (WASM). |
| 2106 |
// We can use the same build for both CPU and GPU tests since the latter requires the code for the |
| 2107 |
// former anyway. |
| 2108 |
func (b *jobBuilder) runWasmGMTests() { |
| 2109 |
compileTaskName := b.compile() |
| 2110 |
|
| 2111 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 2112 |
b.attempts(1) |
| 2113 |
b.usesNode() |
| 2114 |
b.swarmDimensions() |
| 2115 |
b.usesLUCIAuth() |
| 2116 |
b.cipd(CIPD_PKGS_GOLDCTL) |
| 2117 |
b.dep(compileTaskName) |
| 2118 |
b.timeout(60 * time.Minute) |
| 2119 |
b.cas(CAS_WASM_GM) |
| 2120 |
b.serviceAccount(b.cfg.ServiceAccountUploadGM) |
| 2121 |
b.cmd( |
| 2122 |
b.taskDriver("run_wasm_gm_tests", false), |
| 2123 |
"--project_id", "skia-swarming-bots", |
| 2124 |
"--task_id", specs.PLACEHOLDER_TASK_ID, |
| 2125 |
"--task_name", b.Name, |
| 2126 |
"--test_harness_path", "./tools/run-wasm-gm-tests", |
| 2127 |
"--built_path", "./wasm_out", |
| 2128 |
"--node_bin_path", "./node/node/bin", |
| 2129 |
"--resource_path", "./resources", |
| 2130 |
"--work_path", "./wasm_gm/work", |
| 2131 |
"--gold_ctl_path", "./cipd_bin_packages/goldctl", |
| 2132 |
"--gold_hashes_url", b.cfg.GoldHashesURL, |
| 2133 |
"--git_commit", specs.PLACEHOLDER_REVISION, |
| 2134 |
"--changelist_id", specs.PLACEHOLDER_ISSUE, |
| 2135 |
"--patchset_order", specs.PLACEHOLDER_PATCHSET, |
| 2136 |
"--tryjob_id", specs.PLACEHOLDER_BUILDBUCKET_BUILD_ID, |
| 2137 |
// TODO(kjlubick) Make these not hard coded if we change the configs we test on. |
| 2138 |
"--webgl_version", "2", // 0 means CPU ; this flag controls cpu_or_gpu and extra_config |
| 2139 |
"--gold_key", "alpha_type:Premul", |
| 2140 |
"--gold_key", "arch:wasm", |
| 2141 |
"--gold_key", "browser:Chrome", |
| 2142 |
"--gold_key", "color_depth:8888", |
| 2143 |
"--gold_key", "config:gles", |
| 2144 |
"--gold_key", "configuration:Release", |
| 2145 |
"--gold_key", "cpu_or_gpu_value:QuadroP400", |
| 2146 |
"--gold_key", "model:Golo", |
| 2147 |
"--gold_key", "os:Ubuntu24.04", |
| 2148 |
) |
| 2149 |
}) |
| 2150 |
} |
| 2151 |
|
| 2152 |
// bazelTarget contains a Bazel label (e.g. //tests:some_test) and is open for additional fields |
| 2153 |
type bazelTarget struct { |
| 2154 |
label string |
| 2155 |
} |
| 2156 |
|
| 2157 |
// Maps a shorthand version of a label (which can be an arbitrary string) to an absolute Bazel |
| 2158 |
// label or "target pattern" https://bazel.build/docs/build#specifying-build-targets |
| 2159 |
// The reason we need this mapping is because Buildbucket build names cannot have / or : in them. |
| 2160 |
// TODO(borenet/kjlubick): Is there a way to generate a mapping using `bazel query`? |
| 2161 |
var shorthandToLabel = map[string]bazelTarget{ |
| 2162 |
"core": {"//:core"}, |
| 2163 |
"dm": {"//dm"}, |
| 2164 |
"fontations": {"//src/ports:fontmgr_fontations_empty"}, |
| 2165 |
"full_library": {"//tools:full_build"}, |
| 2166 |
"ganesh_gl": {"//:ganesh_gl"}, |
| 2167 |
"modules_canvaskit": {"//modules/canvaskit:canvaskit"}, |
| 2168 |
"modules_canvaskit_js_tests": {"//modules/canvaskit:canvaskit_js_tests"}, |
| 2169 |
"skottie_tool_gpu": {"//modules/skottie:skottie_tool_gpu"}, |
| 2170 |
"viewer": {"//tools/viewer:viewer"}, |
| 2171 |
"decode_everything": {"//example/external_client:decode_everything"}, |
| 2172 |
"path_combiner": {"//example/external_client:path_combiner"}, |
| 2173 |
"png_decoder": {"//example/external_client:png_decoder"}, |
| 2174 |
"shape_text": {"//example/external_client:shape_text"}, |
| 2175 |
"svg_with_harfbuzz": {"//example/external_client:svg_with_harfbuzz"}, |
| 2176 |
"svg_with_primitive": {"//example/external_client:svg_with_primitive"}, |
| 2177 |
"use_ganesh_gl": {"//example/external_client:use_ganesh_gl"}, |
| 2178 |
"use_ganesh_vulkan": {"//example/external_client:use_ganesh_vulkan"}, |
| 2179 |
"use_graphite_native_vulkan": {"//example/external_client:use_graphite_native_vulkan"}, |
| 2180 |
"use_skresources": {"//example/external_client:use_skresources"}, |
| 2181 |
"write_text_to_png": {"//example/external_client:write_text_to_png"}, |
| 2182 |
"write_to_pdf": {"//example/external_client:write_to_pdf"}, |
| 2183 |
"play_skottie": {"//example/external_client:play_skottie"}, |
| 2184 |
|
| 2185 |
// Currently there is no way to tell Bazel "only test go_test targets", so we must group them |
| 2186 |
// under a test_suite. |
| 2187 |
// |
| 2188 |
// Alternatives: |
| 2189 |
// |
| 2190 |
// - Use --test_lang_filters, which currently does not work for non-native rules. See |
| 2191 |
// https://github.com/bazelbuild/bazel/issues/12618. |
| 2192 |
// |
| 2193 |
// - As suggested in the same GitHub issue, "bazel query 'kind(go_test, //...)'" would normally |
| 2194 |
// return the list of labels. However, this fails due to BUILD.bazel files in |
| 2195 |
// //third_party/externals and //bazel/external/vello. We could try either fixing those files |
| 2196 |
// when possible, or adding them to //.bazelignore (either permanently or temporarily inside a |
| 2197 |
// specialized task driver just for Go tests). |
| 2198 |
// |
| 2199 |
// - Have Gazelle add a tag to all Go tests: go_test(name = "foo_test", tag = "go", ... ). Then, |
| 2200 |
// we can use a wildcard label such as //... and tell Bazel to only test those targets with |
| 2201 |
// said tag, e.g. "bazel test //... --test_tag_filters=go" |
| 2202 |
// (https://bazel.build/reference/command-line-reference#flag--test_tag_filters). Today this |
| 2203 |
// does not work due to the third party and external BUILD.bazel files mentioned in the |
| 2204 |
// previous bullet point. |
| 2205 |
"all_go_tests": {"//:all_go_tests"}, |
| 2206 |
} |
| 2207 |
|
| 2208 |
// bazelBuild adds a task which builds the specified single-target label (//foo:bar) or |
| 2209 |
// multi-target label (//foo/...) using Bazel. Depending on the host we run this on, we may |
| 2210 |
// specify additional Bazel args to build faster. Optionally, a subset of the //bazel-bin directory |
| 2211 |
// will be stored into CAS for use by subsequent tasks. |
| 2212 |
func (b *jobBuilder) bazelBuild() { |
| 2213 |
shorthand, config, host := b.Parts.BazelBuildParts() |
| 2214 |
target, ok := shorthandToLabel[shorthand] |
| 2215 |
if !ok { |
| 2216 |
panic("unsupported Bazel label shorthand " + shorthand) |
| 2217 |
} |
| 2218 |
|
| 2219 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 2220 |
bazelCacheDir, ok := map[string]string{ |
| 2221 |
// We only run builds in GCE. |
| 2222 |
"linux_x64": bazelCacheDirOnGCELinux, |
| 2223 |
"mac_arm64": bazelCacheDirOnMac, |
| 2224 |
"windows_x64": bazelCacheDirOnWindows, |
| 2225 |
}[host] |
| 2226 |
if !ok { |
| 2227 |
panic("unknown Bazel cache dir for Bazel host " + host) |
| 2228 |
} |
| 2229 |
|
| 2230 |
// Bazel git_repository rules shell out to git. Use the version from |
| 2231 |
// CIPD to ensure that we're not using an old locally-installed version. |
| 2232 |
b.usesGit() |
| 2233 |
b.addToPATH("cipd_bin_packages", "cipd_bin_packages/bin") |
| 2234 |
b.usesLUCIAuth() |
| 2235 |
|
| 2236 |
cmd := []string{ |
| 2237 |
"luci-auth", "context", |
| 2238 |
b.taskDriver("bazel_build", host != "windows_x64"), |
| 2239 |
"--project_id=skia-swarming-bots", |
| 2240 |
"--task_id=" + specs.PLACEHOLDER_TASK_ID, |
| 2241 |
"--task_name=" + b.Name, |
| 2242 |
"--bazel_label=" + target.label, |
| 2243 |
"--bazel_config=" + config, |
| 2244 |
"--bazel_cache_dir=" + bazelCacheDir, |
| 2245 |
"--workdir=./skia", |
| 2246 |
} |
| 2247 |
|
| 2248 |
if host == "linux_x64" { |
| 2249 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 2250 |
b.usesBazel("linux_x64") |
| 2251 |
// We want all Linux Bazel Builds to use RBE |
| 2252 |
cmd = append(cmd, "--bazel_arg=--config=for_linux_x64_with_rbe") |
| 2253 |
cmd = append(cmd, "--bazel_arg=--jobs=100") |
| 2254 |
cmd = append(cmd, "--bazel_arg=--remote_download_minimal") |
| 2255 |
} else if host == "windows_x64" { |
| 2256 |
b.dimension( |
| 2257 |
"cpu:x86-64-Haswell_GCE", |
| 2258 |
"gpu:none", |
| 2259 |
fmt.Sprintf("machine_type:%s", MACHINE_TYPE_LARGE), |
| 2260 |
fmt.Sprintf("os:%s", DEFAULT_OS_WIN_GCE), |
| 2261 |
"pool:Skia", |
| 2262 |
) |
| 2263 |
b.usesBazel("windows_x64") |
| 2264 |
cmd = append(cmd, "--bazel_arg=--experimental_scale_timeouts=2.0") |
| 2265 |
} else if host == "mac_arm64" { |
| 2266 |
b.usesBazel("mac_arm64") |
| 2267 |
b.dimension("cpu:arm64-64-Apple_M4", "pool:Skia") |
| 2268 |
b.usesXCode() |
| 2269 |
} else { |
| 2270 |
panic("unsupported Bazel host " + host) |
| 2271 |
} |
| 2272 |
b.cmd(cmd...) |
| 2273 |
|
| 2274 |
b.idempotent() |
| 2275 |
b.cas(CAS_BAZEL) |
| 2276 |
b.attempts(1) |
| 2277 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 2278 |
}) |
| 2279 |
} |
| 2280 |
|
| 2281 |
type precompiledBazelTestKind int |
| 2282 |
|
| 2283 |
const ( |
| 2284 |
precompiledBazelTestNone precompiledBazelTestKind = iota |
| 2285 |
precompiledBenchmarkTest |
| 2286 |
precompiledGMTest |
| 2287 |
precompiledUnitTest |
| 2288 |
) |
| 2289 |
|
| 2290 |
func (b *jobBuilder) bazelTest() { |
| 2291 |
taskdriverName, shorthand, buildConfig, host, testConfig := b.Parts.BazelTestParts() |
| 2292 |
labelAndSavedOutputDir, ok := shorthandToLabel[shorthand] |
| 2293 |
if !ok { |
| 2294 |
panic("unsupported Bazel label shorthand " + shorthand) |
| 2295 |
} |
| 2296 |
|
| 2297 |
// Expand task driver name to keep task names short. |
| 2298 |
useLUCIAuth := true |
| 2299 |
if taskdriverName == "external_client" { |
| 2300 |
useLUCIAuth = false |
| 2301 |
} |
| 2302 |
|
| 2303 |
var deviceSpecificBazelConfig *device_specific_configs.Config |
| 2304 |
if testConfig != "" { |
| 2305 |
if config, ok := device_specific_configs.Configs[testConfig]; ok { |
| 2306 |
deviceSpecificBazelConfig = &config |
| 2307 |
} else { |
| 2308 |
panic(fmt.Sprintf("Unknown device-specific Bazel config: %q", testConfig)) |
| 2309 |
} |
| 2310 |
} |
| 2311 |
|
| 2312 |
bazelCacheDir := bazelCacheDirOnGCELinux |
| 2313 |
if deviceSpecificBazelConfig != nil && deviceSpecificBazelConfig.Keys["model"] != "GCE" { |
| 2314 |
bazelCacheDir = bazelCacheDirOnSkoloLinux |
| 2315 |
} |
| 2316 |
|
| 2317 |
b.addTask(b.Name, func(b *TaskBuilder) { |
| 2318 |
cmd := []string{} |
| 2319 |
if useLUCIAuth { |
| 2320 |
cmd = []string{"luci-auth", "context"} |
| 2321 |
} |
| 2322 |
cmd = append(cmd, |
| 2323 |
b.taskDriver(taskdriverName, false), |
| 2324 |
"--project_id=skia-swarming-bots", |
| 2325 |
"--task_id="+specs.PLACEHOLDER_TASK_ID, |
| 2326 |
"--task_name="+b.Name, |
| 2327 |
"--workdir=.", |
| 2328 |
) |
| 2329 |
b.usesLUCIAuth() |
| 2330 |
|
| 2331 |
switch taskdriverName { |
| 2332 |
case "canvaskit_gold": |
| 2333 |
cmd = append(cmd, |
| 2334 |
"--bazel_label="+labelAndSavedOutputDir.label, |
| 2335 |
"--bazel_config="+buildConfig, |
| 2336 |
"--bazel_cache_dir="+bazelCacheDir, |
| 2337 |
"--goldctl_path=./cipd_bin_packages/goldctl", |
| 2338 |
"--git_commit="+specs.PLACEHOLDER_REVISION, |
| 2339 |
"--changelist_id="+specs.PLACEHOLDER_ISSUE, |
| 2340 |
"--patchset_order="+specs.PLACEHOLDER_PATCHSET, |
| 2341 |
"--tryjob_id="+specs.PLACEHOLDER_BUILDBUCKET_BUILD_ID) |
| 2342 |
b.cipd(CIPD_PKGS_GOLDCTL) |
| 2343 |
switch buildConfig { |
| 2344 |
case "ck_full_cpu_release_chrome": |
| 2345 |
cmd = append(cmd, "--cpu_or_gpu=CPU", "--cpu_or_gpu_value=CPU", |
| 2346 |
"--compilation_mode=Release", "--browser=Chrome") |
| 2347 |
case "ck_full_webgl2_release_chrome": |
| 2348 |
cmd = append(cmd, "--cpu_or_gpu=GPU", "--cpu_or_gpu_value=WebGL2", |
| 2349 |
"--compilation_mode=Release", "--browser=Chrome") |
| 2350 |
default: |
| 2351 |
panic("Gold keys not specified for config " + buildConfig) |
| 2352 |
} |
| 2353 |
|
| 2354 |
case "cpu_tests": |
| 2355 |
cmd = append(cmd, |
| 2356 |
"--bazel_label="+labelAndSavedOutputDir.label, |
| 2357 |
"--bazel_config="+buildConfig, |
| 2358 |
"--bazel_cache_dir="+bazelCacheDir) |
| 2359 |
|
| 2360 |
case "toolchain_layering_check": |
| 2361 |
cmd = append(cmd, |
| 2362 |
"--bazel_label="+labelAndSavedOutputDir.label, |
| 2363 |
"--bazel_config="+buildConfig, |
| 2364 |
"--bazel_cache_dir="+bazelCacheDir) |
| 2365 |
|
| 2366 |
case "external_client": |
| 2367 |
// For external_client, we want to test how an external user would |
| 2368 |
// build using Skia. Therefore, we change to the workspace in that |
| 2369 |
// directory and use labels relative to it. |
| 2370 |
pathInSkia := "example/external_client" |
| 2371 |
label := strings.Replace(labelAndSavedOutputDir.label, pathInSkia, "", -1) |
| 2372 |
cmd = append(cmd, |
| 2373 |
"--bazel_label="+label, |
| 2374 |
"--path_in_skia="+pathInSkia, |
| 2375 |
"--bazel_cache_dir="+bazelCacheDir) |
| 2376 |
b.usesDocker() |
| 2377 |
|
| 2378 |
default: |
| 2379 |
panic("Unsupported Bazel taskdriver " + taskdriverName) |
| 2380 |
} |
| 2381 |
|
| 2382 |
if deviceSpecificBazelConfig != nil { |
| 2383 |
cmd = append(cmd, "--device_specific_bazel_config="+deviceSpecificBazelConfig.Name) |
| 2384 |
} |
| 2385 |
|
| 2386 |
if host == "linux_x64" { |
| 2387 |
b.usesBazel("linux_x64") |
| 2388 |
} else if host == "linux_arm64" || host == "on_rpi" { |
| 2389 |
// The RPIs do not run Bazel directly, they have precompiled binary |
| 2390 |
// to run instead. |
| 2391 |
} else { |
| 2392 |
panic("unsupported Bazel host " + host) |
| 2393 |
} |
| 2394 |
|
| 2395 |
b.linuxGceDimensions(MACHINE_TYPE_MEDIUM) |
| 2396 |
|
| 2397 |
b.cmd(cmd...) |
| 2398 |
b.idempotent() |
| 2399 |
b.cas(CAS_BAZEL) |
| 2400 |
b.attempts(1) |
| 2401 |
b.serviceAccount(b.cfg.ServiceAccountCompile) |
| 2402 |
}) |
| 2403 |
} |