.cirrus.yml 18.8 KB
Newer Older
1
# CIRRUS CONFIGURATION FILE
2
# https://cirrus-ci.org/guide/writing-tasks/
3

4 5
# YAML anchors used to share fields between tasks.
# See https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html
6 7

windows_shard_template: &WINDOWS_SHARD_TEMPLATE
8
  only_if: "changesInclude('.cirrus.yml', 'dev/**', 'bin/**') || $CIRRUS_PR == ''" # https://github.com/flutter/flutter/issues/41941
9 10 11
  script:
    - dart --enable-asserts ./dev/bots/test.dart

12 13 14 15 16 17 18 19 20 21 22 23
firebase_shard_template: &FIREBASE_SHARD_TEMPLATE
  environment:
    # Empirically, this shard runs in 20-25 minutes with just one CPU and 4G of RAM, as of
    # October 2019. It does not seem to be sensitive to the number of CPUs or amount of RAM;
    # doubling CPUs had no effect (mere seconds under 20 minutes), increasing RAM to 24G left it
    # on the high end of the 20-25 minute range. (This makes sense, as it's just driving the
    # Firebase test lab remotely.) Less than 4G of RAM made it go OOM.
    CLOUDSDK_CORE_DISABLE_PROMPTS: 1
    GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[1c140257edc48f5578fa5a0e5038b84c8e53270c405efa5a8e35ea303a4e0d135853989f448f72136206de854d17fbec]
  script:
    - dart --enable-asserts ./dev/bots/test.dart

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'

environment:
  # For details about environment variables used in Cirrus, including how encrypted variables work,
  # see https://cirrus-ci.org/guide/writing-tasks/#environment-variables
  GCLOUD_SERVICE_ACCOUNT_KEY: ENCRYPTED[f12abe60f5045d619ef4c79b83dd1e0722a0b0b13dbea95fbe334e2db7fffbcd841a5a92da8824848b539a19afe0c9fb]
  # We change Flutter's directory to include a space in its name (see $CIRRUS_WORKING_DIR) so that
  # we constantly test path names with spaces in them. The FLUTTER_SDK_PATH_WITH_SPACE variable must
  # therefore have a space in it.
  FLUTTER_SDK_PATH_WITH_SPACE: "flutter sdk"
  # We force BOT to true so that all our tools know we're in a CI environment. This avoids any
  # dependency on precisely how Cirrus is detected by our tools.
  BOT: "true"
  # Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they might include non-ASCII
  # characters which makes Gradle crash. See: https://github.com/flutter/flutter/issues/24935
  # TODO(amirha): remove once we've migrated to newer Gradle
  CIRRUS_CHANGE_MESSAGE: ""
  CIRRUS_COMMIT_MESSAGE: ""

# LINUX SHARDS
44
task:
45
  container:
46
    # https://cirrus-ci.org/guide/docker-builder-vm/#dockerfile-as-a-ci-environment
47
    dockerfile: "dev/ci/docker_linux/Dockerfile"
48 49
    cpu: $CPU
    memory: $MEMORY
50
    use_in_memory_disk: $USE_IN_MEMORY_DISK
51 52 53 54 55 56 57 58 59
  environment:
    # We shrink our default resource requirement as much as possible because that way we are more
    # likely to get scheduled. We require 4G of RAM because most of the shards (all but one as of
    # October 2019) just get OOM-killed with less. Some shards may need more. When increasing the
    # requirements for select shards, please leave a comment on those shards saying when you
    # increased the requirements, what numbers you tried, and what the results were.
    CPU: 1 # 0.1-8 without compute credits, 0.1-30 with (yes, you can go fractional)
    MEMORY: 4G # 256M-24G without compute credits, 256M-90G with
    CIRRUS_WORKING_DIR: "/tmp/$FLUTTER_SDK_PATH_WITH_SPACE"
60
    CIRRUS_DOCKER_CONTEXT: "dev/"
61
    PATH: "$CIRRUS_WORKING_DIR/bin:$CIRRUS_WORKING_DIR/bin/cache/dart-sdk/bin:$PATH"
62
    ANDROID_SDK_ROOT: "/opt/android_sdk"
63
    SHOULD_UPDATE_PACKAGES: 'TRUE' # can be overridden at the task level
64
    USE_IN_MEMORY_DISK: false
65 66 67
  pub_cache:
    folder: $HOME/.pub-cache
    fingerprint_script: echo $OS; grep -r --include=pubspec.yaml 'PUBSPEC CHECKSUM' "$CIRRUS_WORKING_DIR"
68
    reupload_on_changes: false
69 70
  flutter_pkg_cache:
    folder: bin/cache/pkg
71
    fingerprint_script: echo $OS; cat bin/internal/*.version
72
    reupload_on_changes: false
73 74
  artifacts_cache:
    folder: bin/cache/artifacts
75
    fingerprint_script: echo $OS; cat bin/internal/*.version
76
    reupload_on_changes: false
77 78
  setup_script:
    - date
79
    - git clean -xffd --exclude=bin/cache/
80 81 82
    - git fetch origin
    - git fetch origin master # To set FETCH_HEAD, so that "git merge-base" works.
    - flutter config --no-analytics
83
    - if [ "$SHOULD_UPDATE_PACKAGES" == TRUE ]; then flutter update-packages; fi
84 85 86 87 88 89 90
    - flutter doctor -v
    - ./dev/bots/accept_android_sdk_licenses.sh
    - date
  on_failure:
    failure_script:
      - date
      - which flutter
91
  matrix:
92
    - name: analyze-linux # linux-only
93
      only_if: "$CIRRUS_PR != ''"
94
      environment:
95
        # Empirically, the analyze-linux shard runs surprisingly fast (under 15 minutes) with just 1
96
        # CPU.  We noticed OOM failures with 6GB 4/2020, so we increased the memory.
97
        CPU: 1
98
        MEMORY: 8G
99
      script:
100
        - dart --enable-asserts ./dev/bots/analyze.dart
101

102
    - name: framework_tests-widgets-linux
103
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter/**', 'packages/flutter_test/**', 'packages/flutter_tools/lib/src/test/**', 'bin/**') && $CIRRUS_PR != ''"
104 105 106 107 108 109 110 111 112
      environment:
        # We use 3 CPUs because that's the minimum required to get framework_tests-widgets-linux
        # running fast enough that it is not the long pole, as of October 2019.
        CPU: 3
        GOLD_SERVICE_ACCOUNT: ENCRYPTED[3afeea5ac7201151c3d0dc9648862f0462b5e4f55dc600ca8b692319622f7c3eda3d577b1b16cc2ef0311b7314c1c095]
      script:
        - dart --enable-asserts ./dev/bots/test.dart

    - name: framework_tests-libraries-linux
113
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter/**', 'packages/flutter_test/**', 'packages/flutter_tools/lib/src/test/**', 'bin/**') && $CIRRUS_PR != ''"
114 115 116 117 118 119 120 121 122 123 124
      environment:
        # We use 3 CPUs because that's the minimum required to get the
        # framework_tests-libraries-linux shard running fast enough that it is not the long pole, as
        # of October 2019.
        CPU: 3
        GOLD_SERVICE_ACCOUNT: ENCRYPTED[3afeea5ac7201151c3d0dc9648862f0462b5e4f55dc600ca8b692319622f7c3eda3d577b1b16cc2ef0311b7314c1c095]
      script:
        - dart --enable-asserts ./dev/bots/test.dart

    - name: framework_tests-misc-linux
      # this includes the tests for directories in dev/
125
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter/**', 'packages/flutter_goldens/**', 'packages/flutter_test/**', 'packages/flutter_tools/lib/src/test/**', 'bin/**') && $CIRRUS_PR != ''"
126 127 128 129 130 131 132
      environment:
        # We use 3 CPUs because that's the minimum required to get framework_tests-misc-linux
        # running fast enough that it is not the long pole, as of October 2019.
        CPU: 3
      script:
        - dart --enable-asserts ./dev/bots/test.dart

133
    - name: tool_tests-general-linux
134
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter_tools/**', 'bin/**') && $CIRRUS_PR != ''"
135
      environment:
136 137
        # As of November 2019, the tool_tests-general-linux shard got faster with more CPUs up to 4
        # CPUs, and needed at least 10G of RAM to not run out of memory.
138
        CPU: 4
139
        MEMORY: 10G
140
        SHOULD_UPDATE_PACKAGES: "FALSE"
141
      script:
142 143 144 145
        - (cd packages/flutter_tools; pub get)
        - (cd packages/flutter_tools/test/data/asset_test/main; pub get)
        - (cd packages/flutter_tools/test/data/asset_test/font; pub get)
        - (cd dev/bots; pub get)
146 147 148
        - dart --enable-asserts ./dev/bots/test.dart

    - name: tool_tests-commands-linux
149
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter_tools/**', 'bin/**') && $CIRRUS_PR != ''"
150 151 152
      environment:
        # As of October 2019, the tool_tests-commands-linux shard got faster with more CPUs up to 6
        # CPUs, and needed at least 8G of RAM to not run out of memory.
153
        # Increased to 10GB on 19th Nov 2019 due to significant number of OOMKilled failures on PR builds.
154
        CPU: 6
155
        MEMORY: 10G
156
        SHOULD_UPDATE_PACKAGES: "FALSE"
157
      script:
158 159
        - (cd packages/flutter_tools; pub get)
        - (cd dev/bots; pub get)
160 161 162
        - dart --enable-asserts ./dev/bots/test.dart

    - name: tool_tests-integration-linux
163
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter_tools/**', 'bin/**') && $CIRRUS_PR != ''"
164 165 166 167 168
      environment:
        # As of October 2019, the tool_tests-integration-linux shard got faster with more CPUs up to
        # 6 CPUs, and needed at least 8G of RAM to not run out of memory.
        CPU: 6
        MEMORY: 8G
169
        CHROME_NO_SANDBOX: true
170
        SHOULD_UPDATE_PACKAGES: "FALSE"
171
      script:
172 173 174
        - (cd packages/flutter_tools; pub get)
        - (cd dev/bots; pub get)
        - (cd dev/tools; pub get)
175 176 177
        - dart --enable-asserts ./dev/bots/test.dart

    - name: tool_coverage-linux # linux-only
178
      skip: true # Skip while moving between Cirrus and LUCI
179
      only_if: "$CIRRUS_BRANCH == 'master'"
180
      environment:
181
        # As of February 2020, the tool_coverage-linux shard needed at least 24G of RAM to run without
182 183
        # getting OOM-killed, and even 8 CPUs took 25 minutes.
        CPU: 8
184
        MEMORY: 24G
185
        CODECOV_TOKEN: ENCRYPTED[7c76a7f8c9264f3b7f3fd63fcf186f93c62c4dfe43ec288861c2f506d456681032b89efe7b7a139c82156350ca2c752c]
186
        SHOULD_UPDATE_PACKAGES: "FALSE"
187
      script:
188 189 190 191
        - (cd packages/flutter_tools; pub get)
        - (cd packages/flutter_tools/test/data/asset_test/main; pub get)
        - (cd packages/flutter_tools/test/data/asset_test/font; pub get)
        - (cd dev/bots; pub get)
192 193 194
        - dart --enable-asserts ./dev/bots/test.dart
        - bash <(curl -s https://codecov.io/bash) -c -f packages/flutter_tools/coverage/lcov.info -F flutter_tool

195
    - name: web_integration_tests
196
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter/**', 'packages/flutter_test/**', 'packages/flutter_tools/**', 'packages/flutter_web_plugins/**', 'bin/**') && $CIRRUS_PR != ''"
197 198 199 200 201 202 203 204
      environment:
        # As of October 2019, the Web shards needed more than 6G of RAM.
        CPU: 2
        MEMORY: 8G
        CHROME_NO_SANDBOX: true
        GOLD_SERVICE_ACCOUNT: ENCRYPTED[3afeea5ac7201151c3d0dc9648862f0462b5e4f55dc600ca8b692319622f7c3eda3d577b1b16cc2ef0311b7314c1c095]
      script:
        - dart --enable-asserts ./dev/bots/test.dart
205

206
    - name: docs-linux # linux-only
207 208
      # TODO(fujino): Make this pre-submit only once #64212 is fixed
      only_if: "changesInclude('.cirrus.yml', 'dev/**', 'packages/flutter/**', 'packages/flutter_test/**', 'packages/flutter_drive/**', 'packages/flutter_localizations/**', 'bin/**') || $CIRRUS_PR == ''"
209
      environment:
210
        # TODO(tvolkert): optimize CPU and MEMORY settings once #60646 is resolved.
211
        CPU: 4
212
        MEMORY: 8G
213 214
        # For uploading master docs to Firebase master branch staging site
        FIREBASE_MASTER_TOKEN: ENCRYPTED[eb768d18798fdc5abfe09b224e1724c4d82831d715ccf90df2c79d618c317216cbd99493278361f6fe7948b409b603f0]
215
        # For uploading stable docs to Firebase public live site
216 217
        FIREBASE_PUBLIC_TOKEN: ENCRYPTED[37e8b82f167864cae9a3f4d2cf3f37dea331d9375c295327c45de524f6c588fa6f6d63e5784f10f6d43ce29689f36c92]
      script:
218
        - ./dev/bots/docs.sh
219

220
    - name: customer_testing-linux
221
      only_if: "$CIRRUS_PR != ''"
222 223 224
      # environment:
        # Empirically, this shard runs fine at 1 CPU and 4G RAM as of October 2019. We will probably
        # want to grow this container when we invite people to add their tests in large numbers.
225 226 227 228
      script:
        - rm -rf bin/cache/pkg/tests
        - git clone https://github.com/flutter/tests.git bin/cache/pkg/tests
        - dart --enable-asserts dev/customer_testing/run_tests.dart --skip-on-fetch-failure --skip-template bin/cache/pkg/tests/registry/*.test
Dan Field's avatar
Dan Field committed
229

230 231 232 233 234 235 236
    # firebase_test_lab_tests are linux-only
    - name: firebase_test_lab_tests-0-linux
      <<: *FIREBASE_SHARD_TEMPLATE

    - name: firebase_test_lab_tests-1-linux
      <<: *FIREBASE_SHARD_TEMPLATE

237
    - name: firebase_test_lab_tests-2_last-linux
238
      <<: *FIREBASE_SHARD_TEMPLATE
239

240
    - name: web_smoke_test
241
      only_if: "changesInclude('.cirrus.yml', 'examples/hello_world/**' ,'dev/**', 'packages/flutter/**', 'packages/flutter_test/**', 'packages/flutter_tools/lib/src/test/**', 'packages/flutter_web_plugins/**', 'bin/**') && $CIRRUS_PR != ''"
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
      environment:
        # Tests Hello World with Flutter Web Engine using Flutter Driver. Should not need more resources.
        CPU: 2
        MEMORY: 2G
        CHROME_NO_SANDBOX: true
      script:
        - flutter config --enable-web
        - git clone https://github.com/flutter/web_installers.git
        - cd web_installers/packages/web_drivers/
        - pub get
        - dart lib/web_driver_installer.dart &
        - sleep 20
        - chromedriver/chromedriver --port=4444 &
        - sleep 5
        - cd ../../../examples/hello_world/
        - flutter drive --target=test_driver/smoke_web_engine.dart -d web-server --profile --browser-name=chrome

259
    - name: deploy_gallery-linux # linux- and macos- only
260 261 262
      # Do not add more tasks here. Nothing is currently deployed from master branch, so it is safe to run
      # even if a test has failed. The behavior of failing dependencies is non-ideal for infra health.
      # See also: https://github.com/flutter/flutter/pull/49454
263 264 265 266 267 268 269 270 271 272 273
      depends_on:
        - analyze-linux
      environment:
        # As of October 2019, 1 CPU and 4G of RAM let deploy_gallery-linux finish in about 15
        # minutes, once it got started.
        GOOGLE_DEVELOPER_SERVICE_ACCOUNT_ACTOR_FASTLANE: ENCRYPTED[d9ac1462c3c556fc2f8165c9d5566a16497d8ebc38a50357f7f3abf136b7f83e1d1d76dde36fee356cb0f9ebf7a89346]
        ANDROID_GALLERY_UPLOAD_KEY: ENCRYPTED[0f2aca35f05b26add5d9edea2a7449341269a2b7e22d5c667f876996e2e8bc44ff1369431ebf73b7c5581fd95d0e5902]
      script:
        - ./dev/bots/deploy_gallery.sh

# WINDOWS SHARDS
274
task:
275
  windows_container:
276
    image: cirrusci/android-sdk:30-windowsservercore-2019
277
    os_version: 2019
278 279 280
    cpu: $CPU
    memory: $MEMORY
  environment:
281 282
    CPU: 1 # 1-8 without compute credits, 1-30 with
    MEMORY: 2G # 256M-24G without compute credits, 256M-90G with
283
    CIRRUS_WORKING_DIR: "C:\\Windows\\Temp\\$FLUTTER_SDK_PATH_WITH_SPACE"
284
    PATH: "$CIRRUS_WORKING_DIR/bin;$CIRRUS_WORKING_DIR/bin/cache/dart-sdk/bin;$PATH"
285
    SHOULD_UPDATE_PACKAGES: "TRUE"
286 287 288
  pub_cache:
    folder: $APPDATA\Pub\Cache
    fingerprint_script:
289
      - ps: $Environment:OS; Get-ChildItem -Path "$Environment:CIRRUS_WORKING_DIR" pubspec.yaml -Recurse | Select-String -Pattern "PUBSPEC CHECKSUM" -SimpleMatch
290
    reupload_on_changes: false
291 292
  flutter_pkg_cache:
    folder: bin\cache\pkg
293
    fingerprint_script: echo %OS% & type bin\internal\*.version
294
    reupload_on_changes: false
295 296
  artifacts_cache:
    folder: bin\cache\artifacts
297
    fingerprint_script: echo %OS% & type bin\internal\*.version
298
    reupload_on_changes: false
299
  setup_script:
300
    - git clean -xffd --exclude=bin/cache/ # git wants forward slash path separators, even on Windows.
301 302
    - git fetch origin
    - git fetch origin master # To set FETCH_HEAD, so that "git merge-base" works.
303 304
    - flutter config --no-analytics
    - flutter doctor -v
305
    - CMD /C IF "%SHOULD_UPDATE_PACKAGES%" EQU "TRUE" flutter update-packages
306
    - git fetch origin master
307
  matrix:
308
    - name: hostonly_devicelab_tests-0-windows
309
      << : *WINDOWS_SHARD_TEMPLATE
310 311 312 313 314 315
      environment:
        # As of December 2019, the hostonly_devicelab_tests-0-windows shard needs at least 6G RAM to
        # succeed. The shard got faster with more CPUs up to 6 CPUs and more RAM up to 8 GB
        # (running in about 30 minutes).
        CPU: 6
        MEMORY: 8G
316

317
    - name: hostonly_devicelab_tests-1_last-windows
318
      << : *WINDOWS_SHARD_TEMPLATE
319 320 321 322 323 324
      environment:
        # As of December 2019, the hostonly_devicelab_tests-1-windows shard requires 4 GB RAM to
        # succeed. The optimal configuration was 4 CPUs and 6 GB RAM, running in ~26 minutes.
        # Less CPU or RAM ran slower, and more CPU or RAM yielded no extra gain.
        CPU: 4
        MEMORY: 6G
325 326

# MACOS SHARDS
327 328
# Mac doesn't use caches because they apparently take longer to populate and save
# than just fetching the data in the first place.
329 330
task:
  osx_instance:
331
    image: catalina-xcode-12.0-flutter # see https://cirrus-ci.org/guide/macOS/ for list of images (we should update regularly)
332 333 334 335 336 337
    # cpu is always 2
    # memory is always 8G
  environment:
    CIRRUS_WORKING_DIR: "/tmp/$FLUTTER_SDK_PATH_WITH_SPACE"
    FLUTTER_FRAMEWORK_DIR: "$CIRRUS_WORKING_DIR/bin/cache/artifacts/engine/ios/"
    PATH: "$CIRRUS_WORKING_DIR/bin:$CIRRUS_WORKING_DIR/bin/cache/dart-sdk/bin:$PATH"
338
    COCOAPODS_DISABLE_STATS: true
339 340
    CPU: 2
    MEMORY: 8G
341
    SHOULD_UPDATE_PACKAGES: 'TRUE'
342
  setup_script:
343
    - date
344
    - which flutter
345
    - bundle --version
346 347
    - bundle config set system 'true'
    - sudo bundle install --gemfile=dev/ci/mac/Gemfile
348
    - git clean -xffd --exclude=bin/cache/
349
    - git fetch origin
350 351
    - git fetch origin master # To set FETCH_HEAD, so that "git merge-base" works.
    - flutter config --no-analytics
352
    - if [ "$SHOULD_UPDATE_PACKAGES" == TRUE ]; then flutter update-packages; fi
353 354 355 356 357 358 359
    - flutter doctor -v
    - date
    - which flutter
  on_failure:
    failure_script:
      - date
      - which flutter
360
  matrix:
361 362 363
    # TODO(ianh): Enable Web tests on macOS.

    - name: deploy_gallery-macos # linux- and macos- only
364 365 366
      # Do not add more tasks here. Nothing is currently deployed from master branch, so it is safe to run
      # even if a test has failed. The behavior of failing dependencies is non-ideal for infra health.
      # See also: https://github.com/flutter/flutter/pull/49454
367 368 369 370 371 372 373 374 375 376 377 378 379 380
      depends_on:
        - analyze-linux
      environment:
        # Apple Fastlane password.
        FASTLANE_PASSWORD: ENCRYPTED[4b1f0b8d52874e9de965acd46c79743f3b81f3a513614179b9be7cf53dc8258753e257bdadb11a298ee455259df21865]
        # Private repo for publishing certificates.
        PUBLISHING_MATCH_CERTIFICATE_REPO: ENCRYPTED[3c0e78877d933fc80107aa6f3790fd1cf927250b852d6cb53202be696b4903ed8ca839b809626aaf18050bf7e436fab7]
        PUBLISHING_MATCH_REPO_TOKEN: ENCRYPTED[3d1230b744c6ed6c788a91bec741b769401dbcd426b18f9af8080bfeefdfc21913ca4047980c5b5b7ce823f12e7b6b19]
        # Apple Certificates Match Passphrase
        MATCH_PASSWORD: ENCRYPTED[db07f252234397090e3ec59152d9ec1831f5ecd0ef97d247b1dca757bbb9ef9b7c832a39bce2caf1949ccdf097e59a73]
      script:
        - ulimit -S -n 2048 # https://github.com/flutter/flutter/issues/2976
        - ./dev/bots/deploy_gallery.sh

381 382
    - name: verify_binaries_codesigned-macos # macos-only
      # TODO(fujino): remove this `only_if` after https://github.com/flutter/flutter/issues/44372
383 384
      # Only run pre/post submit for release branches
      only_if: "$CIRRUS_BASE_BRANCH == 'dev' || $CIRRUS_BRANCH == 'dev' || $CIRRUS_BASE_BRANCH == 'beta' || $CIRRUS_BRANCH == 'beta' || $CIRRUS_BASE_BRANCH == 'stable' || $CIRRUS_BRANCH == 'stable'"
385 386 387 388 389
      depends_on:
        - analyze-linux
      script:
        - ulimit -S -n 2048 # https://github.com/flutter/flutter/issues/2976
        - dart --enable-asserts ./dev/bots/codesign.dart