Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 79dd06a

Browse files
Streamline CI setup, and reenable macOS credits (#3697)
This makes a few improvements to CI throughput: - Moves the flutter channel+upgrade step into each step, rather then doing it for both channels in the setup step. This avoids pointlessly doing twice the work in every setup (downloading two channels, only one of which will be used) - Re-enables credits for macOS tasks. These were disabled in a recent chance since I was unifying configurations, but it turns out that without credits there is *no* parallelization of macOS tasks, which makes the end-to-end time very long. - Dials back the Linux VM requirements based on looking at the new CPU and memory usage graphs for runs: - No task was ever reaching 4 CPUs or 12 GB of memory, so use those values for heavy workload; this will double concurrency of the heavy-workload tasks and should have no impact on run length. - Linux build+drive was extremely low usage, so move it to the light workload group.
1 parent d306f98 commit 79dd06a

File tree

1 file changed

+42
-81
lines changed

1 file changed

+42
-81
lines changed

.cirrus.yml

Lines changed: 42 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
# Light-workload tasks.
2-
# These use default machines, with fewer CPUs, to reduce pressure on the
3-
# concurrency limits.
4-
task:
5-
# don't run on release tags since it creates O(n^2) tasks where n is the number of plugins
1+
root_task_template: &ROOT_TASK_TEMPLATE
2+
# Don't run on release tags since it creates O(n^2) tasks where n is the
3+
# number of plugins
64
only_if: $CIRRUS_TAG == ''
75
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == ''
8-
container:
9-
dockerfile: .ci/Dockerfile
106
env:
117
INTEGRATION_TEST_PATH: "./packages/integration_test"
12-
upgrade_script:
13-
- flutter channel stable
14-
- flutter upgrade
15-
- flutter channel master
8+
CHANNEL: "master" # Default to master when not explicitly set by a task.
9+
setup_script:
10+
- flutter channel $CHANNEL
1611
- flutter upgrade
17-
- flutter config --enable-linux-desktop
18-
- git fetch origin master
12+
- git fetch origin master # To set FETCH_HEAD for "git merge-base" to work
13+
14+
15+
# Light-workload Linux tasks.
16+
# These use default machines, with fewer CPUs, to reduce pressure on the
17+
# concurrency limits.
18+
task:
19+
<< : *ROOT_TASK_TEMPLATE
20+
container:
21+
dockerfile: .ci/Dockerfile
1922
matrix:
2023
### Platform-agnostic tasks ###
2124
- name: plugin_tools_tests
@@ -25,7 +28,6 @@ task:
2528
- CIRRUS_BUILD_ID=null pub run test
2629
- name: publishable
2730
script:
28-
- flutter channel master
2931
- ./script/check_publish.sh
3032
- name: format
3133
format_script: ./script/incremental_build.sh format --fail-on-change
@@ -35,14 +37,12 @@ task:
3537
CHANNEL: "master"
3638
CHANNEL: "stable"
3739
test_script:
38-
- flutter channel $CHANNEL
3940
- ./script/incremental_build.sh test
4041
- name: analyze_master
4142
env:
4243
matrix:
4344
CHANNEL: "master"
4445
script:
45-
- flutter channel $CHANNEL
4646
- ./script/incremental_build.sh analyze
4747
## TODO(cyanglaz):
4848
## Combing stable and master analyze jobs when integration test null safety is ready on flutter stable.
@@ -51,7 +51,6 @@ task:
5151
matrix:
5252
CHANNEL: "stable"
5353
script:
54-
- flutter channel $CHANNEL
5554
- find . -depth -type d -wholename '*_web/example' -exec rm -rf {} \;
5655
- ./script/incremental_build.sh analyze
5756
### Android tasks ###
@@ -61,7 +60,6 @@ task:
6160
CHANNEL: "master"
6261
CHANNEL: "stable"
6362
script:
64-
- flutter channel $CHANNEL
6563
- ./script/build_all_plugins_app.sh apk
6664
### Web tasks ###
6765
- name: build_all_plugins_web
@@ -70,14 +68,12 @@ task:
7068
CHANNEL: "master"
7169
CHANNEL: "stable"
7270
script:
73-
- flutter channel $CHANNEL
7471
- ./script/build_all_plugins_app.sh web
7572
- name: build-web-examples
7673
env:
7774
matrix:
7875
CHANNEL: "master"
7976
build_script:
80-
- flutter channel $CHANNEL
8177
- ./script/incremental_build.sh build-examples --web
8278
# TODO: Add driving examples (and move to heavy-workload group).
8379
### Linux desktop tasks ###
@@ -87,8 +83,17 @@ task:
8783
CHANNEL: "master"
8884
CHANNEL: "stable"
8985
script:
90-
- flutter channel $CHANNEL
86+
- flutter config --enable-linux-desktop
9187
- ./script/build_all_plugins_app.sh linux
88+
- name: build-linux+drive-examples
89+
env:
90+
matrix:
91+
CHANNEL: "master"
92+
CHANNEL: "stable"
93+
build_script:
94+
- flutter config --enable-linux-desktop
95+
- ./script/incremental_build.sh build-examples --linux
96+
- xvfb-run ./script/incremental_build.sh drive-examples --linux
9297

9398
# Legacy Dockerfile configuration for web integration tests.
9499
# https://github.com/flutter/web_installers doesn't yet support the current
@@ -97,20 +102,9 @@ task:
97102
# tasks" block above once web_installers has been updated to support Chrome 89
98103
# (which is what the current image generated from .ci/Dockerfile has).
99104
task:
100-
# don't run on release tags since it creates O(n^2) tasks where n is the number of plugins
101-
only_if: $CIRRUS_TAG == ''
102-
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == ''
105+
<< : *ROOT_TASK_TEMPLATE
103106
container:
104107
dockerfile: .ci/Dockerfile-LegacyChrome
105-
env:
106-
INTEGRATION_TEST_PATH: "./packages/integration_test"
107-
upgrade_script:
108-
- flutter channel stable
109-
- flutter upgrade
110-
- flutter channel master
111-
- flutter upgrade
112-
- flutter config --enable-linux-desktop
113-
- git fetch origin master
114108
matrix:
115109
- name: integration_web_smoke_test
116110
env:
@@ -120,7 +114,6 @@ task:
120114
# Tests integration example test in web.
121115
only_if: "changesInclude('.cirrus.yml', 'packages/integration_test/**') || $CIRRUS_PR == ''"
122116
install_script:
123-
- flutter channel $CHANNEL
124117
- git clone https://github.com/flutter/web_installers.git
125118
- cd web_installers/packages/web_drivers/
126119
- pub get
@@ -130,26 +123,15 @@ task:
130123
- cd $INTEGRATION_TEST_PATH/example/
131124
- flutter drive -v --driver=test_driver/integration_test.dart --target=integration_test/example_test.dart -d web-server --release --browser-name=chrome
132125

133-
# Heavy-workload tasks.
126+
# Heavy-workload Linux tasks.
134127
# These use machines with more CPUs and memory, so will reduce parallelization
135128
# for non-credit runs.
136129
task:
137-
# don't run on release tags since it creates O(n^2) tasks where n is the number of plugins
138-
only_if: $CIRRUS_TAG == ''
139-
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == ''
130+
<< : *ROOT_TASK_TEMPLATE
140131
container:
141132
dockerfile: .ci/Dockerfile
142-
cpu: 8
143-
memory: 16G
144-
env:
145-
INTEGRATION_TEST_PATH: "./packages/integration_test"
146-
upgrade_script:
147-
- flutter channel stable
148-
- flutter upgrade
149-
- flutter channel master
150-
- flutter upgrade
151-
- flutter config --enable-linux-desktop
152-
- git fetch origin master
133+
cpu: 4
134+
memory: 12G
153135
matrix:
154136
### Android tasks ###
155137
- name: build-apks+java-test+firebase-test-lab
@@ -165,7 +147,6 @@ task:
165147
MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
166148
GCLOUD_FIREBASE_TESTLAB_KEY: ENCRYPTED[07586610af1fdfc894e5969f70ef2458341b9b7e9c3b7c4225a663b4a48732b7208a4d91c3b7d45305a6b55fa2a37fc4]
167149
script:
168-
- flutter channel $CHANNEL
169150
# Unsetting CIRRUS_CHANGE_MESSAGE and CIRRUS_COMMIT_MESSAGE as they
170151
# might include non-ASCII characters which makes Gradle crash.
171152
# See: https://github.com/flutter/flutter/issues/24935
@@ -186,35 +167,16 @@ task:
186167
- fi
187168
- export CIRRUS_CHANGE_MESSAGE=`cat /tmp/cirrus_change_message.txt`
188169
- export CIRRUS_COMMIT_MESSAGE=`cat /tmp/cirrus_commit_message.txt`
189-
### Linux desktop tasks ###
190-
- name: build-linux+drive-examples
191-
env:
192-
matrix:
193-
CHANNEL: "master"
194-
CHANNEL: "stable"
195-
build_script:
196-
- flutter channel $CHANNEL
197-
- ./script/incremental_build.sh build-examples --linux
198-
- xvfb-run ./script/incremental_build.sh drive-examples --linux
199170

171+
# macOS tasks.
200172
task:
201-
# Xcode 12 task
202-
# don't run on release tags since it creates O(n^2) tasks where n is the number of plugins
203-
only_if: $CIRRUS_TAG == ''
204-
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true' && $CIRRUS_PR == ''
173+
<< : *ROOT_TASK_TEMPLATE
174+
# Only one macOS task can run in parallel without credits, so use them for
175+
# PRs on macOS.
176+
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
205177
osx_instance:
206178
image: big-sur-xcode-12.3
207-
upgrade_script:
208-
- sudo gem install cocoapods
209-
- flutter channel stable
210-
- flutter upgrade
211-
- flutter channel master
212-
- flutter upgrade
213-
- flutter config --enable-macos-desktop
214-
- git fetch origin master
215-
create_simulator_script:
216-
- xcrun simctl list
217-
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-14-3 | xargs xcrun simctl boot
179+
cocoapod_install_script: sudo gem install cocoapods
218180
matrix:
219181
### Platform-agnostic tasks ###
220182
- name: lint_darwin_plugins
@@ -225,8 +187,6 @@ task:
225187
script:
226188
# TODO(jmagman): Lint macOS podspecs but skip any that fail library validation.
227189
- find . -name "*.podspec" | xargs grep -l "osx" | xargs rm
228-
# Skip the dummy podspecs used to placate the tool.
229-
- find . -name "*_web*.podspec" -o -name "*_mac*.podspec" | xargs rm
230190
- ./script/incremental_build.sh podspecs
231191
### iOS tasks ###
232192
- name: build_all_plugins_ipa
@@ -235,7 +195,6 @@ task:
235195
CHANNEL: "master"
236196
CHANNEL: "stable"
237197
script:
238-
- flutter channel $CHANNEL
239198
- ./script/build_all_plugins_app.sh ios --no-codesign
240199
- name: build-ipas+drive-examples
241200
env:
@@ -250,8 +209,10 @@ task:
250209
CHANNEL: "master"
251210
CHANNEL: "stable"
252211
SIMCTL_CHILD_MAPS_API_KEY: ENCRYPTED[596a9f6bca436694625ac50851dc5da6b4d34cba8025f7db5bc9465142e8cd44e15f69e3507787753accebfc4910d550]
212+
create_simulator_script:
213+
- xcrun simctl list
214+
- xcrun simctl create Flutter-iPhone com.apple.CoreSimulator.SimDeviceType.iPhone-11 com.apple.CoreSimulator.SimRuntime.iOS-14-3 | xargs xcrun simctl boot
253215
build_script:
254-
- flutter channel $CHANNEL
255216
- ./script/incremental_build.sh build-examples --ipa
256217
- ./script/incremental_build.sh xctest --skip $PLUGINS_TO_SKIP_XCTESTS --ios-destination "platform=iOS Simulator,name=iPhone 11,OS=latest"
257218
# `drive-examples` contains integration tests, which changes the UI of the application.
@@ -265,7 +226,7 @@ task:
265226
CHANNEL: "master"
266227
CHANNEL: "stable"
267228
script:
268-
- flutter channel $CHANNEL
229+
- flutter config --enable-macos-desktop
269230
- ./script/build_all_plugins_app.sh macos
270231
- name: build-macos+drive-examples
271232
env:
@@ -274,6 +235,6 @@ task:
274235
CHANNEL: "stable"
275236
PATH: $PATH:/usr/local/bin
276237
build_script:
277-
- flutter channel $CHANNEL
238+
- flutter config --enable-macos-desktop
278239
- ./script/incremental_build.sh build-examples --macos --no-ipa
279240
- ./script/incremental_build.sh drive-examples --macos

0 commit comments

Comments
 (0)