Skip to content

Commit d39cbdd

Browse files
authored
chore: setup build flavors for dogfooding app (#862)
* Chore: setup build flavors for android and iOS test options * chore: add macos flavors
1 parent 58e564c commit d39cbdd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3782
-12
lines changed

.github/workflows/app-distribute.yml

+26-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ on:
66
- main
77

88
workflow_dispatch:
9+
inputs:
10+
flavor:
11+
type: choice
12+
description: Build flavor
13+
options:
14+
- beta
15+
- prod
916

1017
env:
1118
FLUTTER_VERSION: "3.29.0"
@@ -65,10 +72,19 @@ jobs:
6572
working-directory: dogfooding/ios
6673
bundler-cache: true
6774

75+
- name: Set build flavor to Env
76+
run: |
77+
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
78+
FLAVOR=${{ inputs.flavor }}
79+
else
80+
FLAVOR=beta
81+
fi
82+
echo "FLAVOR=$FLAVOR" >> $GITHUB_ENV
83+
6884
- name: Build and Distribute
6985
run: |
7086
cd dogfooding/ios
71-
bundle exec fastlane ios build_and_deploy
87+
bundle exec fastlane ios build_and_deploy flavor:${{ env.FLAVOR }}
7288
7389
build_and_deploy_android:
7490
name: Build and Distribute Dogfooding Android
@@ -113,7 +129,15 @@ jobs:
113129
echo ${{ secrets.KEYSTORE }} | base64 --decode > dogfooding/android/upload-keystore.jks
114130
echo ${{ secrets.KEYSTORE_PROPERTIES }} | base64 --decode > dogfooding/android/key.properties
115131
132+
- name: Set build flavor to Env
133+
run: |
134+
if [[ ${{ github.event_name == 'workflow_dispatch' }} == true ]]; then
135+
echo "FLAVOR=${{ inputs.flavor }}" >> $GITHUB_ENV
136+
else
137+
echo "FLAVOR=beta" >> $GITHUB_ENV
138+
fi
139+
116140
- name: Build and Distribute
117141
run: |
118142
cd dogfooding/android
119-
bundle exec fastlane android build_and_deploy
143+
bundle exec fastlane android build_and_deploy flavor:${{ env.FLAVOR }}

.run/dogfooding.run.xml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="dogfooding" type="FlutterRunConfigurationType" factoryName="Flutter">
3+
<option name="additionalArgs" value="--flavor dev" />
4+
<option name="filePath" value="$PROJECT_DIR$/dogfooding/lib/main.dart" />
5+
<method v="2" />
6+
</configuration>
7+
</component>

dogfooding/android/app/build.gradle

+14
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ android {
106106
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
107107
}
108108
}
109+
110+
flavorDimensions += "default"
111+
112+
productFlavors {
113+
create("dev") {
114+
dimension = "default"
115+
}
116+
create("beta"){
117+
dimension = "default"
118+
}
119+
create("prod"){
120+
dimension = "default"
121+
}
122+
}
109123
}
110124

111125
flutter {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="107dp"
4+
android:height="107dp"
5+
android:viewportWidth="107"
6+
android:viewportHeight="107">
7+
<group>
8+
<clip-path
9+
android:pathData="M0,0h107v107h-107z"/>
10+
<path
11+
android:pathData="M107,0H0V107H107V0Z"
12+
android:fillColor="#005FFF"/>
13+
<path
14+
android:pathData="M107,0H0V107H107V0Z">
15+
<aapt:attr name="android:fillColor">
16+
<gradient
17+
android:startX="107"
18+
android:startY="-0"
19+
android:endX="0"
20+
android:endY="107"
21+
android:type="linear">
22+
<item android:offset="0" android:color="#FF49DDED"/>
23+
<item android:offset="1" android:color="#0049DDED"/>
24+
</gradient>
25+
</aapt:attr>
26+
</path>
27+
<path
28+
android:pathData="M0,76h107v31h-107z"
29+
android:fillColor="#00823D"/>
30+
<path
31+
android:pathData="M41.78,87V78.27H42.78V81.49H42.87C42.94,81.38 43.04,81.24 43.18,81.06C43.31,80.88 43.5,80.72 43.75,80.58C44,80.44 44.33,80.37 44.76,80.37C45.31,80.37 45.8,80.51 46.22,80.78C46.64,81.06 46.97,81.45 47.2,81.95C47.44,82.46 47.56,83.06 47.56,83.74C47.56,84.44 47.44,85.04 47.2,85.55C46.97,86.05 46.64,86.44 46.22,86.72C45.8,87 45.32,87.14 44.78,87.14C44.36,87.14 44.02,87.07 43.77,86.93C43.51,86.79 43.32,86.63 43.18,86.45C43.05,86.26 42.94,86.11 42.87,85.99H42.75V87H41.78ZM42.77,83.73C42.77,84.22 42.84,84.66 42.98,85.04C43.13,85.41 43.34,85.7 43.62,85.92C43.9,86.13 44.24,86.23 44.64,86.23C45.06,86.23 45.41,86.12 45.69,85.9C45.98,85.68 46.19,85.38 46.33,85C46.48,84.62 46.55,84.19 46.55,83.73C46.55,83.27 46.48,82.85 46.34,82.48C46.2,82.11 45.99,81.82 45.7,81.6C45.42,81.38 45.07,81.27 44.64,81.27C44.23,81.27 43.89,81.38 43.61,81.58C43.33,81.79 43.12,82.08 42.98,82.44C42.84,82.81 42.77,83.24 42.77,83.73ZM51.84,87.14C51.21,87.14 50.66,87 50.21,86.72C49.75,86.44 49.4,86.05 49.15,85.54C48.91,85.04 48.79,84.45 48.79,83.78C48.79,83.11 48.91,82.52 49.15,82.01C49.4,81.49 49.74,81.09 50.19,80.8C50.63,80.51 51.15,80.37 51.74,80.37C52.08,80.37 52.41,80.43 52.75,80.54C53.08,80.65 53.38,80.84 53.65,81.09C53.93,81.35 54.14,81.68 54.31,82.1C54.47,82.52 54.55,83.03 54.55,83.64V84.07H49.5V83.2H53.53C53.53,82.83 53.45,82.5 53.3,82.21C53.16,81.92 52.95,81.69 52.68,81.52C52.42,81.36 52.1,81.27 51.74,81.27C51.34,81.27 50.99,81.37 50.7,81.57C50.41,81.77 50.18,82.02 50.03,82.34C49.87,82.65 49.79,82.99 49.79,83.35V83.93C49.79,84.43 49.88,84.85 50.05,85.19C50.22,85.53 50.46,85.79 50.77,85.97C51.08,86.14 51.43,86.23 51.84,86.23C52.1,86.23 52.34,86.2 52.55,86.12C52.77,86.05 52.96,85.93 53.11,85.78C53.27,85.63 53.39,85.44 53.47,85.21L54.45,85.48C54.34,85.81 54.17,86.1 53.93,86.35C53.69,86.6 53.39,86.79 53.04,86.93C52.68,87.07 52.28,87.14 51.84,87.14ZM58.93,80.45V81.31H55.53V80.45H58.93ZM56.52,78.89H57.53V85.13C57.53,85.41 57.57,85.62 57.65,85.76C57.74,85.9 57.84,86 57.97,86.05C58.11,86.09 58.25,86.11 58.4,86.11C58.51,86.11 58.6,86.11 58.67,86.1C58.74,86.08 58.8,86.07 58.84,86.06L59.04,86.97C58.98,86.99 58.88,87.02 58.76,87.04C58.64,87.07 58.48,87.09 58.29,87.09C58.01,87.09 57.73,87.02 57.46,86.9C57.19,86.78 56.97,86.59 56.79,86.34C56.61,86.09 56.52,85.78 56.52,85.4V78.89ZM62.36,87.15C61.95,87.15 61.57,87.08 61.23,86.92C60.9,86.76 60.63,86.53 60.43,86.23C60.23,85.93 60.13,85.57 60.13,85.14C60.13,84.77 60.21,84.46 60.35,84.23C60.5,83.99 60.7,83.81 60.95,83.68C61.19,83.54 61.47,83.44 61.76,83.38C62.06,83.31 62.37,83.26 62.67,83.22C63.07,83.16 63.39,83.13 63.64,83.1C63.89,83.07 64.07,83.03 64.18,82.96C64.3,82.89 64.36,82.78 64.36,82.62V82.59C64.36,82.16 64.24,81.84 64.01,81.61C63.79,81.37 63.44,81.26 62.98,81.26C62.5,81.26 62.12,81.36 61.85,81.57C61.58,81.78 61.38,82.01 61.27,82.24L60.32,81.9C60.49,81.51 60.72,81.2 61,80.97C61.29,80.75 61.6,80.59 61.94,80.51C62.28,80.41 62.61,80.37 62.94,80.37C63.15,80.37 63.4,80.39 63.67,80.45C63.94,80.49 64.21,80.6 64.46,80.75C64.72,80.9 64.94,81.13 65.11,81.44C65.28,81.75 65.36,82.17 65.36,82.69V87H64.36V86.11H64.31C64.24,86.26 64.13,86.41 63.97,86.57C63.81,86.73 63.6,86.87 63.33,86.98C63.07,87.1 62.74,87.15 62.36,87.15ZM62.52,86.25C62.92,86.25 63.25,86.17 63.52,86.02C63.8,85.86 64.01,85.66 64.15,85.41C64.29,85.16 64.36,84.9 64.36,84.63V83.71C64.32,83.76 64.22,83.81 64.08,83.85C63.94,83.89 63.77,83.93 63.58,83.96C63.4,83.99 63.22,84.01 63.04,84.03C62.87,84.05 62.73,84.07 62.62,84.09C62.36,84.12 62.11,84.17 61.89,84.25C61.66,84.33 61.48,84.44 61.34,84.59C61.21,84.74 61.14,84.94 61.14,85.19C61.14,85.54 61.27,85.81 61.52,85.99C61.79,86.16 62.12,86.25 62.52,86.25Z"
32+
android:fillColor="#ffffff"/>
33+
</group>
34+
</vector>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="107dp"
4+
android:height="107dp"
5+
android:viewportWidth="107"
6+
android:viewportHeight="107">
7+
<path
8+
android:pathData="M0,0h107v107h-107z"
9+
android:fillColor="#1E1E1E"/>
10+
<group>
11+
<clip-path
12+
android:pathData="M0,0h107v107h-107z"/>
13+
<path
14+
android:pathData="M107,0H0V107H107V0Z"
15+
android:fillColor="#005FFF"/>
16+
<path
17+
android:pathData="M107,0H0V107H107V0Z">
18+
<aapt:attr name="android:fillColor">
19+
<gradient
20+
android:startX="107"
21+
android:startY="-0"
22+
android:endX="0"
23+
android:endY="107"
24+
android:type="linear">
25+
<item android:offset="0" android:color="#FF49DDED"/>
26+
<item android:offset="1" android:color="#0049DDED"/>
27+
</gradient>
28+
</aapt:attr>
29+
</path>
30+
<path
31+
android:pathData="M0,76h107v31h-107z"
32+
android:fillColor="#CA0000"/>
33+
<path
34+
android:pathData="M46.43,87.14C45.89,87.14 45.41,87 44.99,86.72C44.57,86.44 44.24,86.05 44.01,85.55C43.77,85.04 43.65,84.44 43.65,83.74C43.65,83.06 43.77,82.46 44.01,81.95C44.24,81.45 44.57,81.06 44.99,80.78C45.41,80.51 45.9,80.37 46.45,80.37C46.88,80.37 47.21,80.44 47.46,80.58C47.71,80.72 47.9,80.88 48.03,81.06C48.16,81.24 48.27,81.38 48.34,81.49H48.43V78.27H49.43V87H48.46V85.99H48.34C48.27,86.11 48.16,86.26 48.03,86.45C47.89,86.63 47.7,86.79 47.44,86.93C47.19,87.07 46.85,87.14 46.43,87.14ZM46.57,86.23C46.97,86.23 47.31,86.13 47.59,85.92C47.87,85.7 48.08,85.41 48.23,85.04C48.37,84.66 48.44,84.22 48.44,83.73C48.44,83.24 48.37,82.81 48.23,82.44C48.09,82.08 47.88,81.79 47.6,81.58C47.32,81.38 46.98,81.27 46.57,81.27C46.14,81.27 45.79,81.38 45.5,81.6C45.22,81.82 45.01,82.11 44.87,82.48C44.73,82.85 44.66,83.27 44.66,83.73C44.66,84.19 44.73,84.62 44.87,85C45.02,85.38 45.23,85.68 45.51,85.9C45.8,86.12 46.15,86.23 46.57,86.23ZM54.16,87.14C53.53,87.14 52.98,87 52.53,86.72C52.07,86.44 51.72,86.05 51.47,85.54C51.23,85.04 51.11,84.45 51.11,83.78C51.11,83.11 51.23,82.52 51.47,82.01C51.72,81.49 52.07,81.09 52.51,80.8C52.95,80.51 53.47,80.37 54.06,80.37C54.4,80.37 54.73,80.43 55.07,80.54C55.4,80.65 55.7,80.84 55.97,81.09C56.25,81.35 56.46,81.68 56.63,82.1C56.79,82.52 56.87,83.03 56.87,83.64V84.07H51.82V83.2H55.85C55.85,82.83 55.77,82.5 55.62,82.21C55.48,81.92 55.27,81.69 55,81.52C54.74,81.36 54.42,81.27 54.06,81.27C53.66,81.27 53.31,81.37 53.02,81.57C52.73,81.77 52.5,82.02 52.35,82.34C52.19,82.65 52.11,82.99 52.11,83.35V83.93C52.11,84.43 52.2,84.85 52.37,85.19C52.54,85.53 52.78,85.79 53.09,85.97C53.4,86.14 53.75,86.23 54.16,86.23C54.42,86.23 54.66,86.2 54.87,86.12C55.09,86.05 55.28,85.93 55.43,85.78C55.59,85.63 55.71,85.44 55.8,85.21L56.77,85.48C56.66,85.81 56.49,86.1 56.25,86.35C56.01,86.6 55.71,86.79 55.36,86.93C55,87.07 54.6,87.14 54.16,87.14ZM63.55,80.45L61.13,87H60.11L57.69,80.45H58.78L60.59,85.67H60.65L62.46,80.45H63.55Z"
35+
android:fillColor="#ffffff"/>
36+
</group>
37+
</vector>

dogfooding/android/fastlane/Fastfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import "../../Fastfile"
33
default_platform(:android)
44

55
platform :android do
6-
lane :build_appbundle do
6+
lane :build_appbundle do |options|
77
# Reuse parent fastfile tasks
88
fetch_dependencies
99
build_autogenerated_code
1010

11-
sh_on_root(command: "flutter build appbundle --no-pub --release --suppress-analytics")
11+
sh_on_root(command: "flutter build appbundle --flavor #{options[:flavor]} --no-pub --release --suppress-analytics")
1212
end
1313

14-
lane :build_and_deploy do
14+
lane :build_and_deploy do |options|
1515

1616
previous_build_number = google_play_track_version_codes(
1717
track: "internal",
@@ -24,7 +24,7 @@ platform :android do
2424
version_code: current_build_number
2525
)
2626

27-
build_appbundle
27+
build_appbundle(flavor: options[:flavor])
2828

2929
upload_to_play_store(
3030
track: 'internal',

dogfooding/ios/Podfile

+9
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@ ENV['COCOAPODS_DISABLE_STATS'] = 'true'
66

77
project 'Runner', {
88
'Debug' => :debug,
9+
'Debug-prod' => :debug,
10+
'Debug-beta' => :debug,
11+
'Debug-dev' => :debug,
912
'Profile' => :release,
13+
'Profile-prod' => :release,
14+
'Profile-beta' => :release,
15+
'Profile-dev' => :release,
1016
'Release' => :release,
17+
'Release-prod' => :release,
18+
'Release-beta' => :release,
19+
'Release-dev' => :release,
1120
}
1221

1322
def flutter_root

0 commit comments

Comments
 (0)