-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* run tests on marathon fix order add unique build remove unit tests fix run tests fix build tests remove example test which lead to error temp fix for build remove example instrumental tests adding debug lines fix debug fix path fix build type fix path build debug version fix path run on github action fix balances tests store results in separate repo fix artifacts path fix artifact version fix download path fix path fix path update secrets fix access remove unnecessary checkout update secrets update storing folder update deployment dir * update deployment to gh-pages * adding notification * set event triggers fix TestSigner
- Loading branch information
Showing
14 changed files
with
336 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
name: Run balances tests | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 */8 * * *' | ||
|
||
jobs: | ||
develop-build: | ||
uses: novasamatech/nova-wallet-android/.github/workflows/android_build.yml@feat/move_tests_to_main_repo | ||
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@feat/move_tests_to_main_repo | ||
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. | ||
Results: https://novasamatech.github.io/balances_test_result/${{ github.run_id}}/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.