-
Notifications
You must be signed in to change notification settings - Fork 1
199 lines (170 loc) · 5.86 KB
/
ci.yaml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#
# Flowmotion
# CI/CD Pipeline
#
name: Flowmotion CI/CD
on:
push: {}
env:
ANDROID_API_LEVEL: 23
jobs:
build-mobile-android:
name: Build Mobile App (Android)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Restore Gradle build cache
uses: gradle/actions/setup-gradle@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- name: Build Android APK
run: flutter build apk --debug
- name: Upload Android APK
uses: actions/upload-artifact@v4
with:
name: flowmotion.apk
path: build/app/outputs/flutter-apk/*.apk
test-mobile-android:
name: Test Mobile App (Android)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Restore Gradle build cache
uses: gradle/actions/setup-gradle@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
# setup android emulator for testing
- name: Enable KVM for Android emulator
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Setup AVD emulator cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.ANDROID_API_LEVEL }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
# run tests on android AVD
- name: Write test_auth_info.dart secrets
run: printf "${{ secrets.TEST_AUTH_INFO_B64 }}" | base64 -d > test_auth_info.dart
- name: Test Mobile App (Android)
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_API_LEVEL }}
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: flutter drive --driver=test_driver/integration_driver.dart --target=integration_test/main.dart
build-mobile-ios:
name: Build Mobile App (iOS)
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- name: Restore Xcode build cache
uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- name: Restore Cocoapods build cache
uses: actions/cache@v4
with:
path: ios/Pods
key: cocoapods-cache-${{ hashFiles('ios/Podfile.lock') }}
- name: Build iOS xcarchive
run: flutter build ipa --no-codesign
- name: Upload iOS xcarchive
uses: actions/upload-artifact@v4
with:
name: flowmotion.xcarchive
path: build/ios/archive/*.ipa
test-mobile-ios:
name: Test Mobile App (iOS)
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- name: Restore Xcode build cache
uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
- name: Boot iOS simulator
uses: futureware-tech/simulator-action@v3
with:
model: "iPhone 15"
os: "iOS"
os_version: "17.4"
# run tests on ios simulator
- name: Write test_auth_info.dart secrets
run: printf "${{ secrets.TEST_AUTH_INFO_B64 }}" | base64 -d > test_auth_info.dart
- name: Test Mobile App (iOS)
run: flutter drive --driver=test_driver/integration_driver.dart --target=integration_test/main.dart
pipeline:
strategy:
fail-fast: false
matrix:
target: [lint, test]
name: "${{ matrix.target }} Pipeline"
defaults:
run:
working-directory: pipeline
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10.13"
# cache pip dependencies
cache: "pip"
- name: Install Pip dependencies
run: pip install -r requirements.txt
- uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}"
- name: "${{ matrix.target }} Pipeline"
run: "make ${{ matrix.target }}"
schema:
name: "Validate JSON Schema"
runs-on: ubuntu-22.04
defaults:
run:
working-directory: schema
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.9.x
# cache npm dependencies
cache: npm
cache-dependency-path: schema/package-lock.json
- name: Install npm dependencies
run: npm ci
- name: Validate json schema
run: npx ajv compile -s "*.schema.json" --spec=draft2020 -c ajv-formats