-
-
Notifications
You must be signed in to change notification settings - Fork 507
222 lines (212 loc) · 8.56 KB
/
integrate.yaml
File metadata and controls
222 lines (212 loc) · 8.56 KB
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Pull Request Workflow
on:
pull_request:
merge_group:
jobs:
code_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: webiny/action-conventional-commits@v1.3.1
- run: ./scripts/generate-locale-config.sh
- run: git diff --exit-code
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .tool_versions.yaml
cache: true
- name: Check for unused translations
run: flutter pub run translations_cleaner list-unused-terms -a
- run: flutter pub get
- name: Check if pubspec.lock is up to date
run: git diff --exit-code pubspec.lock
- name: Check formatting
run: dart format lib/ test/ --set-exit-if-changed
- name: Check license compliance
run: dart run license_checker check-licenses -c licenses.yaml --problematic
- run: flutter analyze
- name: Search unused dependencies
run: |
dart pub global activate dependency_validator
dart pub global run dependency_validator
- run: dart run dart_code_linter:metrics analyze lib --reporter=github
- run: dart run dart_code_linter:metrics check-unused-code lib
- run: dart run dart_code_linter:metrics check-unused-files lib
- run: dart run dart_code_linter:metrics check-unused-l10n lib
- name: Check for commented-out Dart code with semicolons
run: |
if grep -R --include="*.dart" -nE '^[[:space:]]*//[^/<].*;[[:space:]]*$' lib/; then
echo ""
echo "❌ Found commented-out Dart code ending with semicolon."
exit 1
fi
- name: Add Firebase Messaging
run: ./scripts/add-firebase-messaging.sh
- run: flutter analyze
- run: flutter test
build_debug_apk:
needs: [ code_tests ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/free_up_space
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .tool_versions.yaml
cache: true
- uses: moonrepo/setup-rust@v1
with:
cache: true
- name: Cache Gradle
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}-
- run: ./scripts/add-firebase-messaging.sh
- run: flutter build apk --debug --target-platform android-x64
- name: Upload Debug APK
uses: actions/upload-artifact@v7
with:
name: debug-apk-x64
path: build/app/outputs/flutter-apk/app-debug.apk
build_debug_web:
needs: [ code_tests ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .tool_versions.yaml
cache: true
- uses: moonrepo/setup-rust@v1
- run: rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- run: flutter pub get
- name: Prepare web
run: ./scripts/prepare-web.sh
- run: flutter build web
- name: Upload Web Build
uses: actions/upload-artifact@v7
with:
name: Web Build
path: build/web
build_debug_linux:
needs: [ code_tests ]
strategy:
matrix:
arch: [ x64, arm64 ]
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest'}}
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install git wget curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev libjsoncpp-dev cmake-data libsecret-1-dev libsecret-1-0 librhash0 libssl-dev libwebkit2gtk-4.1-dev -y
- run: echo "FLUTTER_VERSION=$(yq '.environment.flutter' < .tool_versions.yaml)" >> $GITHUB_ENV
- name: Install Flutter
run: |
git clone --branch ${{ env.FLUTTER_VERSION }} https://github.com/flutter/flutter.git
./flutter/bin/flutter doctor
- uses: moonrepo/setup-rust@v1
- run: ./flutter/bin/flutter pub get
- run: ./flutter/bin/flutter build linux --target-platform linux-${{ matrix.arch }}
build_debug_ios:
needs: [ code_tests ]
runs-on: macos-15
steps:
- uses: actions/checkout@v6
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .tool_versions.yaml
cache: true
- name: Use Xcode 16.4
run: sudo xcode-select --switch /Applications/Xcode_16.4.app
- run: brew install sqlcipher
- uses: moonrepo/setup-rust@v1
- run: ./scripts/add-firebase-messaging.sh
- run: flutter pub get
- run: flutter build ios --no-codesign
integration_test:
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [ code_tests ]
strategy:
matrix:
api-level: [34]
env:
ANDROID_USER_HOME: /home/runner/.android
ANDROID_EMULATOR_HOME: /home/runner/.android
ANDROID_AVD_HOME: /home/runner/.android/avd
AVD_CONFIG_PATH: "~/.android/avd/test.avd/config.ini"
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/free_up_space
# https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
- name: Enable KVM group perms
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: AVD cache
uses: actions/cache@v5
id: avd-cache
with:
path: ~/.android/*
key: avd-${{ matrix.api-level }}-integration_docker
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
cores: 16
ndk: 28.2.13676358
force-avd-creation: false
disk-size: 4096M
ram-size: 4096M
sdcard-path-or-size: 4096M
emulator-options: -no-window -wipe-data -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: |
cat ${{ env.AVD_CONFIG_PATH }}
sed -i.bak 's/hw.lcd.density = .*/hw.lcd.density=420/' ${{ env.AVD_CONFIG_PATH }}
sed -i.bak 's/hw.lcd.height = .*/hw.lcd.height=1920/' ${{ env.AVD_CONFIG_PATH }}
sed -i.bak 's/hw.lcd.width = .*/hw.lcd.width=1080/' ${{ env.AVD_CONFIG_PATH }}
if ! grep -q "hw.lcd.density" ${{ env.AVD_CONFIG_PATH }} && echo "hw.lcd.density = 420" >> ${{ env.AVD_CONFIG_PATH }}; then :; fi
if ! grep -q "hw.lcd.height" ${{ env.AVD_CONFIG_PATH }} && echo "hw.lcd.height = 1920" >> ${{ env.AVD_CONFIG_PATH }}; then :; fi
if ! grep -q "hw.lcd.width" ${{ env.AVD_CONFIG_PATH }} && echo "hw.lcd.width = 1080" >> ${{ env.AVD_CONFIG_PATH }}; then :; fi
echo "Emulator settings (${{ env.AVD_CONFIG_PATH }})"
cat ${{ env.AVD_CONFIG_PATH }}
echo "Generated AVD snapshot for caching."
- uses: subosito/flutter-action@v2
with:
flutter-version-file: .tool_versions.yaml
cache: true
- uses: moonrepo/setup-rust@v1
with:
cache: true
- name: Cache Gradle
uses: actions/cache@v5
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}-
- run: ./scripts/add-firebase-messaging.sh
- name: Prepare Homeserver
run: ./scripts/prepare_integration_test.sh
- name: Integration tests
id: integration_tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
cores: 16
ndk: 28.2.13676358
force-avd-creation: false
disk-size: 4096M
ram-size: 4096M
sdcard-path-or-size: 4096M
emulator-options: -no-snapshot-save -no-window -wipe-data -accel on -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: flutter test integration_test/mobile_test.dart