Skip to content

Commit 4f34e50

Browse files
[ci] Cirrus pre-alignment with flutter/plugins, part 1 (#2706)
1 parent e832877 commit 4f34e50

File tree

2 files changed

+95
-60
lines changed

2 files changed

+95
-60
lines changed

.cirrus.yml

Lines changed: 94 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ gcp_credentials: ENCRYPTED[!f1177d1ddb5330ffaa9ea11c9c9e8e0c542185e895c36071f18c
44
only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'main')
55
env:
66
CHANNEL: "master" # Default to master when not explicitly set by a task.
7+
PLUGIN_TOOL_COMMAND: "dart pub global run flutter_plugin_tools"
78

89
install_chrome_linux_template: &INSTALL_CHROME_LINUX
910
env:
@@ -25,6 +26,14 @@ macos_template: &MACOS_TEMPLATE
2526
# Only one macOS task can run in parallel without credits, so use them for
2627
# PRs on macOS.
2728
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
29+
30+
macos_intel_template: &MACOS_INTEL_TEMPLATE
31+
<< : *MACOS_TEMPLATE
32+
osx_instance:
33+
image: big-sur-xcode-13
34+
35+
macos_arm_template: &MACOS_ARM_TEMPLATE
36+
<< : *MACOS_TEMPLATE
2837
macos_instance:
2938
image: ghcr.io/cirruslabs/macos-ventura-xcode:14
3039

@@ -53,36 +62,27 @@ flutter_upgrade_template: &FLUTTER_UPGRADE_TEMPLATE
5362
- flutter doctor -v
5463
<< : *TOOL_SETUP_TEMPLATE
5564

65+
# Light-workload Linux tasks.
66+
# These use default machines, with fewer CPUs, to reduce pressure on the
67+
# concurrency limits.
5668
task:
69+
<< : *FLUTTER_UPGRADE_TEMPLATE
5770
gke_container:
5871
dockerfile: .ci/Dockerfile
5972
builder_image_name: docker-builder-linux # gce vm image
6073
builder_image_project: flutter-cirrus
6174
cluster_name: test-cluster
6275
zone: us-central1-a
6376
namespace: default
64-
cpu: 4
65-
memory: 12G
66-
<< : *FLUTTER_UPGRADE_TEMPLATE
6777
matrix:
6878
### Platform-agnostic tasks ###
69-
- name: format+analyze
79+
# Repository rules and best-practice enforcement.
80+
# Only channel-agnostic tests should go here since it is only run once
81+
# (on Flutter master).
82+
- name: repo_checks
7083
always:
7184
format_script: ./script/tool_runner.sh format --fail-on-change
72-
license_script: dart pub global run flutter_plugin_tools license-check
73-
analyze_script:
74-
- ./script/tool_runner.sh analyze --custom-analysis=script/configs/custom_analysis.yaml
75-
pathified_analyze_script:
76-
# Run analysis with path-based dependencies to ensure that publishing
77-
# the changes won't break analysis of other packages in the respository
78-
# that depend on it.
79-
- ./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
80-
# This uses --run-on-dirty-packages rather than --packages-for-branch
81-
# since only the packages changed by 'make-deps-path-based' need to be
82-
# checked.
83-
- dart pub global run flutter_plugin_tools analyze --run-on-dirty-packages --custom-analysis=script/configs/custom_analysis.yaml
84-
# Restore the tree to a clean state
85-
- git checkout .
85+
license_script: $PLUGIN_TOOL_COMMAND license-check
8686
pubspec_script: ./script/tool_runner.sh pubspec-check
8787
readme_script:
8888
- ./script/tool_runner.sh readme-check
@@ -91,19 +91,59 @@ task:
9191
# has been fixed, this can be removed and there can just be a single
9292
# run with --require-excerpts and no exclusions.
9393
- ./script/tool_runner.sh readme-check --require-excerpts --exclude=script/configs/temp_exclude_excerpt.yaml
94-
- name: readme_excerpts
94+
version_script:
95+
# For pre-submit, pass the PR labels to the script to allow for
96+
# check overrides.
97+
# For post-submit, ignore platform version breaking version changes
98+
# and missing version/CHANGELOG detection since the labels aren't
99+
# available outside of the context of the PR.
100+
- if [[ $CIRRUS_PR == "" ]]; then
101+
- ./script/tool_runner.sh version-check --ignore-platform-interface-breaks
102+
- else
103+
- ./script/tool_runner.sh version-check --check-for-missing-changes --pr-labels="$CIRRUS_PR_LABELS"
104+
- fi
105+
publishable_script: ./script/tool_runner.sh publish-check --allow-pre-release
106+
- name: dart_unit_tests
95107
env:
96-
CIRRUS_CLONE_SUBMODULES: true
97-
script: ./script/tool_runner.sh update-excerpts --fail-on-change
108+
matrix:
109+
CHANNEL: "master"
110+
CHANNEL: "stable"
111+
unit_test_script:
112+
- ./script/tool_runner.sh test --exclude=script/configs/dart_unit_tests_exceptions.yaml
113+
pathified_unit_test_script:
114+
# Run tests with path-based dependencies to ensure that publishing
115+
# the changes won't break tests of other packages in the respository
116+
# that depend on it.
117+
- ./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
118+
- $PLUGIN_TOOL_COMMAND test --run-on-dirty-packages --exclude=script/configs/dart_unit_tests_exceptions.yaml
119+
- name: analyze
120+
env:
121+
matrix:
122+
CHANNEL: "master"
123+
CHANNEL: "stable"
124+
analyze_script:
125+
- ./script/tool_runner.sh analyze --custom-analysis=script/configs/custom_analysis.yaml
126+
pathified_analyze_script:
127+
# Re-run analysis with path-based dependencies to ensure that publishing
128+
# the changes won't break analysis of other packages in the respository
129+
# that depend on it.
130+
- ./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
131+
# This uses --run-on-dirty-packages rather than --packages-for-branch
132+
# since only the packages changed by 'make-deps-path-based' need to be
133+
# checked.
134+
- $PLUGIN_TOOL_COMMAND analyze --run-on-dirty-packages --log-timing --custom-analysis=script/configs/custom_analysis.yaml
135+
# Restore the tree to a clean state, to avoid accidental issues if
136+
# other script steps are added to this task.
137+
- git checkout .
98138
# Does a sanity check that packages at least pass analysis on the N-1 and N-2
99139
# versions of Flutter stable if the package claims to support that version.
100140
# This is to minimize accidentally making changes that break old versions
101141
# (which we don't commit to supporting, but don't want to actively break)
102142
# without updating the constraints.
103143
# Note: The versions below should be manually updated after a new stable
104144
# version comes out.
105-
- name: legacy-version-analyze
106-
depends_on: format+analyze
145+
- name: legacy_version_analyze
146+
depends_on: analyze
107147
matrix:
108148
env:
109149
CHANNEL: "3.0.5"
@@ -116,46 +156,21 @@ task:
116156
# minimum Flutter/Dart version than the package itself.
117157
- ./script/tool_runner.sh remove-dev-dependencies
118158
analyze_script:
159+
# Only analyze lib/; non-client code doesn't need to work on
160+
# all supported legacy version.
119161
- ./script/tool_runner.sh analyze --lib-only --skip-if-not-supporting-flutter-version="$CHANNEL" --skip-if-not-supporting-dart-version="$DART_VERSION" --custom-analysis=script/configs/custom_analysis.yaml
120162
# Does a sanity check that packages pass analysis with the lowest possible
121163
# versions of all dependencies. This is to catch cases where we add use of
122164
# new APIs but forget to update minimum versions of dependencies to where
123165
# those APIs are introduced.
124166
- name: downgraded_analyze
125-
depends_on: format+analyze
167+
depends_on: analyze
126168
analyze_script:
127169
- ./script/tool_runner.sh analyze --downgrade --custom-analysis=script/configs/custom_analysis.yaml
128-
- name: publishable
129-
version_script:
130-
# For pre-submit, pass the PR description to the script to allow for
131-
# version check overrides.
132-
# For post-submit, ignore missing version/CHANGELOG detection; the PR
133-
# description isn't reliably part of the commit message, so using the
134-
# same flags as for presubmit would likely result in false-positive
135-
# post-submit failures.
136-
- if [[ $CIRRUS_PR == "" ]]; then
137-
- ./script/tool_runner.sh version-check
138-
- else
139-
- ./script/tool_runner.sh version-check --check-for-missing-changes --pr-labels="$CIRRUS_PR_LABELS"
140-
- fi
141-
publishable_script: ./script/tool_runner.sh publish-check --allow-pre-release
142-
depends_on:
143-
- format+analyze
144-
- name: dart_unit_tests
170+
- name: readme_excerpts
145171
env:
146-
matrix:
147-
CHANNEL: "master"
148-
CHANNEL: "stable"
149-
unit_test_script:
150-
- ./script/tool_runner.sh test --exclude=script/configs/dart_unit_tests_exceptions.yaml
151-
pathified_unit_test_script:
152-
# Run tests with path-based dependencies to ensure that publishing
153-
# the changes won't break tests of other packages in the respository
154-
# that depend on it.
155-
- ./script/tool_runner.sh make-deps-path-based --target-dependencies-with-non-breaking-updates
156-
- dart pub global run flutter_plugin_tools test --run-on-dirty-packages --exclude=script/configs/dart_unit_tests_exceptions.yaml
157-
depends_on:
158-
- format+analyze
172+
CIRRUS_CLONE_SUBMODULES: true
173+
script: ./script/tool_runner.sh update-excerpts --fail-on-change
159174
- name: linux-custom_package_tests
160175
env:
161176
PATH: $PATH:/usr/local/bin
@@ -173,8 +188,26 @@ task:
173188
- else
174189
- ./script/tool_runner.sh custom-test --exclude=pigeon,flutter_image
175190
- fi
191+
192+
# Heavy-workload Linux tasks.
193+
# These use machines with more CPUs and memory, so will reduce parallelization
194+
# for non-credit runs.
195+
task:
196+
<< : *FLUTTER_UPGRADE_TEMPLATE
197+
gke_container:
198+
dockerfile: .ci/Dockerfile
199+
builder_image_name: docker-builder-linux # gce vm image
200+
builder_image_project: flutter-cirrus
201+
cluster_name: test-cluster
202+
zone: us-central1-a
203+
namespace: default
204+
cpu: 4
205+
memory: 12G
206+
matrix:
176207
### Android tasks ###
177208
- name: android-platform_tests
209+
# Don't run full platform tests on both channels in pre-submit.
210+
skip: $CIRRUS_PR != '' && $CHANNEL == 'stable'
178211
env:
179212
matrix:
180213
PACKAGE_SHARDING: "--shardIndex 0 --shardCount 2"
@@ -188,8 +221,6 @@ task:
188221
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth
189222
native_unit_test_scipt:
190223
- ./script/tool_runner.sh native-test --android --no-integration
191-
depends_on:
192-
- format+analyze
193224
### Web tasks ###
194225
- name: web-platform_tests
195226
env:
@@ -217,22 +248,25 @@ task:
217248
- dart testing/web_benchmarks_test.dart
218249
### Linux desktop tasks ###
219250
- name: linux-platform_tests
251+
# Don't run full platform tests on both channels in pre-submit.
252+
skip: $CIRRUS_PR != '' && $CHANNEL == 'stable'
220253
env:
221254
matrix:
222255
CHANNEL: "master"
223256
CHANNEL: "stable"
224257
build_script:
225-
- flutter config --enable-linux-desktop
226258
- ./script/tool_runner.sh build-examples --linux
227259
native_test_script:
228260
- ./script/tool_runner.sh native-test --linux --no-integration
229261

230262
task:
231263
<< : *FLUTTER_UPGRADE_TEMPLATE
232-
<< : *MACOS_TEMPLATE
264+
<< : *MACOS_ARM_TEMPLATE
233265
matrix:
234266
### iOS tasks ###
235267
- name: ios-platform_tests
268+
# Don't run full platform tests on both channels in pre-submit.
269+
skip: $CIRRUS_PR != '' && $CHANNEL == 'stable'
236270
env:
237271
PATH: $PATH:/usr/local/bin
238272
matrix:
@@ -264,13 +298,14 @@ task:
264298
- fi
265299
### macOS desktop tasks ###
266300
- name: macos-platform_tests
301+
# Don't run full platform tests on both channels in pre-submit.
302+
skip: $CIRRUS_PR != '' && $CHANNEL == 'stable'
267303
env:
268304
matrix:
269305
CHANNEL: "master"
270306
CHANNEL: "stable"
271307
PATH: $PATH:/usr/local/bin
272308
build_script:
273-
- flutter config --enable-macos-desktop
274309
- ./script/tool_runner.sh build-examples --macos
275310
native_test_script:
276311
- ./script/tool_runner.sh native-test --macos

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ linter:
7777
# - cascade_invocations # doesn't match the typical style of this repo
7878
- cast_nullable_to_non_nullable
7979
# - close_sinks # not reliable enough
80-
- combinators_ordering
80+
# - combinators_ordering # DIFFERENT FROM FLUTTER/FLUTTER: This isn't available on stable yet.
8181
# - comment_references # blocked on https://github.com/dart-lang/linter/issues/1142
8282
- conditional_uri_does_not_exist
8383
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204

0 commit comments

Comments
 (0)