-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (80 loc) · 3.12 KB
/
Copy pathmobile-flutter.yml
File metadata and controls
97 lines (80 loc) · 3.12 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
name: Mobile (Flutter) CI
# Compiler-verifies the Flutter app in mobile/. analyze + build are the gates
# (they surface beta viam_sdk symbol drift and dependency-resolution issues);
# formatting is advisory so hand-formatting doesn't block the build.
on:
push:
branches: ["main", "claude/**"]
paths:
- "mobile/**"
- ".github/workflows/mobile-flutter.yml"
pull_request:
paths:
- "mobile/**"
- ".github/workflows/mobile-flutter.yml"
workflow_dispatch:
defaults:
run:
working-directory: mobile
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.29.3"
channel: stable
cache: true
- run: flutter --version
# Materialize the gitignored platform folders (android/ ios/ …) so the
# project is buildable; leaves lib/ and pubspec.yaml untouched.
- name: Materialize platform folders
run: flutter create .
- name: Resolve dependencies
run: flutter pub get
- name: Format check (advisory)
continue-on-error: true
run: dart format --output=none --set-exit-if-changed .
- name: Analyze
run: flutter analyze
- name: Unit tests (if any)
run: if [ -d test ]; then flutter test; else echo "no test/ dir, skipping"; fi
build-android:
runs-on: ubuntu-latest
needs: analyze
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.24.5"
channel: stable
cache: true
- name: Materialize platform folders
run: flutter create .
# flutter_appauth's Android manifest declares a redirect activity that
# requires the appAuthRedirectScheme manifest placeholder; without it the
# manifest merge fails. The platform folder is regenerated each run, so
# inject it here (idempotent; handles Groovy and Kotlin DSL).
- name: Configure AppAuth redirect scheme
run: |
set -e
SCHEME=com.viam.chartplotter
if [ -f android/app/build.gradle ]; then
grep -q appAuthRedirectScheme android/app/build.gradle || \
sed -i "0,/defaultConfig {/s//defaultConfig {\n manifestPlaceholders += [appAuthRedirectScheme: \"$SCHEME\"]/" android/app/build.gradle
elif [ -f android/app/build.gradle.kts ]; then
grep -q appAuthRedirectScheme android/app/build.gradle.kts || \
sed -i "0,/defaultConfig {/s//defaultConfig {\n manifestPlaceholders[\"appAuthRedirectScheme\"] += \"$SCHEME\"/" android/app/build.gradle.kts
fi
- name: Resolve dependencies
run: flutter pub get
# Debug APK: no signing config or secrets needed. OAuth/boat dart-defines
# are optional (the app builds without them and runs chart-only), so CI
# exercises the full compile without credentials.
- name: Build debug APK
run: flutter build apk --debug