-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (139 loc) · 4.82 KB
/
build_and_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# name: Flutter CI/CD
# on:
# push:
# branches: [ main, develop ]
# pull_request:
# branches: [ main, develop ]
# workflow_dispatch:
# # Define environment variables that can be reused
# env:
# FLUTTER_VERSION: "3.19.0"
# JAVA_VERSION: "12.x"
# jobs:
# analyze-and-test:
# name: Analyze and Test
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Setup Java
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: ${{ env.JAVA_VERSION }}
# - name: Setup Flutter
# uses: subosito/flutter-action@v2
# with:
# flutter-version: ${{ env.FLUTTER_VERSION }}
# channel: 'stable'
# cache: true
# - name: Install dependencies
# run: flutter pub get
# - name: Verify formatting
# run: dart format --output=none --set-exit-if-changed .
# - name: Analyze project source
# run: flutter analyze
# - name: Run tests with coverage
# run: flutter test --coverage
# - name: Upload coverage reports
# uses: codecov/codecov-action@v3
# with:
# file: coverage/lcov.info
# build-android:
# name: Build Android App
# needs: analyze-and-test
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Setup Java
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: ${{ env.JAVA_VERSION }}
# - name: Setup Flutter
# uses: subosito/flutter-action@v2
# with:
# flutter-version: ${{ env.FLUTTER_VERSION }}
# channel: 'stable'
# cache: true
# - name: Install dependencies
# run: flutter pub get
# # Decode base64 key into a file
# - name: Decode Keystore
# if: startsWith(github.ref, 'refs/heads/main')
# run: |
# echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks
# # Create key.properties
# - name: Create key.properties
# if: startsWith(github.ref, 'refs/heads/main')
# run: |
# echo "storeFile=keystore.jks" > android/key.properties
# echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" >> android/key.properties
# echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
# echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
# # Build APK and AAB
# - name: Build Android App
# run: |
# if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
# flutter build apk --release
# flutter build appbundle --release
# else
# flutter build apk --debug
# fi
# # Upload artifacts
# - name: Upload APK
# uses: actions/upload-artifact@v3
# with:
# name: release-apk
# path: build/app/outputs/flutter-apk/app-release.apk
# if-no-files-found: error
# build-ios:
# name: Build iOS App
# needs: analyze-and-test
# runs-on: macos-latest
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Setup Flutter
# uses: subosito/flutter-action@v2
# with:
# flutter-version: ${{ env.FLUTTER_VERSION }}
# channel: 'stable'
# cache: true
# - name: Install dependencies
# run: |
# flutter pub get
# cd ios && pod install && cd ..
# # Build for iOS
# - name: Build iOS App
# run: |
# if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
# flutter build ios --release --no-codesign
# else
# flutter build ios --debug --no-codesign
# fi
# deploy:
# name: Deploy Apps
# needs: [build-android, build-ios]
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main'
# steps:
# - name: Download APK
# uses: actions/download-artifact@v3
# with:
# name: release-apk
# # Example Firebase App Distribution
# - name: Upload to Firebase App Distribution
# uses: wzieba/Firebase-Distribution-Github-Action@v1
# with:
# appId: ${{ secrets.FIREBASE_APP_ID }}
# serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
# groups: testers
# file: app-release.apk
# releaseNotes: |
# Changes in this build:
# - ${{ github.event.head_commit.message }}