|
| 1 | +name: ai-device-tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + suite: |
| 7 | + description: "AI device test suite to run" |
| 8 | + required: true |
| 9 | + default: "trezor-emu" |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - trezor-emu |
| 13 | + simulator_name: |
| 14 | + description: "iOS Simulator name" |
| 15 | + required: false |
| 16 | + default: "iPhone 17" |
| 17 | + simulator_os: |
| 18 | + description: "iOS Simulator OS version" |
| 19 | + required: false |
| 20 | + default: "26.2" |
| 21 | + |
| 22 | +env: |
| 23 | + TERM: xterm-256color |
| 24 | + FORCE_COLOR: 1 |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.suite }} |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +jobs: |
| 31 | + trezor-emu: |
| 32 | + if: inputs.suite == 'trezor-emu' |
| 33 | + name: Trezor emulator dashboard |
| 34 | + runs-on: [self-hosted, macOS] |
| 35 | + timeout-minutes: 90 |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout Bitkit iOS |
| 39 | + uses: actions/checkout@v6 |
| 40 | + |
| 41 | + - name: Checkout bitkit-docker |
| 42 | + uses: actions/checkout@v6 |
| 43 | + with: |
| 44 | + repository: synonymdev/bitkit-docker |
| 45 | + ref: main |
| 46 | + path: bitkit-docker |
| 47 | + |
| 48 | + - name: Install xcbeautify |
| 49 | + run: | |
| 50 | + if ! command -v xcbeautify >/dev/null 2>&1; then |
| 51 | + brew install xcbeautify |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: System information |
| 55 | + run: | |
| 56 | + sw_vers |
| 57 | + xcodebuild -version |
| 58 | + docker version |
| 59 | + docker compose version |
| 60 | +
|
| 61 | + - name: Resolve Swift packages |
| 62 | + run: | |
| 63 | + xcodebuild -resolvePackageDependencies -onlyUsePackageVersionsFromResolvedFile | xcbeautify |
| 64 | +
|
| 65 | + - name: Start regtest and Trezor emulator |
| 66 | + working-directory: bitkit-docker |
| 67 | + run: | |
| 68 | + docker compose up -d |
| 69 | + ./scripts/trezor-emulator start |
| 70 | + ./scripts/trezor-emulator status |
| 71 | +
|
| 72 | + - name: Boot simulator |
| 73 | + env: |
| 74 | + SIMULATOR_NAME: ${{ inputs.simulator_name }} |
| 75 | + run: | |
| 76 | + xcrun simctl boot "$SIMULATOR_NAME" || true |
| 77 | +
|
| 78 | + - name: Run Trezor emulator UI tests |
| 79 | + env: |
| 80 | + TEST_TREZOR_EMU: "1" |
| 81 | + TEST_TREZOR_RESET_STATE: "1" |
| 82 | + TREZOR_BRIDGE: "true" |
| 83 | + TREZOR_BRIDGE_URL: "http://127.0.0.1:21325" |
| 84 | + TREZOR_ELECTRUM_URL: "tcp://127.0.0.1:60001" |
| 85 | + E2E: "true" |
| 86 | + E2E_BACKEND: "local" |
| 87 | + E2E_NETWORK: "regtest" |
| 88 | + GEO: "false" |
| 89 | + SIMULATOR_NAME: ${{ inputs.simulator_name }} |
| 90 | + SIMULATOR_OS: ${{ inputs.simulator_os }} |
| 91 | + run: | |
| 92 | + mkdir -p TestResults |
| 93 | + set -o pipefail |
| 94 | + xcodebuild test \ |
| 95 | + -workspace Bitkit.xcodeproj/project.xcworkspace \ |
| 96 | + -scheme BitkitAITests \ |
| 97 | + -configuration Debug \ |
| 98 | + -destination "platform=iOS Simulator,name=$SIMULATOR_NAME,OS=$SIMULATOR_OS" \ |
| 99 | + -derivedDataPath DerivedData \ |
| 100 | + -resultBundlePath TestResults/TrezorBridgeDashboardUITests.xcresult \ |
| 101 | + SWIFT_ACTIVE_COMPILATION_CONDITIONS='DEBUG E2E_BUILD TEST_TREZOR_EMU' \ |
| 102 | + -only-testing:BitkitUITests/TrezorBridgeDashboardUITests \ |
| 103 | + -parallel-testing-enabled NO \ |
| 104 | + | xcbeautify |
| 105 | +
|
| 106 | + - name: Collect diagnostics |
| 107 | + if: always() |
| 108 | + run: | |
| 109 | + mkdir -p ai-device-artifacts/trezor |
| 110 | + xcrun simctl io booted screenshot ai-device-artifacts/trezor/simulator.png || true |
| 111 | + if [ -d TestResults ]; then |
| 112 | + cp -R TestResults ai-device-artifacts/trezor/ || true |
| 113 | + fi |
| 114 | + ( |
| 115 | + cd bitkit-docker |
| 116 | + ./scripts/trezor-emulator status > ../ai-device-artifacts/trezor/trezor-status.json 2>&1 || true |
| 117 | + docker compose logs --no-color --tail=500 trezor-user-env-mac > ../ai-device-artifacts/trezor/trezor-user-env.log 2>&1 || true |
| 118 | + docker compose logs --no-color > ../ai-device-artifacts/trezor/docker-compose.log 2>&1 || true |
| 119 | + curl --silent --show-error -X POST http://127.0.0.1:21325/enumerate > ../ai-device-artifacts/trezor/bridge-enumerate.json 2>&1 || true |
| 120 | + ) |
| 121 | +
|
| 122 | + - name: Upload diagnostics |
| 123 | + if: always() |
| 124 | + uses: actions/upload-artifact@v6 |
| 125 | + with: |
| 126 | + name: ai-device-tests-trezor-${{ github.run_number }} |
| 127 | + path: ai-device-artifacts/trezor |
| 128 | + if-no-files-found: warn |
| 129 | + |
| 130 | + - name: Stop emulator services |
| 131 | + if: always() |
| 132 | + working-directory: bitkit-docker |
| 133 | + run: | |
| 134 | + ./scripts/trezor-emulator stop || true |
| 135 | + docker compose down || true |
0 commit comments