@@ -30,20 +30,48 @@ jobs:
3030 - name : Checkout
3131 uses : actions/checkout@v4.2.2
3232
33- # setup java because we are building for android too
3433 - name : Setup Java JDK
3534 uses : actions/setup-java@v4.7.0
3635 with :
3736 distribution : temurin
3837 java-version : ' 17'
3938
40- - name : Flutter action
39+ - name : Setup Flutter
4140 uses : subosito/flutter-action@v2.18.0
4241 with :
4342 channel : stable
43+ cache : true
4444
45- - name : Download and upgrade pub dependencies
46- run : flutter pub get && flutter pub upgrade
45+ - name : Cache pub dependencies
46+ uses : actions/cache@v4.2.2
47+ with :
48+ path : ~/.pub-cache
49+ key : ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
50+ restore-keys : ${{ runner.os }}-pub-
51+
52+ - name : Cache build artifacts
53+ uses : actions/cache@v4.2.2
54+ with :
55+ path : |
56+ .dart_tool/
57+ **/*.g.dart
58+ **/*.mocks.dart
59+ **/*.config.dart
60+ key : ${{ runner.os }}-build-artifacts-${{ hashFiles('pubspec.lock', '**/pubspec.yaml') }}
61+ restore-keys : ${{ runner.os }}-build-artifacts-
62+
63+ - name : Cache Gradle
64+ uses : actions/cache@v4.2.2
65+ with :
66+ path : |
67+ ~/.gradle/caches
68+ ~/.gradle/wrapper
69+ .gradle
70+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle', '**/gradle.properties') }}
71+ restore-keys : ${{ runner.os }}-gradle-
72+
73+ - name : Download pub dependencies
74+ run : flutter pub get
4775
4876 - name : Run build_runner
4977 run : dart run build_runner build --delete-conflicting-outputs
@@ -141,13 +169,39 @@ jobs:
141169 - name : Checkout
142170 uses : actions/checkout@v4.2.2
143171
144- - name : Flutter action
172+ - name : Setup Flutter
145173 uses : subosito/flutter-action@v2.18.0
146174 with :
147175 channel : stable
176+ cache : true
177+
178+ - name : Cache pub dependencies
179+ uses : actions/cache@v4.2.2
180+ with :
181+ path : ~/.pub-cache
182+ key : ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
183+ restore-keys : ${{ runner.os }}-pub-
148184
149- - name : Download and upgrade pub dependencies
150- run : flutter pub get && flutter pub upgrade
185+ - name : Cache build artifacts
186+ uses : actions/cache@v4.2.2
187+ with :
188+ path : |
189+ .dart_tool/
190+ **/*.g.dart
191+ **/*.mocks.dart
192+ **/*.config.dart
193+ key : ${{ runner.os }}-build-artifacts-${{ hashFiles('pubspec.lock', '**/pubspec.yaml') }}
194+ restore-keys : ${{ runner.os }}-build-artifacts-
195+
196+ - name : Cache CocoaPods
197+ uses : actions/cache@v4.2.2
198+ with :
199+ path : macos/Pods
200+ key : ${{ runner.os }}-pods-${{ hashFiles('macos/Podfile.lock') }}
201+ restore-keys : ${{ runner.os }}-pods-
202+
203+ - name : Download pub dependencies
204+ run : flutter pub get
151205
152206 - name : Run build_runner
153207 run : dart run build_runner build --delete-conflicting-outputs
@@ -162,10 +216,12 @@ jobs:
162216 filename : ${{ env.MACOS_ZIP }}
163217 directory : ${{ env.MACOS_BUILD_PATH }}
164218
165- - name : Install Node 18
219+ - name : Setup Node 18
166220 uses : actions/setup-node@v4.2.0
167221 with :
168222 node-version : 18
223+ cache : ' npm'
224+ cache-dependency-path : ' ${{ env.MACOS_DMG_PATH }}/package-lock.json'
169225
170226 - name : Install Appdmg and Create dmg
171227 working-directory : ${{ env.MACOS_DMG_PATH }}
@@ -189,13 +245,32 @@ jobs:
189245 - name : Checkout
190246 uses : actions/checkout@v4.2.2
191247
192- - name : Flutter action
248+ - name : Setup Flutter
193249 uses : subosito/flutter-action@v2.18.0
194250 with :
195251 channel : stable
252+ cache : true
196253
197- - name : Download and upgrade pub dependencies
198- run : flutter pub get && flutter pub upgrade
254+ - name : Cache pub dependencies
255+ uses : actions/cache@v4.2.2
256+ with :
257+ path : ~/.pub-cache
258+ key : ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
259+ restore-keys : ${{ runner.os }}-pub-
260+
261+ - name : Cache build artifacts
262+ uses : actions/cache@v4.2.2
263+ with :
264+ path : |
265+ .dart_tool/
266+ **/*.g.dart
267+ **/*.mocks.dart
268+ **/*.config.dart
269+ key : ${{ runner.os }}-build-artifacts-${{ hashFiles('pubspec.lock', '**/pubspec.yaml') }}
270+ restore-keys : ${{ runner.os }}-build-artifacts-
271+
272+ - name : Download pub dependencies
273+ run : flutter pub get
199274
200275 - name : Run build_runner
201276 run : dart run build_runner build --delete-conflicting-outputs
0 commit comments