App Center Integration with CI/CD workflow (#644)
Add Ionia client id to secrets Update how to build android instructions Change devicelocale version as it caused issues when building Add trigger for send test build to transfer.sh and notify slack channel
Omar Hatem committed
Nov 27, 2022 at 22:10 UTC
4d91ef6af8b554f66f68239b8fde46a7be59d7f2
4 files changed
+124
-3
.github/workflows/pr_test_build.yml
new
+116
@@ -0,0 +1,116 @@
1
+name: PR Test Build
2
+
3
+on:
4
+ pull_request:
5
+ branches: [ main ]
6
+
7
+jobs:
8
+ test:
9
+
10
+ runs-on: ubuntu-18.04
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: actions/setup-java@v1
15
+ with:
16
+ java-version: '8.x'
17
+
18
+ - name: Flutter action
19
+ uses: subosito/flutter-action@v1
20
+ with:
21
+ flutter-version: '3.3.x'
22
+ channel: stable
23
+
24
+ - name: Install package dependencies
25
+ run: sudo apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake clang
26
+
27
+ - name: Execute Build and Setup Commands
28
+ run: |
29
+ sudo mkdir -p /opt/android
30
+ sudo chown $USER /opt/android
31
+ cd /opt/android
32
+ git clone https://github.com/cake-tech/cake_wallet.git --branch $GITHUB_HEAD_REF
33
+ cd cake_wallet/scripts/android/
34
+ ./install_ndk.sh
35
+ source ./app_env.sh cakewallet
36
+ ./app_config.sh
37
+ ./build_all.sh
38
+ ./copy_monero_deps.sh
39
+
40
+ - name: Install Flutter dependencies
41
+ run: |
42
+ cd /opt/android/cake_wallet
43
+ flutter pub get
44
+
45
+ - name: Generate KeyStore
46
+ run: |
47
+ cd /opt/android/cake_wallet/android/app
48
+ keytool -genkey -v -keystore key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias testKey -noprompt -dname "CN=CakeWallet, OU=CakeWallet, O=CakeWallet, L=Florida, S=America, C=USA" -storepass ${{ secrets.STORE_PASS }} -keypass ${{ secrets.KEY_PASS }}
49
+
50
+ - name: Generate key properties
51
+ run: |
52
+ cd /opt/android/cake_wallet
53
+ flutter packages pub run tool/generate_android_key_properties.dart keyAlias=testKey storeFile=key.jks storePassword=${{ secrets.STORE_PASS }} keyPassword=${{ secrets.KEY_PASS }}
54
+
55
+ - name: Generate localization
56
+ run: |
57
+ cd /opt/android/cake_wallet
58
+ flutter packages pub run tool/generate_localization.dart
59
+
60
+ - name: Build generated code
61
+ run: |
62
+ cd /opt/android/cake_wallet
63
+ cd cw_core && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
64
+ cd cw_monero && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
65
+ cd cw_bitcoin && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
66
+ cd cw_haven && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..
67
+ flutter packages pub run build_runner build --delete-conflicting-outputs
68
+
69
+ - name: Add secrets
70
+ run: |
71
+ cd /opt/android/cake_wallet
72
+ touch lib/.secrets.g.dart
73
+ echo "const salt = '${{ secrets.SALT }}';" > lib/.secrets.g.dart
74
+ echo "const keychainSalt = '${{ secrets.KEY_CHAIN_SALT }}';" >> lib/.secrets.g.dart
75
+ echo "const key = '${{ secrets.KEY }}';" >> lib/.secrets.g.dart
76
+ echo "const walletSalt = '${{ secrets.WALLET_SALT }}';" >> lib/.secrets.g.dart
77
+ echo "const shortKey = '${{ secrets.SHORT_KEY }}';" >> lib/.secrets.g.dart
78
+ echo "const backupSalt = '${{ secrets.BACKUP_SALT }}';" >> lib/.secrets.g.dart
79
+ echo "const backupKeychainSalt = '${{ secrets.BACKUP_KEY_CHAIN_SALT }}';" >> lib/.secrets.g.dart
80
+ echo "const changeNowApiKey = '${{ secrets.CHANGE_NOW_API_KEY }}';" >> lib/.secrets.g.dart
81
+ echo "const wyreSecretKey = '${{ secrets.WYRE_SECRET_KEY }}';" >> lib/.secrets.g.dart
82
+ echo "const wyreApiKey = '${{ secrets.WYRE_API_KEY }}';" >> lib/.secrets.g.dart
83
+ echo "const wyreAccountId = '${{ secrets.WYRE_ACCOUNT_ID }}';" >> lib/.secrets.g.dart
84
+ echo "const moonPayApiKey = '${{ secrets.MOON_PAY_API_KEY }}';" >> lib/.secrets.g.dart
85
+ echo "const moonPaySecretKey = '${{ secrets.MOON_PAY_SECRET_KEY }}';" >> lib/.secrets.g.dart
86
+ echo "const sideShiftAffiliateId = '${{ secrets.SIDE_SHIFT_AFFILIATE_ID }}';" >> lib/.secrets.g.dart
87
+ echo "const sideShiftApiKey = '${{ secrets.SIDE_SHIFT_API_KEY }}';" >> lib/.secrets.g.dart
88
+ echo "const simpleSwapApiKey = '${{ secrets.SIMPLE_SWAP_API_KEY }}';" >> lib/.secrets.g.dart
89
+ echo "const onramperApiKey = '${{ secrets.ONRAMPER_API_KEY }}';" >> lib/.secrets.g.dart
90
+ echo "const anypayToken = '${{ secrets.ANY_PAY_TOKEN }}';" >> lib/.secrets.g.dart
91
+ echo "const ioniaClientId = '${{ secrets.IONIA_CLIENT_ID }}';" >> lib/.secrets.g.dart
92
+
93
+ - name: Build
94
+ run: |
95
+ cd /opt/android/cake_wallet
96
+ flutter build apk --release
97
+
98
+# - name: Push to App Center
99
+# run: |
100
+# echo 'Installing App Center CLI tools'
101
+# npm install -g appcenter-cli
102
+# echo "Publishing test to App Center"
103
+# appcenter distribute release \
104
+# --group "Testers" \
105
+# --file "/opt/android/cake_wallet/build/app/outputs/apk/release/app-release.apk" \
106
+# --release-notes ${GITHUB_HEAD_REF} \
107
+# --app Cake-Labs/Cake-Wallet \
108
+# --token ${{ secrets.APP_CENTER_TOKEN }} \
109
+# --quiet
110
+
111
+ - name: Send Test APK
112
+ run: |
113
+ cd /opt/android/cake_wallet
114
+ var=$(curl --upload-file build/app/outputs/apk/release/app-release.apk https://transfer.sh/app-release.apk)
115
+ curl ${{ secrets.SLACK_WEB_HOOK }} -H "Content-Type: application/json" -d '{"apk_link": "'"$var"'","ticket": "'"$GITHUB_HEAD_REF"'"}'
116
+
howto-build-android.md
+6
-2
@@ -55,7 +55,7 @@ You may download and install the latest version of Android Studio [here](https:/
55
56
### 3. Installing Flutter
57
58
-Need to install flutter with version `2.0.4`. For this please check section [Install Flutter manually](https://docs.flutter.dev/get-started/install/linux#install-flutter-manually). When flutter repository is downloaded please open it with `cd <flutter-path>` and checkout version 2.0.4 by `git checkout 2.0.4`.
58
+Need to install flutter with version `3.x.x`. For this please check section [Install Flutter manually](https://docs.flutter.dev/get-started/install/linux#install-flutter-manually).
59
60
### 4. Verify Installations
61
@@ -66,7 +66,7 @@ Verify that the Android toolchain, Flutter, and Android Studio have been correct
66
The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding.
67
```
68
Doctor summary (to see all details, run flutter doctor -v):
69
-[✓] Flutter (Channel stable, 2.0.4, on Linux, locale en_US.UTF-8)
69
+[✓] Flutter (Channel stable, 3.x.x, on Linux, locale en_US.UTF-8)
70
[✓] Android toolchain - develop for Android devices (Android SDK version 28)
71
[✓] Android Studio (version 4.0)
72
```
@@ -156,6 +156,10 @@ Generate mobx models for `cw_bitcoin`:
156
157
`cd cw_bitcoin && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..`
158
159
+Generate mobx models for `cw_haven`:
160
+
161
+`cd cw_haven && flutter pub get && flutter packages pub run build_runner build --delete-conflicting-outputs && cd ..`
162
+
163
Finally build mobx models for the app:
164
165
`$ flutter packages pub run build_runner build --delete-conflicting-outputs`
pubspec_base.yaml
+1
-1
@@ -34,7 +34,7 @@ dependencies:
34
local_auth: ^2.1.0
35
package_info: ^2.0.0
36
#package_info_plus: ^1.4.2
37
- devicelocale: ^0.5.4
37
+ devicelocale: ^0.4.3
38
auto_size_text: ^3.0.0
39
dotted_border: ^2.0.0+2
40
smooth_page_indicator: ^1.0.0+2
tool/utils/secret_key.dart
+1
@@ -28,6 +28,7 @@ class SecretKey {
28
SecretKey('simpleSwapApiKey', () => ''),
29
SecretKey('anypayToken', () => ''),
30
SecretKey('onramperApiKey', () => ''),
31
+ SecretKey('ioniaClientId', () => ''),
32
];
33
34
final String name;