1+ name : Flutter CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - develop
8+ pull_request :
9+ branches :
10+ - main
11+ - develop
12+
13+ jobs :
14+ flutter_test :
15+ name : Flutter Test and Analyze
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout code
19+ uses : actions/checkout@v4
20+
21+ - name : Setup Java
22+ uses : actions/setup-java@v4
23+ with :
24+ distribution : ' zulu'
25+ java-version : ' 17'
26+
27+ - name : Setup Flutter
28+ uses : subosito/flutter-action@v2
29+ with :
30+ flutter-version : ' 3.24.0'
31+ channel : ' stable'
32+ cache : true
33+
34+ - name : Get dependencies
35+ run : flutter pub get
36+
37+ - name : Check format
38+ run : dart format --output=none --set-exit-if-changed .
39+
40+ - name : Analyze
41+ run : flutter analyze
42+
43+ - name : Run tests
44+ run : flutter test --coverage
45+
46+ - name : Upload coverage to Codecov
47+ uses : codecov/codecov-action@v4
48+ with :
49+ token : ${{ secrets.CODECOV_TOKEN }}
50+ file : coverage/lcov.info
51+
52+ build_android :
53+ name : Build Android App
54+ runs-on : ubuntu-latest
55+ needs : flutter_test
56+ steps :
57+ - name : Checkout code
58+ uses : actions/checkout@v4
59+
60+ - name : Setup Java
61+ uses : actions/setup-java@v4
62+ with :
63+ distribution : ' zulu'
64+ java-version : ' 17'
65+
66+ - name : Setup Flutter
67+ uses : subosito/flutter-action@v2
68+ with :
69+ flutter-version : ' 3.24.0'
70+ channel : ' stable'
71+ cache : true
72+
73+ - name : Get dependencies
74+ run : flutter pub get
75+
76+ - name : Build APK
77+ run : flutter build apk --release
78+
79+ - name : Build App Bundle
80+ run : flutter build appbundle --release
81+
82+ - name : Upload APK as artifact
83+ uses : actions/upload-artifact@v4
84+ with :
85+ name : release-apk
86+ path : build/app/outputs/flutter-apk/app-release.apk
87+
88+ - name : Upload App Bundle as artifact
89+ uses : actions/upload-artifact@v4
90+ with :
91+ name : release-appbundle
92+ path : build/app/outputs/bundle/release/app-release.aab
93+
94+ build_ios :
95+ name : Build iOS App
96+ runs-on : macos-latest
97+ needs : flutter_test
98+ steps :
99+ - name : Checkout code
100+ uses : actions/checkout@v4
101+
102+ - name : Setup Flutter
103+ uses : subosito/flutter-action@v2
104+ with :
105+ flutter-version : ' 3.24.0'
106+ channel : ' stable'
107+ cache : true
108+
109+ - name : Get dependencies
110+ run : flutter pub get
111+
112+ - name : Build iOS
113+ run : flutter build ios --release --no-codesign
114+
115+ - name : Create IPA
116+ run : |
117+ cd build/ios/iphoneos
118+ mkdir Payload
119+ cp -r Runner.app Payload/
120+ zip -r app-release.ipa Payload/
121+
122+ - name : Upload IPA as artifact
123+ uses : actions/upload-artifact@v4
124+ with :
125+ name : release-ipa
126+ path : build/ios/iphoneos/app-release.ipa
0 commit comments