1
+#name: Automated Integration Tests
2
+#
3
+#on:
4
+# pull_request:
5
+# branches: [main, CW-659-Transaction-History-Automated-Tests]
6
+# workflow_dispatch:
7
+# inputs:
8
+# branch:
9
+# description: "Branch name to build"
10
+# required: true
11
+# default: "main"
12
+#
13
+#jobs:
14
+# Automated_integration_test:
15
+# runs-on: ubuntu-20.04
16
+# strategy:
17
+# fail-fast: false
18
+# matrix:
19
+# api-level: [29]
20
+# # arch: [x86, x86_64]
21
+# env:
22
+# STORE_PASS: test@cake_wallet
23
+# KEY_PASS: test@cake_wallet
24
+# PR_NUMBER: ${{ github.event.number }}
25
+#
26
+# steps:
27
+# - name: is pr
28
+# if: github.event_name == 'pull_request'
29
+# run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
30
+#
31
+# - name: is not pr
32
+# if: github.event_name != 'pull_request'
33
+# run: echo "BRANCH_NAME=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
34
+#
35
+# - name: Free Disk Space (Ubuntu)
36
+# uses: insightsengineering/disk-space-reclaimer@v1
37
+# with:
38
+# tools-cache: true
39
+# android: false
40
+# dotnet: true
41
+# haskell: true
42
+# large-packages: true
43
+# swap-storage: true
44
+# docker-images: true
45
+#
46
+# - uses: actions/checkout@v2
47
+# - uses: actions/setup-java@v2
48
+# with:
49
+# distribution: "temurin"
50
+# java-version: "17"
51
+# - name: Configure placeholder git details
52
+# run: |
53
+# git config --global user.email "CI@cakewallet.com"
54
+# git config --global user.name "Cake Github Actions"
55
+# - name: Flutter action
56
+# uses: subosito/flutter-action@v1
57
+# with:
58
+# flutter-version: "3.24.0"
59
+# channel: stable
60
+#
61
+# - name: Install package dependencies
62
+# run: |
63
+# sudo apt update
64
+# sudo apt-get install -y curl unzip automake build-essential file pkg-config git python libtool libtinfo5 cmake clang
65
+#
66
+# - name: Execute Build and Setup Commands
67
+# run: |
68
+# sudo mkdir -p /opt/android
69
+# sudo chown $USER /opt/android
70
+# cd /opt/android
71
+# -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
72
+# cargo install cargo-ndk
73
+# git clone https://github.com/cake-tech/cake_wallet.git --branch ${{ env.BRANCH_NAME }}
74
+# cd cake_wallet/scripts/android/
75
+# ./install_ndk.sh
76
+# source ./app_env.sh cakewallet
77
+# chmod +x pubspec_gen.sh
78
+# ./app_config.sh
79
+#
80
+# - name: Cache Externals
81
+# id: cache-externals
82
+# uses: actions/cache@v3
83
+# with:
84
+# path: |
85
+# /opt/android/cake_wallet/cw_haven/android/.cxx
86
+# /opt/android/cake_wallet/scripts/monero_c/release
87
+# key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}
88
+#
89
+# - if: ${{ steps.cache-externals.outputs.cache-hit != 'true' }}
90
+# name: Generate Externals
91
+# run: |
92
+# cd /opt/android/cake_wallet/scripts/android/
93
+# source ./app_env.sh cakewallet
94
+# ./build_monero_all.sh
95
+#
96
+# - name: Install Flutter dependencies
97
+# run: |
98
+# cd /opt/android/cake_wallet
99
+# flutter pub get
100
+#
101
+#
102
+# - name: Install go and gomobile
103
+# run: |
104
+# # install go > 1.23:
105
+# wget https://go.dev/dl/go1.23.1.linux-amd64.tar.gz
106
+# sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.1.linux-amd64.tar.gz
107
+# export PATH=$PATH:/usr/local/go/bin
108
+# export PATH=$PATH:~/go/bin
109
+# go install golang.org/x/mobile/cmd/gomobile@latest
110
+# gomobile init
111
+#
112
+# - name: Build mwebd
113
+# run: |
114
+# # paths are reset after each step, so we need to set them again:
115
+# export PATH=$PATH:/usr/local/go/bin
116
+# export PATH=$PATH:~/go/bin
117
+# cd /opt/android/cake_wallet/scripts/android/
118
+# ./build_mwebd.sh --dont-install
119
+#
120
+# - name: Generate KeyStore
121
+# run: |
122
+# cd /opt/android/cake_wallet/android/app
123
+# 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 $STORE_PASS -keypass $KEY_PASS
124
+#
125
+# - name: Generate key properties
126
+# run: |
127
+# cd /opt/android/cake_wallet
128
+# flutter packages pub run tool/generate_android_key_properties.dart keyAlias=testKey storeFile=key.jks storePassword=$STORE_PASS keyPassword=$KEY_PASS
129
+#
130
+# - name: Generate localization
131
+# run: |
132
+# cd /opt/android/cake_wallet
133
+# flutter packages pub run tool/generate_localization.dart
134
+#
135
+# - name: Build generated code
136
+# run: |
137
+# cd /opt/android/cake_wallet
138
+# ./model_generator.sh
139
+#
140
+# - name: Add secrets
141
+# run: |
142
+# cd /opt/android/cake_wallet
143
+# touch lib/.secrets.g.dart
144
+# touch cw_evm/lib/.secrets.g.dart
145
+# touch cw_solana/lib/.secrets.g.dart
146
+# touch cw_core/lib/.secrets.g.dart
147
+# touch cw_nano/lib/.secrets.g.dart
148
+# touch cw_tron/lib/.secrets.g.dart
149
+# echo "const salt = '${{ secrets.SALT }}';" > lib/.secrets.g.dart
150
+# echo "const keychainSalt = '${{ secrets.KEY_CHAIN_SALT }}';" >> lib/.secrets.g.dart
151
+# echo "const key = '${{ secrets.KEY }}';" >> lib/.secrets.g.dart
152
+# echo "const walletSalt = '${{ secrets.WALLET_SALT }}';" >> lib/.secrets.g.dart
153
+# echo "const shortKey = '${{ secrets.SHORT_KEY }}';" >> lib/.secrets.g.dart
154
+# echo "const backupSalt = '${{ secrets.BACKUP_SALT }}';" >> lib/.secrets.g.dart
155
+# echo "const backupKeychainSalt = '${{ secrets.BACKUP_KEY_CHAIN_SALT }}';" >> lib/.secrets.g.dart
156
+# echo "const changeNowApiKey = '${{ secrets.CHANGE_NOW_API_KEY }}';" >> lib/.secrets.g.dart
157
+# echo "const changeNowApiKeyDesktop = '${{ secrets.CHANGE_NOW_API_KEY_DESKTOP }}';" >> lib/.secrets.g.dart
158
+# echo "const wyreSecretKey = '${{ secrets.WYRE_SECRET_KEY }}';" >> lib/.secrets.g.dart
159
+# echo "const wyreApiKey = '${{ secrets.WYRE_API_KEY }}';" >> lib/.secrets.g.dart
160
+# echo "const wyreAccountId = '${{ secrets.WYRE_ACCOUNT_ID }}';" >> lib/.secrets.g.dart
161
+# echo "const moonPayApiKey = '${{ secrets.MOON_PAY_API_KEY }}';" >> lib/.secrets.g.dart
162
+# echo "const moonPaySecretKey = '${{ secrets.MOON_PAY_SECRET_KEY }}';" >> lib/.secrets.g.dart
163
+# echo "const sideShiftAffiliateId = '${{ secrets.SIDE_SHIFT_AFFILIATE_ID }}';" >> lib/.secrets.g.dart
164
+# echo "const simpleSwapApiKey = '${{ secrets.SIMPLE_SWAP_API_KEY }}';" >> lib/.secrets.g.dart
165
+# echo "const simpleSwapApiKeyDesktop = '${{ secrets.SIMPLE_SWAP_API_KEY_DESKTOP }}';" >> lib/.secrets.g.dart
166
+# echo "const onramperApiKey = '${{ secrets.ONRAMPER_API_KEY }}';" >> lib/.secrets.g.dart
167
+# echo "const anypayToken = '${{ secrets.ANY_PAY_TOKEN }}';" >> lib/.secrets.g.dart
168
+# echo "const ioniaClientId = '${{ secrets.IONIA_CLIENT_ID }}';" >> lib/.secrets.g.dart
169
+# echo "const twitterBearerToken = '${{ secrets.TWITTER_BEARER_TOKEN }}';" >> lib/.secrets.g.dart
170
+# echo "const trocadorApiKey = '${{ secrets.TROCADOR_API_KEY }}';" >> lib/.secrets.g.dart
171
+# echo "const trocadorExchangeMarkup = '${{ secrets.TROCADOR_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
172
+# echo "const anonPayReferralCode = '${{ secrets.ANON_PAY_REFERRAL_CODE }}';" >> lib/.secrets.g.dart
173
+# echo "const fiatApiKey = '${{ secrets.FIAT_API_KEY }}';" >> lib/.secrets.g.dart
174
+# echo "const payfuraApiKey = '${{ secrets.PAYFURA_API_KEY }}';" >> lib/.secrets.g.dart
175
+# echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> lib/.secrets.g.dart
176
+# echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
177
+# echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> lib/.secrets.g.dart
178
+# echo "const etherScanApiKey = '${{ secrets.ETHER_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
179
+# echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
180
+# echo "const chatwootWebsiteToken = '${{ secrets.CHATWOOT_WEBSITE_TOKEN }}';" >> lib/.secrets.g.dart
181
+# echo "const exolixApiKey = '${{ secrets.EXOLIX_API_KEY }}';" >> lib/.secrets.g.dart
182
+# echo "const robinhoodApplicationId = '${{ secrets.ROBINHOOD_APPLICATION_ID }}';" >> lib/.secrets.g.dart
183
+# echo "const exchangeHelperApiKey = '${{ secrets.ROBINHOOD_CID_CLIENT_SECRET }}';" >> lib/.secrets.g.dart
184
+# echo "const walletConnectProjectId = '${{ secrets.WALLET_CONNECT_PROJECT_ID }}';" >> lib/.secrets.g.dart
185
+# echo "const moralisApiKey = '${{ secrets.MORALIS_API_KEY }}';" >> lib/.secrets.g.dart
186
+# echo "const polygonScanApiKey = '${{ secrets.POLYGON_SCAN_API_KEY }}';" >> cw_evm/lib/.secrets.g.dart
187
+# echo "const ankrApiKey = '${{ secrets.ANKR_API_KEY }}';" >> cw_solana/lib/.secrets.g.dart
188
+# echo "const testCakePayApiKey = '${{ secrets.TEST_CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
189
+# echo "const cakePayApiKey = '${{ secrets.CAKE_PAY_API_KEY }}';" >> lib/.secrets.g.dart
190
+# echo "const authorization = '${{ secrets.CAKE_PAY_AUTHORIZATION }}';" >> lib/.secrets.g.dart
191
+# echo "const CSRFToken = '${{ secrets.CSRF_TOKEN }}';" >> lib/.secrets.g.dart
192
+# echo "const quantexExchangeMarkup = '${{ secrets.QUANTEX_EXCHANGE_MARKUP }}';" >> lib/.secrets.g.dart
193
+# echo "const nano2ApiKey = '${{ secrets.NANO2_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
194
+# echo "const nanoNowNodesApiKey = '${{ secrets.NANO_NOW_NODES_API_KEY }}';" >> cw_nano/lib/.secrets.g.dart
195
+# echo "const tronGridApiKey = '${{ secrets.TRON_GRID_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
196
+# echo "const tronNowNodesApiKey = '${{ secrets.TRON_NOW_NODES_API_KEY }}';" >> cw_tron/lib/.secrets.g.dart
197
+# echo "const meldTestApiKey = '${{ secrets.MELD_TEST_API_KEY }}';" >> lib/.secrets.g.dart
198
+# echo "const meldTestPublicKey = '${{ secrets.MELD_TEST_PUBLIC_KEY}}';" >> lib/.secrets.g.dart
199
+# echo "const letsExchangeBearerToken = '${{ secrets.LETS_EXCHANGE_TOKEN }}';" >> lib/.secrets.g.dart
200
+# echo "const letsExchangeAffiliateId = '${{ secrets.LETS_EXCHANGE_AFFILIATE_ID }}';" >> lib/.secrets.g.dart
201
+# echo "const stealthExBearerToken = '${{ secrets.STEALTH_EX_BEARER_TOKEN }}';" >> lib/.secrets.g.dart
202
+# echo "const stealthExAdditionalFeePercent = '${{ secrets.STEALTH_EX_ADDITIONAL_FEE_PERCENT }}';" >> lib/.secrets.g.dart
203
+# echo "const moneroTestWalletSeeds ='${{ secrets.MONERO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
204
+# echo "const moneroLegacyTestWalletSeeds = '${{ secrets.MONERO_LEGACY_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
205
+# echo "const bitcoinTestWalletSeeds = '${{ secrets.BITCOIN_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
206
+# echo "const ethereumTestWalletSeeds = '${{ secrets.ETHEREUM_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
207
+# echo "const litecoinTestWalletSeeds = '${{ secrets.LITECOIN_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
208
+# echo "const bitcoinCashTestWalletSeeds = '${{ secrets.BITCOIN_CASH_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
209
+# echo "const polygonTestWalletSeeds = '${{ secrets.POLYGON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
210
+# echo "const solanaTestWalletSeeds = '${{ secrets.SOLANA_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
211
+# echo "const tronTestWalletSeeds = '${{ secrets.TRON_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
212
+# echo "const nanoTestWalletSeeds = '${{ secrets.NANO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
213
+# echo "const wowneroTestWalletSeeds = '${{ secrets.WOWNERO_TEST_WALLET_SEEDS }}';" >> lib/.secrets.g.dart
214
+# echo "const moneroTestWalletReceiveAddress = '${{ secrets.MONERO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
215
+# echo "const bitcoinTestWalletReceiveAddress = '${{ secrets.BITCOIN_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
216
+# echo "const ethereumTestWalletReceiveAddress = '${{ secrets.ETHEREUM_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
217
+# echo "const litecoinTestWalletReceiveAddress = '${{ secrets.LITECOIN_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
218
+# echo "const bitcoinCashTestWalletReceiveAddress = '${{ secrets.BITCOIN_CASH_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
219
+# echo "const polygonTestWalletReceiveAddress = '${{ secrets.POLYGON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
220
+# echo "const solanaTestWalletReceiveAddress = '${{ secrets.SOLANA_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
221
+# echo "const tronTestWalletReceiveAddress = '${{ secrets.TRON_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
222
+# echo "const nanoTestWalletReceiveAddress = '${{ secrets.NANO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
223
+# echo "const wowneroTestWalletReceiveAddress = '${{ secrets.WOWNERO_TEST_WALLET_RECEIVE_ADDRESS }}';" >> lib/.secrets.g.dart
224
+# echo "const moneroTestWalletBlockHeight = '${{ secrets.MONERO_TEST_WALLET_BLOCK_HEIGHT }}';" >> lib/.secrets.g.dart
225
+#
226
+# - name: Rename app
227
+# run: |
228
+# echo -e "id=com.cakewallet.test_${{ env.PR_NUMBER }}\nname=${{ env.BRANCH_NAME }}" > /opt/android/cake_wallet/android/app.properties
229
+#
230
+# - name: Build
231
+# run: |
232
+# cd /opt/android/cake_wallet
233
+# flutter build apk --release --split-per-abi
234
+#
235
+# # - name: Rename apk file
236
+# # run: |
237
+# # cd /opt/android/cake_wallet/build/app/outputs/flutter-apk
238
+# # mkdir test-apk
239
+# # cp app-arm64-v8a-release.apk test-apk/${{env.BRANCH_NAME}}.apk
240
+# # cp app-x86_64-release.apk test-apk/${{env.BRANCH_NAME}}_x86.apk
241
+#
242
+# # - name: Upload Artifact
243
+# # uses: kittaakos/upload-artifact-as-is@v0
244
+# # with:
245
+# # path: /opt/android/cake_wallet/build/app/outputs/flutter-apk/test-apk/
246
+#
247
+# # - name: Send Test APK
248
+# # continue-on-error: true
249
+# # uses: adrey/slack-file-upload-action@1.0.5
250
+# # with:
251
+# # token: ${{ secrets.SLACK_APP_TOKEN }}
252
+# # path: /opt/android/cake_wallet/build/app/outputs/flutter-apk/test-apk/${{env.BRANCH_NAME}}.apk
253
+# # channel: ${{ secrets.SLACK_APK_CHANNEL }}
254
+# # title: "${{ env.BRANCH_NAME }}.apk"
255
+# # filename: ${{ env.BRANCH_NAME }}.apk
256
+# # initial_comment: ${{ github.event.head_commit.message }}
257
+#
258
+# - name: 🦾 Enable KVM
259
+# run: |
260
+# echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
261
+# sudo udevadm control --reload-rules
262
+# sudo udevadm trigger --name-match=kvm
263
+#
264
+# - name: 🦾 Cache gradle
265
+# uses: gradle/actions/setup-gradle@v3
266
+#
267
+# - name: 🦾 Cache AVD
268
+# uses: actions/cache@v4
269
+# id: avd-cache
270
+# with:
271
+# path: |
272
+# ~/.android/avd/*
273
+# ~/.android/adb*
274
+# key: avd-${{ matrix.api-level }}
275
+#
276
+# - name: 🦾 Create AVD and generate snapshot for caching
277
+# if: steps.avd-cache.outputs.cache-hit != 'true'
278
+# uses: reactivecircus/android-emulator-runner@v2
279
+# with:
280
+# api-level: ${{ matrix.api-level }}
281
+# force-avd-creation: false
282
+# # arch: ${{ matrix.arch }}
283
+# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
284
+# working-directory: /opt/android/cake_wallet
285
+# disable-animations: false
286
+# script: echo "Generated AVD snapshot for caching."
287
+#
288
+# - name: 🚀 Integration tests on Android Emulator
289
+# uses: reactivecircus/android-emulator-runner@v2
290
+# with:
291
+# api-level: ${{ matrix.api-level }}
292
+# force-avd-creation: false
293
+# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
294
+# disable-animations: true
295
+# working-directory: /opt/android/cake_wallet
296
+# script: |
297
+# chmod a+rx integration_test_runner.sh
298
+# ./integration_test_runner.sh
\ No newline at end of file