Skip to content

Commit

Permalink
Merge pull request #1592 from novasamatech/rc/8.2.0
Browse files Browse the repository at this point in the history
Rc/8.2.0
  • Loading branch information
antonijzelinskij authored Jul 18, 2024
2 parents c67c217 + 1480476 commit c519ace
Show file tree
Hide file tree
Showing 341 changed files with 9,333 additions and 738 deletions.
52 changes: 52 additions & 0 deletions .github/scripts/run_balances_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
adb devices

# Install debug app
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

# Run tests
adb logcat -c &&
python - <<END
import os
import re
import subprocess as sp
import sys
import threading
import time
done = False
def update():
# prevent CI from killing the process for inactivity
while not done:
time.sleep(5)
print ("Running...")
t = threading.Thread(target=update)
t.dameon = True
t.start()
def run():
os.system('adb wait-for-device')
p = sp.Popen('adb shell am instrument -w -m -e debug false -e class "io.novafoundation.nova.balances.BalancesIntegrationTest" io.novafoundation.nova.debug.test/io.qameta.allure.android.runners.AllureAndroidJUnitRunner',
shell=True, stdout=sp.PIPE, stderr=sp.PIPE, stdin=sp.PIPE)
return p.communicate()
success = re.compile(r'OK \(\d+ tests\)')
stdout, stderr = run()
stdout = stdout.decode('ISO-8859-1')
stderr = stderr.decode('ISO-8859-1')
done = True
print (stderr)
print (stdout)
if success.search(stderr + stdout):
sys.exit(0)
else:
sys.exit(1) # make sure we fail if the tests fail
END
EXIT_CODE=$?
adb logcat -d '*:E'

# Export results
adb exec-out run-as io.novafoundation.nova.debug sh -c 'cd /data/data/io.novafoundation.nova.debug/files && tar cf - allure-results' > allure-results.tar

exit $EXIT_CODE
52 changes: 52 additions & 0 deletions .github/scripts/run_instrumental_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
adb devices

# Install debug app
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

# Run tests
adb logcat -c &&
python - <<END
import os
import re
import subprocess as sp
import sys
import threading
import time
done = False
def update():
# prevent CI from killing the process for inactivity
while not done:
time.sleep(5)
print ("Running...")
t = threading.Thread(target=update)
t.dameon = True
t.start()
def run():
os.system('adb wait-for-device')
p = sp.Popen('adb shell am instrument -w -m -e notClass io.novafoundation.nova.balances.BalancesIntegrationTest -e package io.novafoundation.nova.debug io.novafoundation.nova.debug.test/io.qameta.allure.android.runners.AllureAndroidJUnitRunner',
shell=True, stdout=sp.PIPE, stderr=sp.PIPE, stdin=sp.PIPE)
return p.communicate()
success = re.compile(r'OK \(\d+ tests\)')
stdout, stderr = run()
stdout = stdout.decode('ISO-8859-1')
stderr = stderr.decode('ISO-8859-1')
done = True
print (stderr)
print (stdout)
if success.search(stderr + stdout):
sys.exit(0)
else:
sys.exit(1) # make sure we fail if the tests fail
END
EXIT_CODE=$?
adb logcat -d '*:E'

# Export results
adb exec-out run-as io.novafoundation.nova.debug sh -c 'cd /data/data/io.novafoundation.nova.debug/files && tar cf - allure-results' > allure-results.tar

exit $EXIT_CODE
12 changes: 8 additions & 4 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
required: false
type: string
default: "false"
upload-name:
required: false
type: string
default: "apk"
secrets:
ACALA_PROD_AUTH_TOKEN:
required: true
Expand Down Expand Up @@ -115,7 +119,7 @@ env:
CI_PRODUCTION_GOOGLE_SERVICES_FILE: ${{ secrets.CI_PRODUCTION_GOOGLE_SERVICES }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-${{inputs.upload-name}}
cancel-in-progress: true

jobs:
Expand Down Expand Up @@ -147,7 +151,7 @@ jobs:
uses: ./.github/workflows/install/

- name: 🧪 Run tests
if: ${{ inputs.run-tests }} == "true"
if: ${{ inputs.run-tests }}
run: ./gradlew runTest

- name: 🔐 Getting github sign key
Expand Down Expand Up @@ -176,7 +180,7 @@ jobs:

- name: ➡️ Upload build artifacts
if: ${{ !startsWith(inputs.gradlew-command, 'false') }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: apk
name: ${{ inputs.upload-name }}
path: app/build/outputs/apk/
111 changes: 111 additions & 0 deletions .github/workflows/balances_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Run balances tests

on:
workflow_dispatch:
schedule:
- cron: '0 */8 * * *'

jobs:
develop-build:
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
secrets: inherit

run-tests:
needs: [develop-build, test-build]
runs-on: macos-13
steps:
- uses: actions/checkout@v4

- name: Download built artifact
uses: actions/download-artifact@v4
with:
name: develop-apk
path: app

- name: Debug path
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

- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
disable-animations: true
profile: Nexus 6
api-level: 29
script: .github/scripts/run_balances_test.sh

- uses: actions/upload-artifact@v4
if: always()
with:
name: anroid-results
path: ./allure-results.tar

report:
needs: [run-tests]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Unzip results
run: |
find artifacts -name allure-results.tar -exec tar -xvf {} \;
- name: Debug path
run: |
ls -laR
- name: Generate report
uses: ./.github/workflows/report/
with:
token: ${{ secrets.ACTIONS_DEPLOY_KEY }}
keep-reports-history: 30

telegram-notification:
needs: [report]
runs-on: ubuntu-latest
if: failure()
steps:
- name: Notify Telegram channel
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
message: |
💸 Balances tests failed.
Test Results: https://novasamatech.github.io/balances_test_result/${{ github.run_number }}/index.html
Github run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
2 changes: 1 addition & 1 deletion .github/workflows/destribute_app_to_play_store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
envFilePath: .github/workflows/variables/android.env

- name: Download built artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: apk
path: app
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual_firebase_distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Download built artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: apk
path: app
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish_github_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- '*'

permissions:
contents: write

jobs:
build:
uses: novasamatech/nova-wallet-android/.github/workflows/android_build.yml@develop
Expand All @@ -22,7 +25,7 @@ jobs:
- uses: actions/checkout@v2

- name: Download built artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: apk
path: app
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Download built artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: apk
path: app
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/report/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish report to gh-pages
description: That workflow will publish report to the github-pages
inputs:
keep-reports-history:
description: "History storage depth, integer"
required: true
token:
description: "Github PAT"
required: true

runs:
using: "composite"
steps:
- name: Get Allure history
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
repository: novasamatech/balances_test_result
ref: gh-pages
path: gh-pages

- name: Allure Report action
uses: simple-elf/allure-report-action@master
if: always()
with:
allure_results: allure-results
allure_history: allure-history
keep_reports: ${{ inputs.keep-reports-history }}
github_repo: balances_test_result
github_repo_owner: novasamatech

- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ inputs.token }}
publish_branch: gh-pages
publish_dir: allure-history
external_repository: novasamatech/balances_test_result
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ app/*.apk
!/core-db/schemas/io.novafoundation.nova.core_db.AppDatabase/9.json

google-services.json
/bindings
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ dependencies {

implementation project(':bindings:metadata_shortener')

implementation project(':test-shared')

implementation kotlinDep

implementation biometricDep
Expand Down
Loading

0 comments on commit c519ace

Please sign in to comment.