14
14
push :
15
15
branches : [master]
16
16
17
+ env :
18
+ ANDROID_TOOLS_VERSION : 13114758
19
+ ANDROID_PLATFORM : android-36
20
+ ANDROID_BUILDTOOLS : 36.0.0
21
+
17
22
jobs :
18
23
Linux_tool-tests-general :
19
24
permissions :
31
36
fetch-tags : true
32
37
# Checkout the PR; not the merge commit - we need to describe tags
33
38
ref : ${{ github.event.pull_request.head.sha }}
39
+ path : ' flutter'
34
40
35
41
# Real checkout on github actions for post submit
36
42
- name : Checkout code (non-act push)
@@ -41,16 +47,20 @@ jobs:
41
47
fetch-tags : true
42
48
# Checkout the PR; not the merge commit - we need to describe tags
43
49
ref : ${{ github.event.pull_request.head.sha }}
50
+ path : ' flutter'
44
51
45
52
# Fake checkout if running locally
46
53
- name : Checkout code (act local)
47
54
uses : actions/checkout@v4
48
55
if : env.ACT
56
+ with :
57
+ path : ' flutter'
49
58
50
59
# If this is a branch / pr NOT on fluter/flutter, set the remote upstream
51
60
# so the flutter tool can figure out the version
52
61
- name : Set upstream (if not flutter/flutter)
53
62
if : github.repository != 'flutter/flutter' && !env.ACT
63
+ working-directory : ${{ github.workspace }}/flutter
54
64
run : |
55
65
git remote add upstream https://github.com/flutter/flutter.git
56
66
git fetch --all --tags
@@ -64,30 +74,87 @@ jobs:
64
74
distribution : ' temurin'
65
75
66
76
# If running locally; install Android SDK tools - Github runners have everything on them
67
- - name : Setup Android SDK
77
+ - name : Set Android SDK environment variable
68
78
if : env.ACT
79
+ run : |
80
+ echo "ANDROID_SDK_ROOT=$GITHUB_WORKSPACE/.android/sdk" >> $GITHUB_ENV
81
+ echo "ANDROID_HOME=$GITHUB_WORKSPACE/.android/sdk" >> $GITHUB_ENV
82
+ - name : Get Android SDK version
83
+ id : android-sdk-version
84
+ if : env.ACT
85
+ run : |
86
+ echo "revision=${{env.ANDROID_TOOLS_VERSION}};${{env.ANDROID_PLATFORM}};build-tools;${{env.ANDROID_BUILDTOOLS}}" >> "$GITHUB_OUTPUT"
87
+ - name : Android SDK Cache
88
+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
89
+ id : android-sdk-setup
90
+ if : env.ACT
91
+ with :
92
+ path : ${{ github.workspace }}/.android/sdk
93
+ key : ${{ runner.os }}-${{ steps.android-sdk-version.outputs.revision }}
94
+ - name : Setup Android SDK (cold cache)
95
+ if : env.ACT && steps.android-sdk-setup.outputs.cache-hit != 'true'
69
96
uses : android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407
70
97
with :
71
- cmdline- tools-version : 13114758
72
-
73
- # If running locally; install Android SDK - Github runners have everything on them
74
- - name : install android
75
- if : env.ACT
98
+ packages : ' tools platform-tools platforms;${{env.ANDROID_PLATFORM}} build-tools;${{env.ANDROID_BUILDTOOLS}} '
99
+ log-accepted-android-sdk-licenses : false
100
+ cmdline-tools-version : ${{ env.ANDROID_TOOLS_VERSION }}
101
+ - name : Setup Android SDK (warm cache)
102
+ if : env.ACT && steps.android-sdk-setup.outputs.cache-hit == 'true'
76
103
run : |
77
- sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0"
104
+ echo "$GITHUB_WORKSPACE/.android/sdk/cmdline-tools/${{ env.ANDROID_TOOLS_VERSION }}/bin" >> "$GITHUB_PATH"
105
+ echo "$GITHUB_WORKSPACE/.android/sdk/platform-tools" >> "$GITHUB_PATH"
78
106
79
107
- name : Add `flutter` to the PATH
80
108
run : |
81
- echo "$PWD/bin" >> "$GITHUB_PATH"
109
+ echo "$GITHUB_WORKSPACE/flutter/bin" >> "$GITHUB_PATH"
110
+
111
+ - name : Setup PUB_CACHE environment variable
112
+ run : |
113
+ echo "PUB_CACHE=$GITHUB_WORKSPACE/.pub-cache" >> $GITHUB_ENV
114
+
115
+ # Get the Flutter revision. This is the key for the cache for artifacts
116
+ # under bin/cache
117
+ - name : Get Flutter version
118
+ id : flutter-revision
119
+ working-directory : ${{ github.workspace }}/flutter
120
+ run : |
121
+ echo "revision=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
122
+ - name : Flutter artifacts cache
123
+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
124
+ id : flutter-artifacts
125
+ with :
126
+ path : ${{ github.workspace }}/flutter/bin/cache
127
+ key : ${{ runner.os }}-flutter-${{ steps.flutter-revision.outputs.revision }}
128
+
129
+ - name : pub deps hash
130
+ id : pub-deps-hash
131
+ working-directory : ${{ github.workspace }}/flutter
132
+ run : |
133
+ # Generate stable hash of pubspec.yaml files
134
+ find dev examples packages -name "pubspec.yaml" -print0 | sort -z | xargs -0 cat | sha256sum >> "$RUNNER_TEMP/pub_deps_sha"
135
+ echo "revision=$(cat "$RUNNER_TEMP/pub_deps_sha")" >> "$GITHUB_OUTPUT"
136
+ - name : pub package cache
137
+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
138
+ id : pub-cache
139
+ with :
140
+ path : |
141
+ ${{ github.workspace }}/.pub-cache
142
+ ${{ github.workspace }}/flutter/**/.dart_tool
143
+ ${{ github.workspace }}/flutter/**/pubspec.lock
144
+ key : ${{ runner.os }}-pub-${{ steps.pub-deps-hash.outputs.revision }}
82
145
83
146
- name : Flutter Doctor
147
+ working-directory : ${{ github.workspace }}/flutter
84
148
run : |
85
149
flutter doctor
86
150
87
- - name : update-packages
151
+ - name : update-packages (online)
152
+ if : steps.pub-cache.outputs.cache-hit != 'true'
153
+ working-directory : ${{ github.workspace }}/flutter
88
154
run : |
89
155
flutter update-packages
90
156
91
157
- name : Tool Test
158
+ working-directory : ${{ github.workspace }}/flutter
92
159
run : |
93
160
SHARD=tool_tests SUBSHARD=general dart --enable-asserts dev/bots/test.dart
0 commit comments