Skip to content

Commit

Permalink
Fix. Build instrumental tests (#1595)
Browse files Browse the repository at this point in the history
* fix: OOM while build

* fix: temp fix for build test

* feat: change build flow

* ci: add trigger for PR

* chore: update references
  • Loading branch information
stepanLav authored Jul 19, 2024
1 parent c5b8566 commit 4000aec
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/run_balances_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ adb devices
adb -s emulator-5554 install app/debug/app-debug.apk

# Install instrumental tests
adb -s emulator-5554 install test-app/androidTest/debug/app-debug-androidTest.apk
adb -s emulator-5554 install app/androidTest/debug/app-debug-androidTest.apk

# Run tests
adb logcat -c &&
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
required: false
type: string
default: "apk"
build-debug-tests:
required: false
type: boolean
default: false
secrets:
ACALA_PROD_AUTH_TOKEN:
required: true
Expand Down Expand Up @@ -174,6 +178,10 @@ jobs:
if: ${{ !startsWith(inputs.gradlew-command, 'false') }}
run: ./gradlew ${{ inputs.gradlew-command }}

- name: 🏗 Build debug tests
if: ${{ inputs.build-debug-tests }}
run: ./gradlew assembleDebugAndroidTest

- name: 🧹 Delete key after building
if: ${{ !startsWith(inputs.keystore-file-name, 'false') }}
run: rm ./app/${{ inputs.keystore-file-name }}
Expand Down
24 changes: 3 additions & 21 deletions .github/workflows/balances_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,18 @@ on:
- cron: '0 */8 * * *'

jobs:
develop-build:
build-app:
uses: novasamatech/nova-wallet-android/.github/workflows/android_build.yml@develop
with:
branch: ${{github.head_ref}}
gradlew-command: assembleDebug
upload-name: develop-apk
run-tests: false
secrets: inherit

test-build:
uses: novasamatech/nova-wallet-android/.github/workflows/android_build.yml@develop
with:
branch: ${{github.head_ref}}
gradlew-command: assembleDebugAndroidTest
upload-name: test-apk
run-tests: false
build-debug-tests: true
secrets: inherit

run-tests:
needs: [develop-build, test-build]
needs: [build-app]
runs-on: macos-13
steps:
- uses: actions/checkout@v4
Expand All @@ -40,16 +32,6 @@ jobs:
run: |
ls -laR app
- name: Download instrumential test artifact
uses: actions/download-artifact@v4
with:
name: test-apk
path: test-app

- name: Debug path
run: |
ls -laR test-app
- name: Add permissions
run: chmod +x .github/scripts/run_balances_test.sh

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ jobs:
with:
branch: ${{github.head_ref}}
gradlew-command: assembleDevelop
build-debug-tests: true
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class ChainDaoTest : DaoTest<ChainDao>(AppDatabase::chainDao) {
assetsDiff = emptyDiff(),
nodesDiff = emptyDiff(),
explorersDiff = emptyDiff(),
externalApisDiff = emptyDiff()
externalApisDiff = emptyDiff(),
nodeSelectionPreferencesDiff = emptyDiff()
)

val chainsFromDb = dao.getJoinChainInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import io.novafoundation.nova.core_db.model.CurrencyLocal
import io.novafoundation.nova.core_db.model.chain.AssetSourceLocal
import io.novafoundation.nova.core_db.model.chain.account.ChainAccountLocal
import io.novafoundation.nova.core_db.model.chain.ChainAssetLocal
import io.novafoundation.nova.core_db.model.chain.ChainExplorerLocal
import io.novafoundation.nova.core_db.model.chain.ChainExternalApiLocal
import io.novafoundation.nova.core_db.model.chain.ChainLocal
import io.novafoundation.nova.core_db.model.chain.ChainNodeLocal
import io.novafoundation.nova.core_db.model.chain.JoinedChainInfo
import io.novafoundation.nova.core_db.model.chain.NodeSelectionPreferencesLocal
import io.novafoundation.nova.core_db.model.chain.account.MetaAccountLocal

fun createTestChain(
Expand All @@ -28,8 +31,17 @@ fun createTestChain(
assetOf(assetId = it, symbol = it.toString())
}
}

return JoinedChainInfo(chain, nodes, assets, explorers = emptyList(), externalApis = emptyList())
val explorers = emptyList<ChainExplorerLocal>()
val externalApis = emptyList<ChainExternalApiLocal>()

return JoinedChainInfo(
chain,
NodeSelectionPreferencesLocal(chain.id, autoBalanceEnabled = true, selectedNodeUrl = null),
nodes,
assets,
explorers,
externalApis
)
}

fun chainOf(
Expand All @@ -52,7 +64,8 @@ fun chainOf(
supportProxy = false,
swap = "",
hasSubstrateRuntime = true,
nodeSelectionStrategy = ChainLocal.NodeSelectionStrategyLocal.ROUND_ROBIN
nodeSelectionStrategy = ChainLocal.NodeSelectionStrategyLocal.ROUND_ROBIN,
source = ChainLocal.Source.CUSTOM,
)

fun ChainLocal.nodeOf(
Expand All @@ -61,7 +74,8 @@ fun ChainLocal.nodeOf(
name = "Test",
url = link,
chainId = id,
orderId = 0
orderId = 0,
source = ChainNodeLocal.Source.CUSTOM,
)

fun ChainLocal.assetOf(
Expand Down Expand Up @@ -90,7 +104,7 @@ suspend fun ChainDao.addChains(chains: List<JoinedChainInfo>) {
nodesDiff = addedDiff(chains.flatMap(JoinedChainInfo::nodes)),
explorersDiff = addedDiff(chains.flatMap(JoinedChainInfo::explorers)),
externalApisDiff = addedDiff(chains.flatMap(JoinedChainInfo::externalApis)),
nodeSelectionPreferencesDiff = nodeSelectionPreferencesDiff
nodeSelectionPreferencesDiff = emptyDiff()
)
}

Expand All @@ -103,7 +117,7 @@ suspend fun ChainDao.removeChain(joinedChainInfo: JoinedChainInfo) {
nodesDiff = removedDiff(joinedChainInfo.nodes),
explorersDiff = removedDiff(joinedChainInfo.explorers),
externalApisDiff = removedDiff(joinedChainInfo.externalApis),
nodeSelectionPreferencesDiff = nodeSelectionPreferencesDiff
nodeSelectionPreferencesDiff = emptyDiff()
)
}

Expand All @@ -114,7 +128,7 @@ suspend fun ChainDao.updateChain(joinedChainInfo: JoinedChainInfo) {
nodesDiff = updatedDiff(joinedChainInfo.nodes),
explorersDiff = updatedDiff(joinedChainInfo.explorers),
externalApisDiff = updatedDiff(joinedChainInfo.externalApis),
nodeSelectionPreferencesDiff = nodeSelectionPreferencesDiff
nodeSelectionPreferencesDiff = emptyDiff()
)
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# org.gradle.parallel=true
#Fri Feb 16 12:00:34 MSK 2024
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx3096M -Dkotlin.daemon.jvm.options\="-Xmx3096M"
org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M"
android.useAndroidX=true
android.enableJetifier=true

0 comments on commit 4000aec

Please sign in to comment.