Skip to content

Commit

Permalink
Merge pull request #8682 from LedgerHQ/support/qaa_375_sharding_android
Browse files Browse the repository at this point in the history
[QAA-375][Detox][Speculos] Shard android tests
  • Loading branch information
abdurrahman-ledger authored Dec 13, 2024
2 parents 9d8e34e + 4f6181b commit bdd29fb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/test-mobile-e2e-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ jobs:
AVD_OPTIONS: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
outputs:
status: ${{ steps.detox.outcome }}
strategy:
fail-fast: false
matrix:
shardIndex: [1, 2, 3]
shardTotal: [3, 1]
exclude:
- shardIndex: ${{ github.event.inputs.speculos_tests == 'false' && '2' }}
- shardIndex: ${{ github.event.inputs.speculos_tests == 'false' && '3' }}
- shardTotal: ${{ github.event.inputs.speculos_tests == 'false' && '3' }}
- shardTotal: ${{ github.event.inputs.speculos_tests != 'false' && '1' }}

steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -292,7 +303,7 @@ jobs:
bot_key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
- name: Run Android Tests
id: detox
run: pnpm mobile e2e:ci -p android -t $([[ "$INPUT_SPECULOS" == "true" ]] && printf %s '--speculos')
run: pnpm mobile e2e:ci -p android -t $([[ "$INPUT_SPECULOS" == "true" ]] && printf %s '--speculos') --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
timeout-minutes: ${{ env.SPECULOS_RUN && 120 || 45 }}
env:
DETOX_INSTALL_TIMEOUT: 120000
Expand All @@ -302,13 +313,13 @@ jobs:
uses: actions/upload-artifact@v4
if: ${{ !cancelled() || steps.detox.outcome == 'cancelled' }}
with:
name: "android-test-artifacts"
name: "android-test-artifacts-${{ matrix.shardIndex }}"
path: apps/ledger-live-mobile/artifacts/

allure-report-android:
name: "Allure Reports Export on Server"
runs-on: [ledger-live-medium]
if: ${{ always() && (inputs.slack_notif || github.event_name == 'push') }}
if: ${{ always() && (inputs.slack_notif || github.event_name == 'push' || github.event_name == 'schedule') }}
outputs:
report-url: ${{ steps.upload.outputs.report-url }}
result: ${{ steps.summary.outputs.test_result }}
Expand Down
9 changes: 7 additions & 2 deletions apps/ledger-live-mobile/scripts/e2e-ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { basename } from "path";
let platform, test, build, bundle;
let speculos = "";
let cache = true;
let shard = "";

const usage = (exitCode = 1) => {
console.log(
`Usage: ${basename(
__filename,
)} -p --platform <ios|android> [-h --help] [-t --test] [-b --build] [--bundle] [--cache | --no-cache] [--speculos]`,
)} -p --platform <ios|android> [-h --help] [-t --test] [-b --build] [--bundle] [--cache | --no-cache] [--speculos] [--shard]`,
);
process.exit(exitCode);
};
Expand Down Expand Up @@ -63,7 +64,8 @@ const test_android = async () => {
--headless \\
--retries 1 \\
--runInBand \\
--cleanup`;
--cleanup \\
--shard ${shard}`;
};

const getTasksFrom = {
Expand Down Expand Up @@ -112,6 +114,9 @@ for (const argName in argv) {
case "speculos":
speculos = ":speculos";
break;
case "shard":
shard = argv[argName];
break;
default:
usage(42);
break;
Expand Down

0 comments on commit bdd29fb

Please sign in to comment.