1515# workaround by always running flutter pub get immediately before building,
1616# and performing build for msix:create manually to allow implementing this workaround
1717jobs :
18- # test:
19- # name: Run Tests
20- # runs-on: ubuntu-latest
21- # steps:
22- # - name: Clone repository
23- # uses: actions/checkout@v6
24- # - uses: actions/setup-java@v5
25- # with:
26- # distribution: 'zulu'
27- # java-version: '17'
28- # - name: Install dependencies
29- # run: |
30- # sudo apt-get update
31- # sudo apt-get install -y build-essential cmake ninja-build libgtk-3-dev
32- # - name: Set up Flutter
33- # uses: subosito/flutter-action@v2
34- # with:
35- # channel: 'stable'
36- # - run: flutter doctor
37- # - run: flutter pub get
38- # - run: flutter test
39-
4018 build-android :
4119 name : Build for Android
4220 runs-on : ubuntu-latest
4321 steps :
4422 - name : Clone repository
4523 uses : actions/checkout@v6
24+
4625 - uses : actions/setup-java@v5
4726 with :
4827 distribution : ' zulu'
4928 java-version : ' 17'
50- - name : Install dependencies
51- run : |
52- sudo apt-get update
53- sudo apt-get install -y build-essential cmake ninja-build libgtk-3-dev
29+
5430 - name : Free up disk space
5531 run : |
5632 # Remove .NET SDKs
@@ -64,32 +40,95 @@ jobs:
6440 # Remove PowerShell
6541 sudo rm -rf /usr/local/share/powershell
6642 df -h
67- - name : Set up Flutter
43+
44+ # Use the same flutter setup as the linux build to allow sharing the pub cache and it utilizing the same cache key
45+ - name : Determine Flutter stable version
6846 uses : subosito/flutter-action@v2
47+ id : flutter-version
6948 with :
49+ architecture : ' x64'
7050 channel : ' stable'
51+ dry-run : true
52+ - name : Set up Flutter
53+ uses : subosito/flutter-action@v2
54+ with :
55+ # Prebuilt ARM linux builds are not provided, so build flutter from source
56+ channel : master
57+ flutter-version : " ${{ steps.flutter-version.outputs.VERSION }}"
58+ cache : false
59+ pub-cache : true
60+ # Include arch as linux aarch64 include isar overriding
61+ # arch can be removed later once isar aarch64 is easily available on pub.dev and overriding is not needed anymore
62+ pub-cache-key : " flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
63+
64+
65+ - name : Gradle cache
66+ uses : actions/cache@v5
67+ with :
68+ path : |
69+ ~/.gradle/caches
70+ ~/.gradle/wrapper
71+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
72+ # If exact match is not found, fallback to OS match
73+ restore-keys : ${{ runner.os }}-gradle-
74+
75+ - name : Cache Dart build cache
76+ uses : actions/cache@v5
77+ with :
78+ path : |
79+ .dart_tool
80+ build
81+ key : ${{ runner.os }}-android-dart-build-${{ hashFiles('pubspec.lock') }}
82+ restore-keys : ${{ runner.os }}-android-dart-build-
83+
7184 - run : flutter doctor
7285 - run : flutter pub get
86+
7387 - run : flutter build apk --debug --no-pub
88+
7489 - uses : actions/upload-artifact@v6
7590 with :
7691 name : finamp-android-debug.apk
7792 path : build/app/outputs/flutter-apk/app-debug.apk
7893 compression-level : 0 # no compression
94+
7995 - run : flutter build appbundle --debug --no-pub
8096
8197 build-ios :
8298 name : Build for iOS
8399 runs-on : macos-latest
84100 steps :
85101 - uses : actions/checkout@v6
102+
86103 - name : Set up Flutter
87104 uses : subosito/flutter-action@v2
88105 with :
89106 channel : ' stable'
90- architecture : x64
107+ cache : false
108+ pub-cache : true
109+
110+ - name : Cache CocoaPods
111+ uses : actions/cache@v5
112+ with :
113+ path : |
114+ ios/Pods
115+ ~/.cocoapods
116+ key : ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
117+ restore-keys : ${{ runner.os }}-pods-
118+
119+ - name : Cache Dart build cache
120+ uses : actions/cache@v5
121+ with :
122+ path : |
123+ .dart_tool
124+ build
125+ key : ${{ runner.os }}-dart-build-${{ hashFiles('pubspec.lock') }}
126+ restore-keys : ${{ runner.os }}-dart-build-
127+
128+
91129 - run : flutter doctor
92130 - run : flutter pub get
131+
93132 - run : flutter build ios --release --no-pub --no-codesign
94133
95134 build-linux :
@@ -106,14 +145,17 @@ jobs:
106145 steps :
107146 - name : Clone repository
108147 uses : actions/checkout@v6
148+
109149 - uses : actions/setup-java@v5
110150 with :
111151 distribution : ' zulu'
112152 java-version : ' 17'
153+
113154 - name : Install dependencies
114155 run : |
115156 sudo apt-get update
116157 sudo apt-get install -y build-essential cmake ninja-build libgtk-3-dev
158+
117159 - name : Determine Flutter stable version
118160 uses : subosito/flutter-action@v2
119161 id : flutter-version
@@ -127,6 +169,21 @@ jobs:
127169 # Prebuilt ARM linux builds are not provided, so build flutter from source
128170 channel : master
129171 flutter-version : " ${{ steps.flutter-version.outputs.VERSION }}"
172+ cache : false
173+ pub-cache : true
174+ # Include arch as linux aarch64 include isar overriding
175+ # arch can be removed later once isar aarch64 is easily available on pub.dev and overriding is not needed anymore
176+ pub-cache-key : " flutter-pub-:os:-:channel:-:version:-:arch:-:hash:"
177+
178+ - name : Cache Dart build cache
179+ uses : actions/cache@v5
180+ with :
181+ path : |
182+ .dart_tool
183+ build
184+ key : ${{ runner.os }}-${{ matrix.arch }}-dart-build-${{ hashFiles('pubspec.lock') }}
185+ restore-keys : ${{ runner.os }}-${{ matrix.arch }}-dart-build-
186+
130187 - run : flutter doctor
131188 - run : flutter pub get
132189
@@ -142,7 +199,7 @@ jobs:
142199 if : matrix.arch == 'arm64'
143200 run : |
144201 sh tool/build_linux.sh aarch64
145- mv libisar_linux_arm64.so $HOME/.pub-cache/git/isar_flutter_libs-59103190aa2ac03041d61ad6d127b540be079ec8 /linux/libisar.so
202+ mv libisar_linux_arm64.so $HOME/.pub-cache/git/isar_flutter_libs-* /linux/libisar.so
146203 working-directory : isar
147204
148205 - run : flutter build linux --release --no-pub
@@ -196,6 +253,7 @@ jobs:
196253 steps :
197254 - name : Support longpaths
198255 run : git config --system core.longpaths true
256+
199257 - name : Clone repository
200258 uses : actions/checkout@v6
201259 # - uses: actions/setup-java@v2
@@ -204,12 +262,25 @@ jobs:
204262 # java-version: '17'
205263 - name : Set up Rust (for smtc_windows)
206264 uses : hecrj/setup-rust-action@v2
265+
207266 - name : Set up Flutter
208267 uses : subosito/flutter-action@v2
209268 with :
210269 channel : ' stable'
270+ cache : false
271+ pub-cache : true
272+
211273 - run : flutter doctor
212274 - run : flutter pub get
275+
276+ - name : Cache Dart build cache
277+ uses : actions/cache@v5
278+ with :
279+ path : |
280+ build
281+ key : ${{ runner.os }}-dart-build-${{ hashFiles('**/pubspec.yaml') }}
282+ restore-keys : ${{ runner.os }}-dart-build-
283+
213284 - run : flutter build windows
214285
215286 - name : Set archive and msix base name
0 commit comments