blob: b283e84f4b91b1d256a7dcaea1b67fe64137fd45 [file] [log] [blame]
gcp_credentials: ENCRYPTED[!2c88dee9c9d9805b214c9f7ad8f3bc8fae936cdb0f881d562101151c408c7e024a41222677d5831df90c60d2dd6cd80a!]
# Don't run on release tags since it creates O(n^2) tasks where n is the
# number of plugins
only_if: $CIRRUS_TAG == ''
env:
CHANNEL: "master" # Default to master when not explicitly set by a task.
PLUGIN_TOOL: "./script/tool/bin/flutter_plugin_tools.dart"
tool_setup_template: &TOOL_SETUP_TEMPLATE
tool_setup_script:
- git fetch origin main # To set FETCH_HEAD for "git merge-base" to work
- cd script/tool
- dart pub get
flutter_upgrade_template: &FLUTTER_UPGRADE_TEMPLATE
upgrade_flutter_script:
# Master uses a pinned, auto-rolled version to prevent out-of-band CI
# failures due to changes in Flutter.
# TODO(stuartmorgan): Investigate an autoroller for stable as well.
- TARGET_TREEISH=$CHANNEL
- if [[ "$CHANNEL" == "master" ]]; then
- TARGET_TREEISH=$(< .ci/flutter_$CHANNEL.version)
- fi
# Ensure that the repository has all the branches.
- cd $FLUTTER_HOME
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch origin
# Switch to the requested channel.
- git checkout $TARGET_TREEISH
# When using a branch rather than a hash, reset to the upstream branch
# rather than using pull, since the base image can sometimes be in a state
# where it has diverged from upstream (!).
- if [[ "$TARGET_TREEISH" == "$CHANNEL" ]]; then
- git reset --hard @{u}
- fi
# Run doctor to allow auditing of what version of Flutter the run is using.
- flutter doctor -v
<< : *TOOL_SETUP_TEMPLATE
build_all_plugins_app_template: &BUILD_ALL_PLUGINS_APP_TEMPLATE
create_all_plugins_app_script:
- dart $PLUGIN_TOOL all-plugins-app --output-dir=. --exclude script/configs/exclude_all_plugins_app.yaml
build_all_plugins_debug_script:
- cd all_plugins
- if [[ "$BUILD_ALL_ARGS" == "web" ]]; then
- echo "Skipping; web does not support debug builds"
- else
- flutter build $BUILD_ALL_ARGS --debug
- fi
build_all_plugins_release_script:
- cd all_plugins
- flutter build $BUILD_ALL_ARGS --release
macos_template: &MACOS_TEMPLATE
# Only one macOS task can run in parallel without credits, so use them for
# PRs on macOS.
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
osx_instance:
image: big-sur-xcode-13
# Light-workload Linux tasks.
# These use default machines, with fewer CPUs, to reduce pressure on the
# concurrency limits.
task:
<< : *FLUTTER_UPGRADE_TEMPLATE
gke_container:
dockerfile: .ci/Dockerfile
builder_image_name: docker-builder-linux # gce vm image
builder_image_project: flutter-cirrus
cluster_name: test-cluster
zone: us-central1-a
namespace: default
matrix:
### Platform-agnostic tasks ###
- name: Linux plugin_tools_tests
script:
- cd script/tool
- dart pub run test
- name: publishable
env:
# TODO (mvanbeusekom): Temporary override to "stable" because of failure on "master".
# Remove override once https://github.com/dart-lang/pub/issues/3152 is resolved.
CHANNEL: stable
CHANGE_DESC: "$TMPDIR/change-description.txt"
version_check_script:
# For pre-submit, pass the PR description to the script to allow for
# version check overrides.
# For post-submit, ignore platform version breaking version changes and
# missing version/CHANGELOG detection; the PR description isn't reliably
# part of the commit message, so using the same flags as for presubmit
# would likely result in false-positive post-submit failures.
- if [[ $CIRRUS_PR == "" ]]; then
- ./script/tool_runner.sh version-check --ignore-platform-interface-breaks
- else
- echo "$CIRRUS_CHANGE_MESSAGE" > "$CHANGE_DESC"
- ./script/tool_runner.sh version-check --check-for-missing-changes --change-description-file="$CHANGE_DESC"
- fi
publish_check_script: ./script/tool_runner.sh publish-check
- name: format
always:
format_script: ./script/tool_runner.sh format --fail-on-change
pubspec_script: ./script/tool_runner.sh pubspec-check
license_script: dart $PLUGIN_TOOL license-check
- name: federated_safety
# This check is only meaningful for PRs, as it validates changes
# rather than state.
only_if: $CIRRUS_PR != ""
script: ./script/tool_runner.sh federation-safety-check
- name: dart_unit_tests
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
test_script:
- ./script/tool_runner.sh test
- name: analyze
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
analyze_tool_script:
- cd script/tool
- dart analyze --fatal-infos
analyze_script:
# DO NOT change the custom-analysis argument here without changing the Dart repo.
# See the comment in script/configs/custom_analysis.yaml for details.
- ./script/tool_runner.sh analyze --custom-analysis=script/configs/custom_analysis.yaml
pathified_analyze_script:
# Re-run analysis with path-based dependencies to ensure that publishing
# the changes won't break analysis of other packages in the respository
# that depend on it.
- ./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
# This uses --run-on-dirty-packages rather than --packages-for-branch
# since only the packages changed by 'make-deps-path-based' need to be
# checked.
- dart $PLUGIN_TOOL analyze --run-on-dirty-packages --log-timing --custom-analysis=script/configs/custom_analysis.yaml
# Restore the tree to a clean state, to avoid accidental issues if
# other script steps are added to this task.
- git checkout .
### Web tasks ###
- name: web-build_all_plugins
env:
BUILD_ALL_ARGS: "web"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
### Linux desktop tasks ###
- name: linux-build_all_plugins
env:
BUILD_ALL_ARGS: "linux"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
setup_script:
- flutter config --enable-linux-desktop
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
- name: linux-platform_tests
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
build_script:
- flutter config --enable-linux-desktop
- ./script/tool_runner.sh build-examples --linux
native_test_script:
- ./script/tool_runner.sh native-test --linux --no-integration
drive_script:
- xvfb-run ./script/tool_runner.sh drive-examples --linux
# Heavy-workload Linux tasks.
# These use machines with more CPUs and memory, so will reduce parallelization
# for non-credit runs.
task:
<< : *FLUTTER_UPGRADE_TEMPLATE
gke_container:
dockerfile: .ci/Dockerfile
builder_image_name: docker-builder-linux # gce vm image
builder_image_project: flutter-cirrus
cluster_name: test-cluster
zone: us-central1-a
namespace: default
cpu: 4
memory: 12G
matrix:
### Android tasks ###
- name: android-platform_tests
env:
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 5"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 5"
PLUGIN_SHARDING: "--shardIndex 2 --shardCount 5"
PLUGIN_SHARDING: "--shardIndex 3 --shardCount 5"
PLUGIN_SHARDING: "--shardIndex 4 --shardCount 5"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[de02374f8d2d14d50792c6b521af2dfb86cbb522efed104f905002e4332546104d387d2bb8710956b729b4bd6533bba0]
build_script:
# Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they
# might include non-ASCII characters which makes Gradle crash.
# TODO(stuartmorgan): See https://github.com/flutter/flutter/issues/24935
- export CIRRUS_CHANGE_MESSAGE=""
- export CIRRUS_COMMIT_MESSAGE=""
- ./script/tool_runner.sh build-examples --apk
lint_script:
# Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they
# might include non-ASCII characters which makes Gradle crash.
# TODO(stuartmorgan): See https://github.com/flutter/flutter/issues/24935
- export CIRRUS_CHANGE_MESSAGE=""
- export CIRRUS_COMMIT_MESSAGE=""
- ./script/tool_runner.sh lint-android # must come after build-examples
native_unit_test_script:
# Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they
# might include non-ASCII characters which makes Gradle crash.
# TODO(stuartmorgan): See https://github.com/flutter/flutter/issues/24935
- export CIRRUS_CHANGE_MESSAGE=""
- export CIRRUS_COMMIT_MESSAGE=""
# Native integration tests are handled by firebase-test-lab below, so
# only run unit tests.
# Must come after build-examples.
- ./script/tool_runner.sh native-test --android --no-integration --exclude script/configs/exclude_native_unit_android.yaml
firebase_test_lab_script:
# Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they
# might include non-ASCII characters which makes Gradle crash.
# TODO(stuartmorgan): See https://github.com/flutter/flutter/issues/24935
- export CIRRUS_CHANGE_MESSAGE=""
- export CIRRUS_COMMIT_MESSAGE=""
- if [[ -n "$GCLOUD_FIREBASE_TESTLAB_KEY" ]]; then
- echo $GCLOUD_FIREBASE_TESTLAB_KEY > ${HOME}/gcloud-service-key.json
- ./script/tool_runner.sh firebase-test-lab --device model=redfin,version=30 --device model=starqlteue,version=26 --exclude=script/configs/exclude_integration_android.yaml
- else
- echo "This user does not have permission to run Firebase Test Lab tests."
- fi
# Upload the full lint results to Cirrus to display in the results UI.
always:
android-lint_artifacts:
path: "**/reports/lint-results-debug.xml"
type: text/xml
format: android-lint
- name: android-build_all_plugins
env:
BUILD_ALL_ARGS: "apk"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
### Web tasks ###
- name: web-platform_tests
env:
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 2"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 2"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
CHROME_NO_SANDBOX: true
CHROME_DIR: /tmp/web_chromium/
CHROME_EXECUTABLE: $CHROME_DIR/chrome-linux/chrome
install_script:
# Install a pinned version of Chromium and its corresponding ChromeDriver.
# Setting CHROME_EXECUTABLE above causes this version to be used for tests.
- ./script/install_chromium.sh "$CHROME_DIR"
chromedriver_background_script:
- cd "$CHROME_DIR"
- ./chromedriver/chromedriver --port=4444
build_script:
- ./script/tool_runner.sh build-examples --web
drive_script:
- ./script/tool_runner.sh drive-examples --web --exclude=script/configs/exclude_integration_web.yaml
# macOS tasks.
task:
<< : *MACOS_TEMPLATE
<< : *FLUTTER_UPGRADE_TEMPLATE
matrix:
### iOS+macOS tasks ***
- name: darwin-lint_podspecs
script:
- ./script/tool_runner.sh podspecs
### iOS tasks ###
- name: ios-build_all_plugins
env:
BUILD_ALL_ARGS: "ios --no-codesign"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
- name: ios-platform_tests
env:
PATH: $PATH:/usr/local/bin
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 2 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 3 --shardCount 4"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
SIMCTL_CHILD_MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
create_simulator_script:
- xcrun simctl list
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-15-0 | xargs xcrun simctl boot
build_script:
- ./script/tool_runner.sh build-examples --ios
xcode_analyze_script:
- ./script/tool_runner.sh xcode-analyze --ios
native_test_script:
- ./script/tool_runner.sh native-test --ios --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
drive_script:
# `drive-examples` contains integration tests, which changes the UI of the application.
# This UI change sometimes affects `xctest`.
# So we run `drive-examples` after `native-test`; changing the order will result ci failure.
- ./script/tool_runner.sh drive-examples --ios --exclude=script/configs/exclude_integration_ios.yaml
### macOS desktop tasks ###
- name: macos-build_all_plugins
env:
BUILD_ALL_ARGS: "macos"
matrix:
CHANNEL: "master"
CHANNEL: "stable"
setup_script:
- flutter config --enable-macos-desktop
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
- name: macos-platform_tests
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
PATH: $PATH:/usr/local/bin
build_script:
- flutter config --enable-macos-desktop
- ./script/tool_runner.sh build-examples --macos
xcode_analyze_script:
- ./script/tool_runner.sh xcode-analyze --macos
native_test_script:
- ./script/tool_runner.sh native-test --macos
drive_script:
- ./script/tool_runner.sh drive-examples --macos