From eed13b29dabe5ef7e30a48dfcba1a94af52cd8f7 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 10:22:21 +0100 Subject: [PATCH 01/18] test: receive a Lightning payment on local Spark --- README.md | 20 +++++++++++ scripts/build-ios-sim.sh | 5 +-- scripts/local-backend | 51 +++++++++++++++++++++++++-- scripts/run-spark-e2e.sh | 23 +++++++++++++ test/helpers/receive-invoice.ts | 4 +-- test/specs/spark.e2e.ts | 61 +++++++++++++++++++++++++++++++++ 6 files changed, 158 insertions(+), 6 deletions(-) create mode 100755 scripts/run-spark-e2e.sh create mode 100644 test/specs/spark.e2e.ts diff --git a/README.md b/README.md index dffe7766..13f88600 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,26 @@ To build from a worktree instead of `../bitkit-android` / `../bitkit-ios` (dirty --- +### Spark receive on local regtest + +The `@spark_1` spec uses the Spark operators and Lightning payer from the repository's `BITKIT_DOCKER_REVISION`. Start the fixture before building either app so both builds embed the fixture's Spark settings. + +```bash +./scripts/local-backend spark-up +spark_settings=$(./scripts/local-backend spark-env) +while IFS= read -r setting; do export "$setting"; done <<< "$spark_settings" + +BACKEND=local ./scripts/build-android-apk.sh +BACKEND=local ./scripts/build-ios-sim.sh + +./scripts/run-spark-e2e.sh android +./scripts/run-spark-e2e.sh ios +``` + +Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. The iOS wrapper accepts `SIMULATOR_NAME` and `SIMULATOR_OS_VERSION` for the chosen simulator. The Docker images build from source on the first start. + +To run the case in GitHub Actions, dispatch the Android **E2E** and iOS **e2e-tests** workflows with `spark_only=true` and select the E2E branch that contains the spec. + ### USDT local execution [USDT E2E setup](docs/usdt-e2e.md) starts a pinned fixture from `bitkit-docker`, diff --git a/scripts/build-ios-sim.sh b/scripts/build-ios-sim.sh index b16af63d..c5b694c8 100755 --- a/scripts/build-ios-sim.sh +++ b/scripts/build-ios-sim.sh @@ -52,7 +52,8 @@ if [[ -n "$TREZOR_ELECTRUM_URL" ]]; then fi # Embed fixture endpoints so they survive Appium reinstalls and app relaunches. -for key in USDT_RPC_URL USDT_BUNDLER_URL USDT_DEPOSITS_URL USDT_BRIDGES_URL USDT_BRIDGE_NETWORKS; do +for key in USDT_RPC_URL USDT_BUNDLER_URL USDT_DEPOSITS_URL USDT_BRIDGES_URL USDT_BRIDGE_NETWORKS \ + SPARK_LOCAL_CONFIG_B64 SPARK_LOCAL_CHAIN_URL; do if [[ -n "${!key+x}" ]]; then XCODE_EXTRA_ARGS+=("$key=${!key}") fi @@ -65,7 +66,7 @@ xcodebuild \ -scheme Bitkit \ -configuration Debug \ -sdk iphonesimulator \ - -destination 'platform=iOS Simulator,OS=latest,name=iPhone 17' \ + -destination 'generic/platform=iOS Simulator' \ -derivedDataPath "$IOS_ROOT/build" \ "${XCODE_EXTRA_ARGS[@]}" \ clean build diff --git a/scripts/local-backend b/scripts/local-backend index a0ad162f..51d57c75 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Android Appium's pinned Bitcoin, Electrum and LND fixture. +# Pinned regtest fixtures for Appium. set -euo pipefail root="$(cd "$(dirname "$0")/.." && pwd)" @@ -51,6 +51,37 @@ compose() ( docker compose "$@" ) +spark() ( + cd "$stack" + ./spark "$@" +) + +spark_up() { + prepare + local SPARK_PUBLIC_HOST=127.0.0.1 + export SPARK_PUBLIC_HOST + local services service + local spark_services=() + services="$(compose --profile spark config --services)" + while IFS= read -r service; do + if [[ "$service" == spark-* ]]; then spark_services+=("$service"); fi + done <<< "$services" + compose --profile spark up -d --build --no-recreate bitcoind bitcoinsetup electrs "${spark_services[@]}" + local status=0 + compose --profile spark wait spark-ready || status=$? + compose --profile spark logs --no-log-prefix spark-ready + return "$status" +} + +spark_env() { + check_revision + local config + config="$(spark config --base64)" + [[ -n "$config" ]] || { echo 'Local Spark config is empty.' >&2; return 1; } + printf 'SPARK_LOCAL_CONFIG_B64=%s\n' "$config" + printf 'SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api\n' +} + set_runner_env() { export BITKIT_LOCAL_BACKEND_ROOT="$stack" export ELECTRUM_PORT="${ELECTRUM_PORT:-60001}" @@ -97,6 +128,22 @@ case "${1:-}" in printf '%s\n' "$stack" ;; up) up ;; + spark-up) spark_up ;; + spark-env) spark_env ;; + spark-pay) + check_revision + [[ "${2:-}" =~ ^lnbcrt[a-z0-9]+$ && "$#" -eq 2 ]] || { + echo 'Usage: ./scripts/local-backend spark-pay ' >&2 + exit 2 + } + spark pay "$2" + ;; + spark-down|spark-logs) + check_revision + command="${1#spark-}" + shift + compose --profile spark "$command" "$@" + ;; down|ps|logs) check_revision compose "$@" @@ -116,7 +163,7 @@ case "${1:-}" in exec "$@" ;; *) - echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run }' >&2 + echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run |spark-up|spark-env|spark-pay |spark-down|spark-logs}' >&2 exit 2 ;; esac diff --git a/scripts/run-spark-e2e.sh b/scripts/run-spark-e2e.sh new file mode 100755 index 00000000..9c00f5b0 --- /dev/null +++ b/scripts/run-spark-e2e.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +case "${1:-}" in + android|ios) ;; + *) + echo 'Usage: ./scripts/run-spark-e2e.sh {android|ios}' >&2 + exit 2 + ;; +esac + +cd "$(dirname "$0")/.." +./scripts/local-backend path >/dev/null +curl --fail --silent --show-error --max-time 5 http://127.0.0.1:23090/api/blocks/tip/height >/dev/null +if [[ "$1" == android ]]; then + for port in 23535 23536 23537 23049 23090; do + adb reverse "tcp:$port" "tcp:$port" + done +fi + +# Each dedicated run must execute the payment even on a reused runner. +exec ./scripts/local-backend run env -u CI BITKIT_LOCAL_SPARK=1 "./ci_run_$1.sh" \ + --spec ./test/specs/spark.e2e.ts --mochaOpts.grep '@spark_1\b' diff --git a/test/helpers/receive-invoice.ts b/test/helpers/receive-invoice.ts index dbb9d065..3a1ad37e 100644 --- a/test/helpers/receive-invoice.ts +++ b/test/helpers/receive-invoice.ts @@ -1,7 +1,7 @@ import { actAndExpect, tapAndExpect } from './outcome'; /** Edit the newly generated invoice, not a cached/placeholder Receive subtree. */ -export async function editGateLightningInvoice(paidInvoice: string) { +export async function editGateLightningInvoice(paidInvoice?: string) { const outcome = { anyVisible: [{ id: 'ReceiveNumberPadTextField' }] }; if (!driver.isAndroid) { await tapAndExpect({ id: 'SpecifyInvoiceButton' }, outcome); @@ -32,7 +32,7 @@ export async function editGateLightningInvoice(paidInvoice: string) { ).toLowerCase(); if ( !/^lnbcrt(?:\d+[munp]?)?1[02-9ac-hj-np-z]+$/.test(invoice) || - invoice === paidInvoice.toLowerCase() + invoice === paidInvoice?.toLowerCase() ) continue; // Pager pages repeat these tags. Resolve Edit from this QR's nearest shared diff --git a/test/specs/spark.e2e.ts b/test/specs/spark.e2e.ts new file mode 100644 index 00000000..297fe248 --- /dev/null +++ b/test/specs/spark.e2e.ts @@ -0,0 +1,61 @@ +import { execFile } from 'node:child_process'; +import { resolve } from 'node:path'; +import { promisify } from 'node:util'; +import { + acknowledgeReceivedPayment, + completeOnboarding, + expectSpendingBalance, + expectTextWithin, + getAddressFromQRCode, + getAmountUnder, + getReceiveAddress, + multiTap, + swipeFullScreen, +} from '../helpers/actions'; +import { doNavigationClose, openSettings } from '../helpers/navigation'; +import { tapAndExpect } from '../helpers/outcome'; +import { editGateLightningInvoice } from '../helpers/receive-invoice'; +import { reinstallApp } from '../helpers/setup'; +import { ciIt } from '../helpers/suite'; + +const runCommand = promisify(execFile); +const describeSpark = process.env.BITKIT_LOCAL_SPARK === '1' ? describe : describe.skip; + +async function openSparkConnection() { + await openSettings('advanced'); + await tapAndExpect({ id: 'Channels' }, { anyVisible: [{ id: 'SparkConnection' }] }); + await tapAndExpect({ id: 'SparkConnection' }, { anyVisible: [{ id: 'SparkBalance' }] }); +} + +describeSpark('Spark on local regtest', () => { + ciIt('@spark_1 - Receive a Lightning payment into Spark', async () => { + await reinstallApp(); + await completeOnboarding(); + + await openSparkConnection(); + expect(await getAmountUnder('SparkBalance')).toBe(0); + await doNavigationClose(); + + const originalInvoice = await getReceiveAddress('lightning'); + await editGateLightningInvoice(); + await tapAndExpect({ id: 'ReceiveNumberPadTextField' }, { anyVisible: [{ id: 'N1' }] }); + await tapAndExpect({ id: 'N1' }, { anyVisible: [{ id: 'N0' }] }); + await multiTap('N0', 4); + await tapAndExpect({ id: 'ReceiveNumberPadSubmit' }, { anyVisible: [{ id: 'ShowQrReceive' }] }); + await tapAndExpect({ id: 'ShowQrReceive' }, { anyVisible: [{ id: 'QRCode' }] }); + const invoice = await getAddressFromQRCode('lightning'); + expect(invoice).not.toBe(originalInvoice); + await swipeFullScreen('down'); + + await runCommand(resolve(__dirname, '../../scripts/local-backend'), ['spark-pay', invoice], { + timeout: 120_000, + }); + await acknowledgeReceivedPayment({ timeout: 90_000 }); + await expectSpendingBalance(10_000); + await expectTextWithin('ActivityShort-0', '+'); + await expectTextWithin('ActivityShort-0', '10 000'); + + await openSparkConnection(); + expect(await getAmountUnder('SparkBalance')).toBe(10_000); + }); +}); From de93f4ec94fadf1bb12a28cc87990ce7f4ca4683 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 10:27:28 +0100 Subject: [PATCH 02/18] test: stop only the Spark profile locally --- README.md | 2 +- scripts/local-backend | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 13f88600..016eb03a 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ BACKEND=local ./scripts/build-ios-sim.sh ./scripts/run-spark-e2e.sh ios ``` -Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. The iOS wrapper accepts `SIMULATOR_NAME` and `SIMULATOR_OS_VERSION` for the chosen simulator. The Docker images build from source on the first start. +Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. Set `SIMULATOR_NAME` to the dedicated simulator's unique name and `SIMULATOR_OS_VERSION` to its installed runtime so Appium requests the matching capability. The Docker images build from source on the first start. Run `./scripts/local-backend spark-down` to stop the Spark services when done. To run the case in GitHub Actions, dispatch the Android **E2E** and iOS **e2e-tests** workflows with `spark_only=true` and select the E2E branch that contains the spec. diff --git a/scripts/local-backend b/scripts/local-backend index 51d57c75..09a26ba1 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -138,11 +138,14 @@ case "${1:-}" in } spark pay "$2" ;; - spark-down|spark-logs) + spark-down) + check_revision + spark down + ;; + spark-logs) check_revision - command="${1#spark-}" shift - compose --profile spark "$command" "$@" + compose --profile spark logs "$@" ;; down|ps|logs) check_revision From 2a90c0849b3ff2b7cf5c07cc179706af939e4b1e Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 10:34:17 +0100 Subject: [PATCH 03/18] test: refresh Spark fixture settings and support Xcode 26.0 --- scripts/build-ios-sim.sh | 10 ++++++++++ scripts/local-backend | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/build-ios-sim.sh b/scripts/build-ios-sim.sh index c5b694c8..a99644bf 100755 --- a/scripts/build-ios-sim.sh +++ b/scripts/build-ios-sim.sh @@ -59,6 +59,16 @@ for key in USDT_RPC_URL USDT_BUNDLER_URL USDT_DEPOSITS_URL USDT_BRIDGES_URL USDT fi done +if [[ -n "${SPARK_LOCAL_CONFIG_B64:-}" ]]; then + xcode_version="$(xcodebuild -version)" + if [[ "$xcode_version" =~ ^Xcode[[:space:]]26\.0([.]|[[:space:]]) ]]; then + # Xcode 26.0 omits swift-secp256k1's default C traits when building the package. + XCODE_EXTRA_ARGS+=( + 'GCC_PREPROCESSOR_DEFINITIONS=$(inherited) ENABLE_MODULE_ECDH=1 ENABLE_MODULE_MUSIG=1 ENABLE_MODULE_RECOVERY=1 ENABLE_MODULE_SCHNORRSIG=1' + ) + fi +fi + echo "Building iOS simulator app (BACKEND=$BACKEND, E2E_BACKEND=$E2E_BACKEND, TREZOR_BRIDGE=$TREZOR_BRIDGE, TREZOR_BRIDGE_URL=$TREZOR_BRIDGE_URL)..." xcodebuild \ diff --git a/scripts/local-backend b/scripts/local-backend index 09a26ba1..1810e500 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -66,7 +66,9 @@ spark_up() { while IFS= read -r service; do if [[ "$service" == spark-* ]]; then spark_services+=("$service"); fi done <<< "$services" - compose --profile spark up -d --build --no-recreate bitcoind bitcoinsetup electrs "${spark_services[@]}" + compose up -d --no-recreate bitcoind bitcoinsetup electrs + # Let Compose refresh Spark services when their advertised host changes. + compose --profile spark up -d --build "${spark_services[@]}" local status=0 compose --profile spark wait spark-ready || status=$? compose --profile spark logs --no-log-prefix spark-ready From c14598af343edb66f186caf78e61077da7ad98f4 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 11:18:08 +0100 Subject: [PATCH 04/18] test: build each shared Spark image once --- scripts/local-backend | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/local-backend b/scripts/local-backend index 1810e500..fab305c4 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -67,8 +67,12 @@ spark_up() { if [[ "$service" == spark-* ]]; then spark_services+=("$service"); fi done <<< "$services" compose up -d --no-recreate bitcoind bitcoinsetup electrs + # The operators, migrations and Lightning nodes share image tags. Build one service + # per image so BuildKit cannot publish the same tag from multiple targets at once. + compose --profile spark build spark-so-0 spark-migrations-0 spark-ldk-server spark-sspd \ + spark-ready spark-lnurl spark-data-sync # Let Compose refresh Spark services when their advertised host changes. - compose --profile spark up -d --build "${spark_services[@]}" + compose --profile spark up -d --no-build "${spark_services[@]}" local status=0 compose --profile spark wait spark-ready || status=$? compose --profile spark logs --no-log-prefix spark-ready From 8d27b3855a4e47313d4d23919409841665689406 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 11:27:01 +0100 Subject: [PATCH 05/18] test: reveal Spark spending balance before asserting --- test/specs/spark.e2e.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/specs/spark.e2e.ts b/test/specs/spark.e2e.ts index 297fe248..67f36a6d 100644 --- a/test/specs/spark.e2e.ts +++ b/test/specs/spark.e2e.ts @@ -4,6 +4,7 @@ import { promisify } from 'node:util'; import { acknowledgeReceivedPayment, completeOnboarding, + elementById, expectSpendingBalance, expectTextWithin, getAddressFromQRCode, @@ -24,7 +25,13 @@ const describeSpark = process.env.BITKIT_LOCAL_SPARK === '1' ? describe : descri async function openSparkConnection() { await openSettings('advanced'); await tapAndExpect({ id: 'Channels' }, { anyVisible: [{ id: 'SparkConnection' }] }); - await tapAndExpect({ id: 'SparkConnection' }, { anyVisible: [{ id: 'SparkBalance' }] }); + await tapAndExpect( + { id: 'SparkConnection' }, + { anyVisible: [{ id: 'SparkBalance' }, { id: 'SparkDepositAddress' }] } + ); + if (!(await elementById('SparkBalance').isDisplayed())) { + await swipeFullScreen('up', { upStartYPercent: 0.68, upEndYPercent: 0.34 }); + } } describeSpark('Spark on local regtest', () => { From 4eabe440640cd6756543a582d9b1bddefbe2e8f6 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 12:54:27 +0100 Subject: [PATCH 06/18] docs: describe the local Spark nightly --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 016eb03a..c5f59977 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ BACKEND=local ./scripts/build-ios-sim.sh Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. Set `SIMULATOR_NAME` to the dedicated simulator's unique name and `SIMULATOR_OS_VERSION` to its installed runtime so Appium requests the matching capability. The Docker images build from source on the first start. Run `./scripts/local-backend spark-down` to stop the Spark services when done. -To run the case in GitHub Actions, dispatch the Android **E2E** and iOS **e2e-tests** workflows with `spark_only=true` and select the E2E branch that contains the spec. +The **Local E2E Nightly** workflows run this case on Android and iOS at 05:35 UTC against E2E `main`. To run it on demand, dispatch the workflow in the app repository. Set `e2e_branch` if the spec is on another ref. ### USDT local execution From 4b2fea18a858ddec251f0bee01a3930578a91338 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 12:58:00 +0100 Subject: [PATCH 07/18] docs: describe Spark nightly retries --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5f59977..ae4eab22 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ BACKEND=local ./scripts/build-ios-sim.sh Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. Set `SIMULATOR_NAME` to the dedicated simulator's unique name and `SIMULATOR_OS_VERSION` to its installed runtime so Appium requests the matching capability. The Docker images build from source on the first start. Run `./scripts/local-backend spark-down` to stop the Spark services when done. -The **Local E2E Nightly** workflows run this case on Android and iOS at 05:35 UTC against E2E `main`. To run it on demand, dispatch the workflow in the app repository. Set `e2e_branch` if the spec is on another ref. +The **Local E2E Nightly** workflows run this case on Android and iOS at 05:35 UTC against E2E `main`. To run it on demand, dispatch the workflow in the app repository. Set `e2e_branch` if the spec is on another ref. The job makes up to three attempts and uploads logs and diagnostics by attempt. ### USDT local execution From d7ff68e53f54dbc612ad3086c76cd452b1c0a49d Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 13:25:01 +0100 Subject: [PATCH 08/18] test: reuse cached images for the pinned Spark fixture --- README.md | 1 + scripts/local-backend | 39 +++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ae4eab22..ad267b29 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ BACKEND=local ./scripts/build-ios-sim.sh Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. Set `SIMULATOR_NAME` to the dedicated simulator's unique name and `SIMULATOR_OS_VERSION` to its installed runtime so Appium requests the matching capability. The Docker images build from source on the first start. Run `./scripts/local-backend spark-down` to stop the Spark services when done. The **Local E2E Nightly** workflows run this case on Android and iOS at 05:35 UTC against E2E `main`. To run it on demand, dispatch the workflow in the app repository. Set `e2e_branch` if the spec is on another ref. The job makes up to three attempts and uploads logs and diagnostics by attempt. +Android CI caches the built Spark images for each Docker pin and runner architecture. Each CI run creates fresh fixture data. ### USDT local execution diff --git a/scripts/local-backend b/scripts/local-backend index fab305c4..d413d128 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -56,6 +56,40 @@ spark() ( ./spark "$@" ) +spark_build() { + # Some Spark services use the same tag. Select one target per image. + local targets=(spark-so-0 spark-migrations-0 spark-ldk-server spark-sspd spark-ready spark-lnurl spark-data-sync) + if [[ -z "${SPARK_IMAGE_CACHE:-}" ]]; then + compose --profile spark build "${targets[@]}" + return + fi + + local definitions target image archive + local images=() + definitions="$(compose --profile spark config --format json)" + for target in "${targets[@]}"; do + image="$(jq -er --arg target "$target" '.services[$target].image | strings | select(length > 0)' <<< "$definitions")" + images+=("$image") + done + + if [[ -s "$SPARK_IMAGE_CACHE" ]] && + docker image load --input "$SPARK_IMAGE_CACHE" && + docker image inspect "${images[@]}" >/dev/null; then + echo 'Loaded pinned Spark images from cache.' + return + fi + + compose --profile spark build "${targets[@]}" + if archive="$(mktemp "${SPARK_IMAGE_CACHE}.XXXXXX")"; then + if docker image save --output "$archive" "${images[@]}" && mv "$archive" "$SPARK_IMAGE_CACHE"; then + echo 'Saved pinned Spark images for caching.' + return + fi + rm -f "$archive" + fi + echo 'Could not save the Spark image cache. Continuing with the built images.' >&2 +} + spark_up() { prepare local SPARK_PUBLIC_HOST=127.0.0.1 @@ -67,10 +101,7 @@ spark_up() { if [[ "$service" == spark-* ]]; then spark_services+=("$service"); fi done <<< "$services" compose up -d --no-recreate bitcoind bitcoinsetup electrs - # The operators, migrations and Lightning nodes share image tags. Build one service - # per image so BuildKit cannot publish the same tag from multiple targets at once. - compose --profile spark build spark-so-0 spark-migrations-0 spark-ldk-server spark-sspd \ - spark-ready spark-lnurl spark-data-sync + spark_build # Let Compose refresh Spark services when their advertised host changes. compose --profile spark up -d --no-build "${spark_services[@]}" local status=0 From 42ce6c3fee5d6ce40e55518b533951ca8d00a765 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 15:36:19 +0100 Subject: [PATCH 09/18] test: support transferring the pinned Spark fixture images --- README.md | 2 +- scripts/local-backend | 49 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ad267b29..1092cf5b 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ BACKEND=local ./scripts/build-ios-sim.sh Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. Set `SIMULATOR_NAME` to the dedicated simulator's unique name and `SIMULATOR_OS_VERSION` to its installed runtime so Appium requests the matching capability. The Docker images build from source on the first start. Run `./scripts/local-backend spark-down` to stop the Spark services when done. The **Local E2E Nightly** workflows run this case on Android and iOS at 05:35 UTC against E2E `main`. To run it on demand, dispatch the workflow in the app repository. Set `e2e_branch` if the spec is on another ref. The job makes up to three attempts and uploads logs and diagnostics by attempt. -Android CI caches the built Spark images for each Docker pin and runner architecture. Each CI run creates fresh fixture data. +CI caches the Spark images by Docker pin and runner architecture. The iOS workflow prepares the ARM64 Docker images on hosted Linux and loads them on the Mac runner. Each CI run creates fresh fixture data. ### USDT local execution diff --git a/scripts/local-backend b/scripts/local-backend index d413d128..174fb79d 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -7,6 +7,7 @@ cache="$root/.cache/local-backend" stack="${BITKIT_LOCAL_BACKEND_ROOT:-$cache/infra}" credentials="$cache/lnd" revision="$(tr -d '[:space:]' < "$root/BITKIT_DOCKER_REVISION")" +spark_base_services=(bitcoind bitcoinsetup electrs) if [[ ! "$revision" =~ ^[0-9a-f]{40}$ ]]; then echo 'BITKIT_DOCKER_REVISION must contain a full Git SHA.' >&2 @@ -56,6 +57,10 @@ spark() ( ./spark "$@" ) +spark_services() { + compose --profile spark config --services | awk '/^spark-/' +} + spark_build() { # Some Spark services use the same tag. Select one target per image. local targets=(spark-so-0 spark-migrations-0 spark-ldk-server spark-sspd spark-ready spark-lnurl spark-data-sync) @@ -90,20 +95,39 @@ spark_build() { echo 'Could not save the Spark image cache. Continuing with the built images.' >&2 } +spark_pack() { + local archive="$1" + prepare + local services service image_list image + local targets=("${spark_base_services[@]}") + local images=() + services="$(spark_services)" + while IFS= read -r service; do targets+=("$service"); done <<< "$services" + + SPARK_IMAGE_CACHE= spark_build + compose --profile spark pull --ignore-buildable "${targets[@]}" + image_list="$(compose --profile spark config --images "${targets[@]}" | sort -u)" + while IFS= read -r image; do images+=("$image"); done <<< "$image_list" + docker image save --output "$archive" "${images[@]}" +} + spark_up() { prepare local SPARK_PUBLIC_HOST=127.0.0.1 export SPARK_PUBLIC_HOST local services service - local spark_services=() - services="$(compose --profile spark config --services)" - while IFS= read -r service; do - if [[ "$service" == spark-* ]]; then spark_services+=("$service"); fi - done <<< "$services" - compose up -d --no-recreate bitcoind bitcoinsetup electrs - spark_build + local profile_services=() + local start_args=(-d) + services="$(spark_services)" + while IFS= read -r service; do profile_services+=("$service"); done <<< "$services" + if [[ -n "${SPARK_IMAGE_ARCHIVE:-}" ]]; then + docker image load --input "$SPARK_IMAGE_ARCHIVE" + start_args+=(--pull never) + fi + compose up "${start_args[@]}" --no-recreate "${spark_base_services[@]}" + if [[ -z "${SPARK_IMAGE_ARCHIVE:-}" ]]; then spark_build; fi # Let Compose refresh Spark services when their advertised host changes. - compose --profile spark up -d --no-build "${spark_services[@]}" + compose --profile spark up "${start_args[@]}" --no-build "${profile_services[@]}" local status=0 compose --profile spark wait spark-ready || status=$? compose --profile spark logs --no-log-prefix spark-ready @@ -165,6 +189,13 @@ case "${1:-}" in printf '%s\n' "$stack" ;; up) up ;; + spark-pack) + [[ "$#" -eq 2 && -n "$2" ]] || { + echo 'Usage: ./scripts/local-backend spark-pack ' >&2 + exit 2 + } + spark_pack "$2" + ;; spark-up) spark_up ;; spark-env) spark_env ;; spark-pay) @@ -203,7 +234,7 @@ case "${1:-}" in exec "$@" ;; *) - echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run |spark-up|spark-env|spark-pay |spark-down|spark-logs}' >&2 + echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run |spark-pack |spark-up|spark-env|spark-pay |spark-down|spark-logs}' >&2 exit 2 ;; esac From b5d77fb7e72bd117452acbc74e39c8cd84798fc4 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 19:24:04 +0100 Subject: [PATCH 10/18] test: generate pinned Spark settings for hosted iOS builds --- README.md | 2 +- scripts/build-ios-sim.sh | 9 +++++++++ scripts/local-backend | 11 ++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1092cf5b..d84e5f4f 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ BACKEND=local ./scripts/build-ios-sim.sh Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. Set `SIMULATOR_NAME` to the dedicated simulator's unique name and `SIMULATOR_OS_VERSION` to its installed runtime so Appium requests the matching capability. The Docker images build from source on the first start. Run `./scripts/local-backend spark-down` to stop the Spark services when done. The **Local E2E Nightly** workflows run this case on Android and iOS at 05:35 UTC against E2E `main`. To run it on demand, dispatch the workflow in the app repository. Set `e2e_branch` if the spec is on another ref. The job makes up to three attempts and uploads logs and diagnostics by attempt. -CI caches the Spark images by Docker pin and runner architecture. The iOS workflow prepares the ARM64 Docker images on hosted Linux and loads them on the Mac runner. Each CI run creates fresh fixture data. +CI caches the Spark images by Docker pin and runner architecture. The iOS workflow prepares the ARM64 images and generates the wallet settings on hosted Linux, then builds the app on hosted macOS. The self-hosted Mac loads both archives, starts a fresh fixture, and verifies its wallet settings before running the test. ### USDT local execution diff --git a/scripts/build-ios-sim.sh b/scripts/build-ios-sim.sh index a99644bf..2985c617 100755 --- a/scripts/build-ios-sim.sh +++ b/scripts/build-ios-sim.sh @@ -51,6 +51,15 @@ if [[ -n "$TREZOR_ELECTRUM_URL" ]]; then XCODE_EXTRA_ARGS+=("TREZOR_ELECTRUM_URL=$TREZOR_ELECTRUM_URL") fi +if [[ -n "${SOURCE_PACKAGES:-}" ]]; then + XCODE_EXTRA_ARGS+=( + -clonedSourcePackagesDirPath "$SOURCE_PACKAGES" + -disablePackageRepositoryCache + -disableAutomaticPackageResolution + -skipPackageUpdates + ) +fi + # Embed fixture endpoints so they survive Appium reinstalls and app relaunches. for key in USDT_RPC_URL USDT_BUNDLER_URL USDT_DEPOSITS_URL USDT_BRIDGES_URL USDT_BRIDGE_NETWORKS \ SPARK_LOCAL_CONFIG_B64 SPARK_LOCAL_CHAIN_URL; do diff --git a/scripts/local-backend b/scripts/local-backend index 174fb79d..e2972cb9 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -143,6 +143,14 @@ spark_env() { printf 'SPARK_LOCAL_CHAIN_URL=http://127.0.0.1:23090/api\n' } +spark_init_env() { + prepare + local SPARK_PUBLIC_HOST=127.0.0.1 + export SPARK_PUBLIC_HOST + compose --profile spark run --rm --no-deps --pull never -T spark-init >&2 + spark_env +} + set_runner_env() { export BITKIT_LOCAL_BACKEND_ROOT="$stack" export ELECTRUM_PORT="${ELECTRUM_PORT:-60001}" @@ -197,6 +205,7 @@ case "${1:-}" in spark_pack "$2" ;; spark-up) spark_up ;; + spark-init-env) spark_init_env ;; spark-env) spark_env ;; spark-pay) check_revision @@ -234,7 +243,7 @@ case "${1:-}" in exec "$@" ;; *) - echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run |spark-pack |spark-up|spark-env|spark-pay |spark-down|spark-logs}' >&2 + echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run |spark-pack |spark-up|spark-init-env|spark-env|spark-pay |spark-down|spark-logs}' >&2 exit 2 ;; esac From e8ddfb594876130febb452b01f323de7eb7a28c0 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 19:26:22 +0100 Subject: [PATCH 11/18] test: initialize Spark build settings without rebuilding images --- scripts/local-backend | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/local-backend b/scripts/local-backend index e2972cb9..3aa77735 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -147,7 +147,7 @@ spark_init_env() { prepare local SPARK_PUBLIC_HOST=127.0.0.1 export SPARK_PUBLIC_HOST - compose --profile spark run --rm --no-deps --pull never -T spark-init >&2 + compose --profile spark up --no-deps --no-build --pull never --exit-code-from spark-init spark-init >&2 spark_env } From 615ca2d70ac5a788bd6c3ffa050bb3ffd6ac6505 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 19:36:20 +0100 Subject: [PATCH 12/18] test: allow an explicit iOS simulator architecture --- scripts/build-ios-sim.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/build-ios-sim.sh b/scripts/build-ios-sim.sh index 2985c617..78ec03cc 100755 --- a/scripts/build-ios-sim.sh +++ b/scripts/build-ios-sim.sh @@ -4,6 +4,7 @@ # Inputs/roots: # - E2E root: this repo (bitkit-e2e-tests) # - iOS root: $IOS_ROOT, or ../bitkit-ios if unset +# - Simulator architecture: $IOS_SIMULATOR_ARCH, or Xcode's default if unset # # Output: # - Copies Debug iphonesimulator build: Bitkit.app -> aut/Bitkit.app @@ -60,6 +61,10 @@ if [[ -n "${SOURCE_PACKAGES:-}" ]]; then ) fi +if [[ -n "${IOS_SIMULATOR_ARCH:-}" ]]; then + XCODE_EXTRA_ARGS+=("ARCHS=$IOS_SIMULATOR_ARCH") +fi + # Embed fixture endpoints so they survive Appium reinstalls and app relaunches. for key in USDT_RPC_URL USDT_BUNDLER_URL USDT_DEPOSITS_URL USDT_BRIDGES_URL USDT_BRIDGE_NETWORKS \ SPARK_LOCAL_CONFIG_B64 SPARK_LOCAL_CHAIN_URL; do From 9f6f407ad34bf3372a02eeebbf1de67e19a5a612 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Thu, 19 Nov 2026 19:55:56 +0100 Subject: [PATCH 13/18] test: run Spark from verified preloaded images --- README.md | 2 +- scripts/local-backend | 48 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d84e5f4f..88cd2d09 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ BACKEND=local ./scripts/build-ios-sim.sh Use a dedicated emulator and simulator because the test reinstalls Bitkit and creates a new wallet. Set `SIMULATOR_NAME` to the dedicated simulator's unique name and `SIMULATOR_OS_VERSION` to its installed runtime so Appium requests the matching capability. The Docker images build from source on the first start. Run `./scripts/local-backend spark-down` to stop the Spark services when done. The **Local E2E Nightly** workflows run this case on Android and iOS at 05:35 UTC against E2E `main`. To run it on demand, dispatch the workflow in the app repository. Set `e2e_branch` if the spec is on another ref. The job makes up to three attempts and uploads logs and diagnostics by attempt. -CI caches the Spark images by Docker pin and runner architecture. The iOS workflow prepares the ARM64 images and generates the wallet settings on hosted Linux, then builds the app on hosted macOS. The self-hosted Mac loads both archives, starts a fresh fixture, and verifies its wallet settings before running the test. +CI caches the Spark images by Docker pin and runner architecture. The iOS workflow prepares ARM64 images and wallet settings on hosted Linux, then builds the app on hosted macOS. The self-hosted Mac reuses matching Docker images when available, starts a fresh fixture, and verifies its wallet settings before running the test. ### USDT local execution diff --git a/scripts/local-backend b/scripts/local-backend index 3aa77735..a4958648 100755 --- a/scripts/local-backend +++ b/scripts/local-backend @@ -61,6 +61,28 @@ spark_services() { compose --profile spark config --services | awk '/^spark-/' } +spark_fixture_services() { + printf '%s\n' "${spark_base_services[@]}" + spark_services +} + +spark_fixture_images() { + compose --profile spark config --images "$@" | LC_ALL=C sort -u +} + +spark_image_fingerprint() { + local service_list service image_list image image_id + local services=() image_ids=() + service_list="$(spark_fixture_services)" || return + while IFS= read -r service; do services+=("$service"); done <<< "$service_list" + image_list="$(spark_fixture_images "${services[@]}")" || return + while IFS= read -r image; do + image_id="$(docker image inspect --format '{{.Id}}' "$image")" || return + image_ids+=("$image $image_id") + done <<< "$image_list" + printf '%s\n' "${image_ids[@]}" | shasum -a 256 | awk '{print $1}' +} + spark_build() { # Some Spark services use the same tag. Select one target per image. local targets=(spark-so-0 spark-migrations-0 spark-ldk-server spark-sspd spark-ready spark-lnurl spark-data-sync) @@ -99,14 +121,14 @@ spark_pack() { local archive="$1" prepare local services service image_list image - local targets=("${spark_base_services[@]}") + local targets=() local images=() - services="$(spark_services)" + services="$(spark_fixture_services)" while IFS= read -r service; do targets+=("$service"); done <<< "$services" SPARK_IMAGE_CACHE= spark_build compose --profile spark pull --ignore-buildable "${targets[@]}" - image_list="$(compose --profile spark config --images "${targets[@]}" | sort -u)" + image_list="$(spark_fixture_images "${targets[@]}")" while IFS= read -r image; do images+=("$image"); done <<< "$image_list" docker image save --output "$archive" "${images[@]}" } @@ -118,14 +140,24 @@ spark_up() { local services service local profile_services=() local start_args=(-d) + local base_args=(--no-recreate) services="$(spark_services)" while IFS= read -r service; do profile_services+=("$service"); done <<< "$services" if [[ -n "${SPARK_IMAGE_ARCHIVE:-}" ]]; then docker image load --input "$SPARK_IMAGE_ARCHIVE" + fi + if [[ -n "${SPARK_IMAGE_FINGERPRINT:-}" ]]; then + if [[ "$(spark_image_fingerprint)" != "$SPARK_IMAGE_FINGERPRINT" ]]; then + echo 'The local Docker images do not match the pinned Spark fixture archive.' >&2 + return 1 + fi + fi + if [[ -n "${SPARK_IMAGE_ARCHIVE:-}${SPARK_IMAGE_FINGERPRINT:-}" ]]; then start_args+=(--pull never) + base_args+=(--no-build) fi - compose up "${start_args[@]}" --no-recreate "${spark_base_services[@]}" - if [[ -z "${SPARK_IMAGE_ARCHIVE:-}" ]]; then spark_build; fi + compose up "${start_args[@]}" "${base_args[@]}" "${spark_base_services[@]}" + if [[ -z "${SPARK_IMAGE_ARCHIVE:-}${SPARK_IMAGE_FINGERPRINT:-}" ]]; then spark_build; fi # Let Compose refresh Spark services when their advertised host changes. compose --profile spark up "${start_args[@]}" --no-build "${profile_services[@]}" local status=0 @@ -205,6 +237,10 @@ case "${1:-}" in spark_pack "$2" ;; spark-up) spark_up ;; + spark-image-fingerprint) + check_revision + spark_image_fingerprint + ;; spark-init-env) spark_init_env ;; spark-env) spark_env ;; spark-pay) @@ -243,7 +279,7 @@ case "${1:-}" in exec "$@" ;; *) - echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run |spark-pack |spark-up|spark-init-env|spark-env|spark-pay |spark-down|spark-logs}' >&2 + echo 'Usage: ./scripts/local-backend {prepare|path|up|down|ps|logs|github-env|run |spark-pack |spark-up|spark-image-fingerprint|spark-init-env|spark-env|spark-pay |spark-down|spark-logs}' >&2 exit 2 ;; esac From 4d3c9bb4d141ff8db9724245790ebd72001aa126 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 20 Nov 2026 09:06:35 +0100 Subject: [PATCH 14/18] Report local nightly Spark results to Slack --- scripts/slack_summary.py | 80 ++++++++++++++++++++++++++--------- scripts/test_slack_summary.py | 74 ++++++++++++++++++++++++++++++++ test/specs/spark.e2e.ts | 10 +++++ 3 files changed, 143 insertions(+), 21 deletions(-) diff --git a/scripts/slack_summary.py b/scripts/slack_summary.py index 25a6aff7..8851201e 100755 --- a/scripts/slack_summary.py +++ b/scripts/slack_summary.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 """ -Slack summary script for Bitkit E2E staging and migration workflows. +Slack summary script for Bitkit E2E staging, migration and local nightly workflows. Renders a summary message from environment variables and posts it to a Slack webhook. Modeled on synonymdev/bitkit-nightly slack_summary.py style. @@ -8,12 +8,11 @@ Usage: python3 scripts/slack_summary.py e2e-staging python3 scripts/slack_summary.py e2e-migration + python3 scripts/slack_summary.py e2e-local-nightly Required env vars: SLACK_WEBHOOK_URL - Slack incoming webhook URL (skips gracefully if unset) PLATFORM - ios|android - BUILD_RESULT - build job result - E2E_BRANCH_RESULT - e2e-branch job result E2E_TESTS_RESULT - e2e-tests job result RUN_URL - GitHub Actions run URL RUN_ATTEMPT - Current run attempt number @@ -21,13 +20,21 @@ Mode-specific env vars: STAGING_RESULT - Overall result for e2e-staging MIGRATION_RESULT - Overall result for e2e-migration + BUILD_RESULT - App build result + E2E_BRANCH_RESULT - e2e-branch result for staging and migration PREPARE_WALLETS_RESULT - Optional iOS migration job result + LOCAL_NIGHTLY_RESULT - Overall result for e2e-local-nightly + SPARK_IMAGES_RESULT - Optional iOS image preparation result + SPARK_FIXTURE_RESULT - Local Spark fixture startup result + SPARK_CASE_RESULT - Final result reported for @spark_1 Optional env vars: E2E_TESTS_REF - Resolved e2e-tests branch/ref GITHUB_REPOSITORY - Repository name (e.g. synonymdev/bitkit-ios) """ +from __future__ import annotations + import json import os import sys @@ -35,7 +42,7 @@ import urllib.request from datetime import datetime, timezone -MODES = ("e2e-staging", "e2e-migration") +MODES = ("e2e-staging", "e2e-migration", "e2e-local-nightly") def get_status_icon(status: str) -> str: @@ -47,7 +54,7 @@ def get_status_icon(status: str) -> str: return ":x:" elif status_lower == "cancelled": return ":warning:" - elif status_lower == "skipped": + elif status_lower in ("skipped", "did not run"): return ":fast_forward:" else: return ":grey_question:" @@ -74,14 +81,11 @@ def _render_message( *, kind: str, overall_result: str, - build_job: str, - tests_job: str, + jobs: dict[str, str], + case: tuple[str, str] | None = None, + results_heading: str = "Jobs", ) -> str: platform = os.environ.get("PLATFORM", "") - build_result = os.environ.get("BUILD_RESULT", "unknown") - e2e_branch_result = os.environ.get("E2E_BRANCH_RESULT", "unknown") - e2e_tests_result = os.environ.get("E2E_TESTS_RESULT", "unknown") - prepare_wallets_result = os.environ.get("PREPARE_WALLETS_RESULT", "") run_url = os.environ.get("RUN_URL", "") run_attempt = os.environ.get("RUN_ATTEMPT", "1") e2e_tests_ref = os.environ.get("E2E_TESTS_REF", "") @@ -107,23 +111,33 @@ def _render_message( lines.append(f"Repository: {repo}") lines.append("") - lines.append("Jobs:") - lines.append(f" {build_job}: {format_status(build_result)}") - lines.append(f" e2e-branch: {format_status(e2e_branch_result)}") - if prepare_wallets_result: - lines.append(f" prepare-wallets: {format_status(prepare_wallets_result)}") - lines.append(f" {tests_job}: {format_status(e2e_tests_result)}") + lines.append(f"{results_heading}:") + lines.extend(f" {job}: {format_status(result)}" for job, result in jobs.items()) + if case: + name, result = case + lines.append(f"\n{name}: {format_status(result)}") return "\n".join(lines) +def _standard_jobs(build_job: str, tests_job: str) -> dict[str, str]: + jobs = { + build_job: os.environ.get("BUILD_RESULT", "unknown"), + "e2e-branch": os.environ.get("E2E_BRANCH_RESULT", "unknown"), + } + prepare_wallets = os.environ.get("PREPARE_WALLETS_RESULT", "") + if prepare_wallets: + jobs["prepare-wallets"] = prepare_wallets + jobs[tests_job] = os.environ.get("E2E_TESTS_RESULT", "unknown") + return jobs + + def render_e2e_staging_message() -> str: """Render the E2E staging summary message from environment variables.""" return _render_message( kind="staging", overall_result=os.environ.get("STAGING_RESULT", "unknown"), - build_job="build-staging", - tests_job="e2e-tests-staging", + jobs=_standard_jobs("build-staging", "e2e-tests-staging"), ) @@ -132,8 +146,30 @@ def render_e2e_migration_message() -> str: return _render_message( kind="migration", overall_result=os.environ.get("MIGRATION_RESULT", "unknown"), - build_job="build", - tests_job="e2e-tests", + jobs=_standard_jobs("build", "e2e-tests"), + ) + + +def render_e2e_local_nightly_message() -> str: + setup = { + "spark-images": os.environ.get("SPARK_IMAGES_RESULT", ""), + "app build": os.environ.get("BUILD_RESULT", ""), + "Spark fixture": os.environ.get("SPARK_FIXTURE_RESULT", ""), + } + tests_result = os.environ.get("E2E_TESTS_RESULT", "unknown") + case_result = os.environ.get("SPARK_CASE_RESULT") or "no result" + if tests_result == "cancelled" and case_result != "success": + case_result = "cancelled" + elif case_result == "no result" and (tests_result == "skipped" or any( + result in ("failure", "skipped") for result in setup.values() + )): + case_result = "did not run" + return _render_message( + kind="local nightly", + overall_result=os.environ.get("LOCAL_NIGHTLY_RESULT", "unknown"), + jobs={job: result for job, result in {**setup, "e2e-spark": tests_result}.items() if result}, + case=("@spark_1", case_result), + results_heading="Stages", ) @@ -187,6 +223,8 @@ def main() -> int: message = render_e2e_staging_message() elif mode == "e2e-migration": message = render_e2e_migration_message() + elif mode == "e2e-local-nightly": + message = render_e2e_local_nightly_message() else: print(f"Unknown mode: {mode}", file=sys.stderr) print(f"Available modes: {', '.join(MODES)}", file=sys.stderr) diff --git a/scripts/test_slack_summary.py b/scripts/test_slack_summary.py index e49abe33..7621a241 100644 --- a/scripts/test_slack_summary.py +++ b/scripts/test_slack_summary.py @@ -11,7 +11,9 @@ format_status, get_platform_display, get_status_icon, + main, post_to_slack, + render_e2e_local_nightly_message, render_e2e_migration_message, render_e2e_staging_message, ) @@ -200,6 +202,78 @@ def test_android_success_omits_prepare_wallets(self): self.assertNotIn("prepare-wallets", message) +class TestRenderLocalNightlyMessage(unittest.TestCase): + def setUp(self): + env_patcher = patch.dict(os.environ, {}, clear=True) + env_patcher.start() + self.addCleanup(env_patcher.stop) + + def test_android_pass_links_to_run_and_checked_out_ref(self): + os.environ.update({ + "PLATFORM": "android", + "LOCAL_NIGHTLY_RESULT": "success", + "BUILD_RESULT": "success", + "SPARK_FIXTURE_RESULT": "success", + "E2E_TESTS_RESULT": "success", + "SPARK_CASE_RESULT": "success", + "RUN_URL": "https://github.com/synonymdev/bitkit-android/actions/runs/123", + "RUN_ATTEMPT": "2", + "E2E_TESTS_REF": "abc123", + }) + message = render_e2e_local_nightly_message() + self.assertIn(":white_check_mark: Bitkit Android E2E local nightly: success", message) + self.assertIn("@spark_1: :white_check_mark: success", message) + self.assertIn("Run: https://github.com/synonymdev/bitkit-android/actions/runs/123", message) + self.assertIn("Run attempt: 2", message) + self.assertIn("E2E tests ref: abc123", message) + self.assertNotIn("spark-images", message) + + def test_ios_failure_before_appium(self): + os.environ.update({ + "PLATFORM": "ios", + "LOCAL_NIGHTLY_RESULT": "failure", + "SPARK_IMAGES_RESULT": "success", + "BUILD_RESULT": "success", + "SPARK_FIXTURE_RESULT": "failure", + "E2E_TESTS_RESULT": "failure", + }) + message = render_e2e_local_nightly_message() + self.assertIn(":x: Bitkit iOS E2E local nightly: failure", message) + self.assertIn("Spark fixture: :x: failure", message) + self.assertIn("@spark_1: :fast_forward: did not run", message) + + def test_case_result_distinguishes_test_failure_from_later_job_failure(self): + os.environ.update({"LOCAL_NIGHTLY_RESULT": "failure", "E2E_TESTS_RESULT": "failure"}) + for result, icon in (("failure", ":x:"), ("success", ":white_check_mark:")): + with self.subTest(result=result): + os.environ["SPARK_CASE_RESULT"] = result + message = render_e2e_local_nightly_message() + self.assertIn("e2e-spark: :x: failure", message) + self.assertIn(f"@spark_1: {icon} {result}", message) + + def test_cancelled_job_matches_the_final_case_outcome(self): + os.environ.update({ + "E2E_TESTS_RESULT": "cancelled", + "SPARK_CASE_RESULT": "failure", + }) + message = render_e2e_local_nightly_message() + self.assertIn("@spark_1: :warning: cancelled", message) + + def test_older_e2e_ref_without_case_output_has_no_confirmed_result(self): + os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "E2E_TESTS_RESULT": "success"}) + message = render_e2e_local_nightly_message() + self.assertIn("@spark_1: :grey_question: no result", message) + + def test_cli_posts_one_summary(self): + os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "SPARK_CASE_RESULT": "success"}) + with patch("sys.argv", ["slack_summary.py", "e2e-local-nightly"]), \ + patch("sys.stdout", new=io.StringIO()), \ + patch("slack_summary.post_to_slack", return_value=True) as post: + self.assertEqual(main(), 0) + post.assert_called_once() + self.assertIn("@spark_1: :white_check_mark: success", post.call_args.args[0]) + + class TestPostToSlack(unittest.TestCase): """Tests for webhook posting.""" diff --git a/test/specs/spark.e2e.ts b/test/specs/spark.e2e.ts index 67f36a6d..8d07b3cf 100644 --- a/test/specs/spark.e2e.ts +++ b/test/specs/spark.e2e.ts @@ -1,4 +1,5 @@ import { execFile } from 'node:child_process'; +import { appendFileSync } from 'node:fs'; import { resolve } from 'node:path'; import { promisify } from 'node:util'; import { @@ -22,6 +23,13 @@ import { ciIt } from '../helpers/suite'; const runCommand = promisify(execFile); const describeSpark = process.env.BITKIT_LOCAL_SPARK === '1' ? describe : describe.skip; +function reportSparkCase(status: 'started' | 'passed') { + const output = process.env.GITHUB_OUTPUT; + if (output) { + appendFileSync(output, `spark-case=${status}\n`); + } +} + async function openSparkConnection() { await openSettings('advanced'); await tapAndExpect({ id: 'Channels' }, { anyVisible: [{ id: 'SparkConnection' }] }); @@ -36,6 +44,7 @@ async function openSparkConnection() { describeSpark('Spark on local regtest', () => { ciIt('@spark_1 - Receive a Lightning payment into Spark', async () => { + reportSparkCase('started'); await reinstallApp(); await completeOnboarding(); @@ -64,5 +73,6 @@ describeSpark('Spark on local regtest', () => { await openSparkConnection(); expect(await getAmountUnder('SparkBalance')).toBe(10_000); + reportSparkCase('passed'); }); }); From 08a6508fdf91ee3361c1d02cd11ebfd8c7d905c3 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 20 Nov 2026 09:10:14 +0100 Subject: [PATCH 15/18] Distinguish Spark setup and interrupted case results --- scripts/slack_summary.py | 11 ++++++++--- scripts/test_slack_summary.py | 28 ++++++++++++++++++---------- test/specs/spark.e2e.ts | 27 ++++++++++++++++++++------- 3 files changed, 46 insertions(+), 20 deletions(-) diff --git a/scripts/slack_summary.py b/scripts/slack_summary.py index 8851201e..41ad47ee 100755 --- a/scripts/slack_summary.py +++ b/scripts/slack_summary.py @@ -52,7 +52,7 @@ def get_status_icon(status: str) -> str: return ":white_check_mark:" elif status_lower == "failure": return ":x:" - elif status_lower == "cancelled": + elif status_lower in ("cancelled", "interrupted"): return ":warning:" elif status_lower in ("skipped", "did not run"): return ":fast_forward:" @@ -157,8 +157,13 @@ def render_e2e_local_nightly_message() -> str: "Spark fixture": os.environ.get("SPARK_FIXTURE_RESULT", ""), } tests_result = os.environ.get("E2E_TESTS_RESULT", "unknown") - case_result = os.environ.get("SPARK_CASE_RESULT") or "no result" - if tests_result == "cancelled" and case_result != "success": + case_result = { + "passed": "success", + "failed": "failure", + "started": "interrupted", + "setup": "did not run", + }.get(os.environ.get("SPARK_CASE_RESULT"), "no result") + if tests_result == "cancelled" and case_result in ("interrupted", "no result"): case_result = "cancelled" elif case_result == "no result" and (tests_result == "skipped" or any( result in ("failure", "skipped") for result in setup.values() diff --git a/scripts/test_slack_summary.py b/scripts/test_slack_summary.py index 7621a241..5ff895fc 100644 --- a/scripts/test_slack_summary.py +++ b/scripts/test_slack_summary.py @@ -215,7 +215,7 @@ def test_android_pass_links_to_run_and_checked_out_ref(self): "BUILD_RESULT": "success", "SPARK_FIXTURE_RESULT": "success", "E2E_TESTS_RESULT": "success", - "SPARK_CASE_RESULT": "success", + "SPARK_CASE_RESULT": "passed", "RUN_URL": "https://github.com/synonymdev/bitkit-android/actions/runs/123", "RUN_ATTEMPT": "2", "E2E_TESTS_REF": "abc123", @@ -244,28 +244,36 @@ def test_ios_failure_before_appium(self): def test_case_result_distinguishes_test_failure_from_later_job_failure(self): os.environ.update({"LOCAL_NIGHTLY_RESULT": "failure", "E2E_TESTS_RESULT": "failure"}) - for result, icon in (("failure", ":x:"), ("success", ":white_check_mark:")): - with self.subTest(result=result): - os.environ["SPARK_CASE_RESULT"] = result + cases = ( + ("failed", ":x: failure"), + ("passed", ":white_check_mark: success"), + ("started", ":warning: interrupted"), + ("setup", ":fast_forward: did not run"), + ) + for case_status, display in cases: + with self.subTest(case_status=case_status): + os.environ["SPARK_CASE_RESULT"] = case_status message = render_e2e_local_nightly_message() self.assertIn("e2e-spark: :x: failure", message) - self.assertIn(f"@spark_1: {icon} {result}", message) + self.assertIn(f"@spark_1: {display}", message) def test_cancelled_job_matches_the_final_case_outcome(self): - os.environ.update({ - "E2E_TESTS_RESULT": "cancelled", - "SPARK_CASE_RESULT": "failure", - }) + os.environ.update({"E2E_TESTS_RESULT": "cancelled", "SPARK_CASE_RESULT": "started"}) message = render_e2e_local_nightly_message() self.assertIn("@spark_1: :warning: cancelled", message) + os.environ["SPARK_CASE_RESULT"] = "failed" + message = render_e2e_local_nightly_message() + self.assertIn("e2e-spark: :warning: cancelled", message) + self.assertIn("@spark_1: :x: failure", message) + def test_older_e2e_ref_without_case_output_has_no_confirmed_result(self): os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "E2E_TESTS_RESULT": "success"}) message = render_e2e_local_nightly_message() self.assertIn("@spark_1: :grey_question: no result", message) def test_cli_posts_one_summary(self): - os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "SPARK_CASE_RESULT": "success"}) + os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "SPARK_CASE_RESULT": "passed"}) with patch("sys.argv", ["slack_summary.py", "e2e-local-nightly"]), \ patch("sys.stdout", new=io.StringIO()), \ patch("slack_summary.post_to_slack", return_value=True) as post: diff --git a/test/specs/spark.e2e.ts b/test/specs/spark.e2e.ts index 8d07b3cf..b4f1b7bb 100644 --- a/test/specs/spark.e2e.ts +++ b/test/specs/spark.e2e.ts @@ -23,10 +23,13 @@ import { ciIt } from '../helpers/suite'; const runCommand = promisify(execFile); const describeSpark = process.env.BITKIT_LOCAL_SPARK === '1' ? describe : describe.skip; -function reportSparkCase(status: 'started' | 'passed') { +function reportSparkCase(status: 'setup' | 'started' | 'passed' | 'failed') { const output = process.env.GITHUB_OUTPUT; - if (output) { + if (!output) return; + try { appendFileSync(output, `spark-case=${status}\n`); + } catch (error) { + console.warn('Could not record Spark case status', error); } } @@ -43,11 +46,7 @@ async function openSparkConnection() { } describeSpark('Spark on local regtest', () => { - ciIt('@spark_1 - Receive a Lightning payment into Spark', async () => { - reportSparkCase('started'); - await reinstallApp(); - await completeOnboarding(); - + async function receiveLightningPayment() { await openSparkConnection(); expect(await getAmountUnder('SparkBalance')).toBe(0); await doNavigationClose(); @@ -73,6 +72,20 @@ describeSpark('Spark on local regtest', () => { await openSparkConnection(); expect(await getAmountUnder('SparkBalance')).toBe(10_000); + } + + ciIt('@spark_1 - Receive a Lightning payment into Spark', async () => { + reportSparkCase('setup'); + await reinstallApp(); + await completeOnboarding(); + + reportSparkCase('started'); + try { + await receiveLightningPayment(); + } catch (error) { + reportSparkCase('failed'); + throw error; + } reportSparkCase('passed'); }); }); From b7e445ad080827421f427fd26ae04b1782d8409c Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 20 Nov 2026 09:13:30 +0100 Subject: [PATCH 16/18] Keep Spark app setup and case results distinct --- scripts/slack_summary.py | 11 ++++++----- scripts/test_slack_summary.py | 15 ++++++++++++++- test/specs/spark.e2e.ts | 11 ++++++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/scripts/slack_summary.py b/scripts/slack_summary.py index 41ad47ee..4f288cdf 100755 --- a/scripts/slack_summary.py +++ b/scripts/slack_summary.py @@ -26,6 +26,7 @@ LOCAL_NIGHTLY_RESULT - Overall result for e2e-local-nightly SPARK_IMAGES_RESULT - Optional iOS image preparation result SPARK_FIXTURE_RESULT - Local Spark fixture startup result + SPARK_APP_SETUP_RESULT - Failure or interruption preparing the app on a Spark attempt SPARK_CASE_RESULT - Final result reported for @spark_1 Optional env vars: @@ -155,20 +156,20 @@ def render_e2e_local_nightly_message() -> str: "spark-images": os.environ.get("SPARK_IMAGES_RESULT", ""), "app build": os.environ.get("BUILD_RESULT", ""), "Spark fixture": os.environ.get("SPARK_FIXTURE_RESULT", ""), + "Spark app setup (one or more attempts)": os.environ.get("SPARK_APP_SETUP_RESULT", ""), } tests_result = os.environ.get("E2E_TESTS_RESULT", "unknown") case_result = { "passed": "success", "failed": "failure", "started": "interrupted", - "setup": "did not run", }.get(os.environ.get("SPARK_CASE_RESULT"), "no result") - if tests_result == "cancelled" and case_result in ("interrupted", "no result"): - case_result = "cancelled" - elif case_result == "no result" and (tests_result == "skipped" or any( - result in ("failure", "skipped") for result in setup.values() + if case_result == "no result" and (tests_result == "skipped" or any( + result in ("failure", "skipped", "interrupted") for result in setup.values() )): case_result = "did not run" + elif tests_result == "cancelled" and case_result in ("interrupted", "no result"): + case_result = "cancelled" return _render_message( kind="local nightly", overall_result=os.environ.get("LOCAL_NIGHTLY_RESULT", "unknown"), diff --git a/scripts/test_slack_summary.py b/scripts/test_slack_summary.py index 5ff895fc..a7799378 100644 --- a/scripts/test_slack_summary.py +++ b/scripts/test_slack_summary.py @@ -248,7 +248,6 @@ def test_case_result_distinguishes_test_failure_from_later_job_failure(self): ("failed", ":x: failure"), ("passed", ":white_check_mark: success"), ("started", ":warning: interrupted"), - ("setup", ":fast_forward: did not run"), ) for case_status, display in cases: with self.subTest(case_status=case_status): @@ -257,6 +256,20 @@ def test_case_result_distinguishes_test_failure_from_later_job_failure(self): self.assertIn("e2e-spark: :x: failure", message) self.assertIn(f"@spark_1: {display}", message) + def test_app_setup_failure_and_case_result_are_independent(self): + os.environ["SPARK_APP_SETUP_RESULT"] = "failure" + cases = ( + ("", ":fast_forward: did not run"), + ("failed", ":x: failure"), + ("passed", ":white_check_mark: success"), + ) + for case_status, display in cases: + with self.subTest(case_status=case_status): + os.environ["SPARK_CASE_RESULT"] = case_status + message = render_e2e_local_nightly_message() + self.assertIn("Spark app setup (one or more attempts): :x: failure", message) + self.assertIn(f"@spark_1: {display}", message) + def test_cancelled_job_matches_the_final_case_outcome(self): os.environ.update({"E2E_TESTS_RESULT": "cancelled", "SPARK_CASE_RESULT": "started"}) message = render_e2e_local_nightly_message() diff --git a/test/specs/spark.e2e.ts b/test/specs/spark.e2e.ts index b4f1b7bb..80e89a30 100644 --- a/test/specs/spark.e2e.ts +++ b/test/specs/spark.e2e.ts @@ -23,7 +23,7 @@ import { ciIt } from '../helpers/suite'; const runCommand = promisify(execFile); const describeSpark = process.env.BITKIT_LOCAL_SPARK === '1' ? describe : describe.skip; -function reportSparkCase(status: 'setup' | 'started' | 'passed' | 'failed') { +function reportSparkCase(status: 'setup' | 'setup-failed' | 'started' | 'passed' | 'failed') { const output = process.env.GITHUB_OUTPUT; if (!output) return; try { @@ -76,8 +76,13 @@ describeSpark('Spark on local regtest', () => { ciIt('@spark_1 - Receive a Lightning payment into Spark', async () => { reportSparkCase('setup'); - await reinstallApp(); - await completeOnboarding(); + try { + await reinstallApp(); + await completeOnboarding(); + } catch (error) { + reportSparkCase('setup-failed'); + throw error; + } reportSparkCase('started'); try { From 1ae6c76a96a82e311da6baaf4da374ce32b0251d Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 20 Nov 2026 11:47:06 +0100 Subject: [PATCH 17/18] Match local nightly Slack summaries to staging --- scripts/slack_summary.py | 42 ++++++---------------- scripts/test_slack_summary.py | 68 +++++++---------------------------- test/specs/spark.e2e.ts | 36 +++---------------- 3 files changed, 26 insertions(+), 120 deletions(-) diff --git a/scripts/slack_summary.py b/scripts/slack_summary.py index 4f288cdf..eab253a6 100755 --- a/scripts/slack_summary.py +++ b/scripts/slack_summary.py @@ -25,9 +25,6 @@ PREPARE_WALLETS_RESULT - Optional iOS migration job result LOCAL_NIGHTLY_RESULT - Overall result for e2e-local-nightly SPARK_IMAGES_RESULT - Optional iOS image preparation result - SPARK_FIXTURE_RESULT - Local Spark fixture startup result - SPARK_APP_SETUP_RESULT - Failure or interruption preparing the app on a Spark attempt - SPARK_CASE_RESULT - Final result reported for @spark_1 Optional env vars: E2E_TESTS_REF - Resolved e2e-tests branch/ref @@ -53,9 +50,9 @@ def get_status_icon(status: str) -> str: return ":white_check_mark:" elif status_lower == "failure": return ":x:" - elif status_lower in ("cancelled", "interrupted"): + elif status_lower == "cancelled": return ":warning:" - elif status_lower in ("skipped", "did not run"): + elif status_lower == "skipped": return ":fast_forward:" else: return ":grey_question:" @@ -83,8 +80,6 @@ def _render_message( kind: str, overall_result: str, jobs: dict[str, str], - case: tuple[str, str] | None = None, - results_heading: str = "Jobs", ) -> str: platform = os.environ.get("PLATFORM", "") run_url = os.environ.get("RUN_URL", "") @@ -112,11 +107,8 @@ def _render_message( lines.append(f"Repository: {repo}") lines.append("") - lines.append(f"{results_heading}:") + lines.append("Jobs:") lines.extend(f" {job}: {format_status(result)}" for job, result in jobs.items()) - if case: - name, result = case - lines.append(f"\n{name}: {format_status(result)}") return "\n".join(lines) @@ -152,30 +144,16 @@ def render_e2e_migration_message() -> str: def render_e2e_local_nightly_message() -> str: - setup = { - "spark-images": os.environ.get("SPARK_IMAGES_RESULT", ""), - "app build": os.environ.get("BUILD_RESULT", ""), - "Spark fixture": os.environ.get("SPARK_FIXTURE_RESULT", ""), - "Spark app setup (one or more attempts)": os.environ.get("SPARK_APP_SETUP_RESULT", ""), - } - tests_result = os.environ.get("E2E_TESTS_RESULT", "unknown") - case_result = { - "passed": "success", - "failed": "failure", - "started": "interrupted", - }.get(os.environ.get("SPARK_CASE_RESULT"), "no result") - if case_result == "no result" and (tests_result == "skipped" or any( - result in ("failure", "skipped", "interrupted") for result in setup.values() - )): - case_result = "did not run" - elif tests_result == "cancelled" and case_result in ("interrupted", "no result"): - case_result = "cancelled" + jobs = {} + for job, variable in (("spark-images", "SPARK_IMAGES_RESULT"), ("build-spark-ios", "BUILD_RESULT")): + result = os.environ.get(variable) + if result: + jobs[job] = result + jobs["e2e-spark"] = os.environ.get("E2E_TESTS_RESULT", "unknown") return _render_message( kind="local nightly", overall_result=os.environ.get("LOCAL_NIGHTLY_RESULT", "unknown"), - jobs={job: result for job, result in {**setup, "e2e-spark": tests_result}.items() if result}, - case=("@spark_1", case_result), - results_heading="Stages", + jobs=jobs, ) diff --git a/scripts/test_slack_summary.py b/scripts/test_slack_summary.py index a7799378..cad6f4a5 100644 --- a/scripts/test_slack_summary.py +++ b/scripts/test_slack_summary.py @@ -208,91 +208,47 @@ def setUp(self): env_patcher.start() self.addCleanup(env_patcher.stop) - def test_android_pass_links_to_run_and_checked_out_ref(self): + def test_android_summary_has_one_job(self): os.environ.update({ "PLATFORM": "android", "LOCAL_NIGHTLY_RESULT": "success", - "BUILD_RESULT": "success", - "SPARK_FIXTURE_RESULT": "success", "E2E_TESTS_RESULT": "success", - "SPARK_CASE_RESULT": "passed", "RUN_URL": "https://github.com/synonymdev/bitkit-android/actions/runs/123", "RUN_ATTEMPT": "2", "E2E_TESTS_REF": "abc123", }) message = render_e2e_local_nightly_message() self.assertIn(":white_check_mark: Bitkit Android E2E local nightly: success", message) - self.assertIn("@spark_1: :white_check_mark: success", message) self.assertIn("Run: https://github.com/synonymdev/bitkit-android/actions/runs/123", message) self.assertIn("Run attempt: 2", message) self.assertIn("E2E tests ref: abc123", message) - self.assertNotIn("spark-images", message) + self.assertEqual(message.split("Jobs:\n", 1)[1], " e2e-spark: :white_check_mark: success") - def test_ios_failure_before_appium(self): + def test_ios_summary_distinguishes_failed_setup_from_skipped_e2e(self): os.environ.update({ "PLATFORM": "ios", "LOCAL_NIGHTLY_RESULT": "failure", "SPARK_IMAGES_RESULT": "success", - "BUILD_RESULT": "success", - "SPARK_FIXTURE_RESULT": "failure", - "E2E_TESTS_RESULT": "failure", + "BUILD_RESULT": "failure", + "E2E_TESTS_RESULT": "skipped", }) message = render_e2e_local_nightly_message() self.assertIn(":x: Bitkit iOS E2E local nightly: failure", message) - self.assertIn("Spark fixture: :x: failure", message) - self.assertIn("@spark_1: :fast_forward: did not run", message) - - def test_case_result_distinguishes_test_failure_from_later_job_failure(self): - os.environ.update({"LOCAL_NIGHTLY_RESULT": "failure", "E2E_TESTS_RESULT": "failure"}) - cases = ( - ("failed", ":x: failure"), - ("passed", ":white_check_mark: success"), - ("started", ":warning: interrupted"), - ) - for case_status, display in cases: - with self.subTest(case_status=case_status): - os.environ["SPARK_CASE_RESULT"] = case_status - message = render_e2e_local_nightly_message() - self.assertIn("e2e-spark: :x: failure", message) - self.assertIn(f"@spark_1: {display}", message) - - def test_app_setup_failure_and_case_result_are_independent(self): - os.environ["SPARK_APP_SETUP_RESULT"] = "failure" - cases = ( - ("", ":fast_forward: did not run"), - ("failed", ":x: failure"), - ("passed", ":white_check_mark: success"), + self.assertEqual( + message.split("Jobs:\n", 1)[1].splitlines(), + [" spark-images: :white_check_mark: success", + " build-spark-ios: :x: failure", + " e2e-spark: :fast_forward: skipped"], ) - for case_status, display in cases: - with self.subTest(case_status=case_status): - os.environ["SPARK_CASE_RESULT"] = case_status - message = render_e2e_local_nightly_message() - self.assertIn("Spark app setup (one or more attempts): :x: failure", message) - self.assertIn(f"@spark_1: {display}", message) - - def test_cancelled_job_matches_the_final_case_outcome(self): - os.environ.update({"E2E_TESTS_RESULT": "cancelled", "SPARK_CASE_RESULT": "started"}) - message = render_e2e_local_nightly_message() - self.assertIn("@spark_1: :warning: cancelled", message) - - os.environ["SPARK_CASE_RESULT"] = "failed" - message = render_e2e_local_nightly_message() - self.assertIn("e2e-spark: :warning: cancelled", message) - self.assertIn("@spark_1: :x: failure", message) - - def test_older_e2e_ref_without_case_output_has_no_confirmed_result(self): - os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "E2E_TESTS_RESULT": "success"}) - message = render_e2e_local_nightly_message() - self.assertIn("@spark_1: :grey_question: no result", message) def test_cli_posts_one_summary(self): - os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "SPARK_CASE_RESULT": "passed"}) + os.environ.update({"LOCAL_NIGHTLY_RESULT": "success", "E2E_TESTS_RESULT": "success"}) with patch("sys.argv", ["slack_summary.py", "e2e-local-nightly"]), \ patch("sys.stdout", new=io.StringIO()), \ patch("slack_summary.post_to_slack", return_value=True) as post: self.assertEqual(main(), 0) post.assert_called_once() - self.assertIn("@spark_1: :white_check_mark: success", post.call_args.args[0]) + self.assertIn("e2e-spark: :white_check_mark: success", post.call_args.args[0]) class TestPostToSlack(unittest.TestCase): diff --git a/test/specs/spark.e2e.ts b/test/specs/spark.e2e.ts index 80e89a30..67f36a6d 100644 --- a/test/specs/spark.e2e.ts +++ b/test/specs/spark.e2e.ts @@ -1,5 +1,4 @@ import { execFile } from 'node:child_process'; -import { appendFileSync } from 'node:fs'; import { resolve } from 'node:path'; import { promisify } from 'node:util'; import { @@ -23,16 +22,6 @@ import { ciIt } from '../helpers/suite'; const runCommand = promisify(execFile); const describeSpark = process.env.BITKIT_LOCAL_SPARK === '1' ? describe : describe.skip; -function reportSparkCase(status: 'setup' | 'setup-failed' | 'started' | 'passed' | 'failed') { - const output = process.env.GITHUB_OUTPUT; - if (!output) return; - try { - appendFileSync(output, `spark-case=${status}\n`); - } catch (error) { - console.warn('Could not record Spark case status', error); - } -} - async function openSparkConnection() { await openSettings('advanced'); await tapAndExpect({ id: 'Channels' }, { anyVisible: [{ id: 'SparkConnection' }] }); @@ -46,7 +35,10 @@ async function openSparkConnection() { } describeSpark('Spark on local regtest', () => { - async function receiveLightningPayment() { + ciIt('@spark_1 - Receive a Lightning payment into Spark', async () => { + await reinstallApp(); + await completeOnboarding(); + await openSparkConnection(); expect(await getAmountUnder('SparkBalance')).toBe(0); await doNavigationClose(); @@ -72,25 +64,5 @@ describeSpark('Spark on local regtest', () => { await openSparkConnection(); expect(await getAmountUnder('SparkBalance')).toBe(10_000); - } - - ciIt('@spark_1 - Receive a Lightning payment into Spark', async () => { - reportSparkCase('setup'); - try { - await reinstallApp(); - await completeOnboarding(); - } catch (error) { - reportSparkCase('setup-failed'); - throw error; - } - - reportSparkCase('started'); - try { - await receiveLightningPayment(); - } catch (error) { - reportSparkCase('failed'); - throw error; - } - reportSparkCase('passed'); }); }); From 0bffc496df361d0e24c12f93c5c4a6dcea0afb17 Mon Sep 17 00:00:00 2001 From: Piotr Stachyra Date: Fri, 20 Nov 2026 12:26:51 +0100 Subject: [PATCH 18/18] Default iOS simulator builds to arm64 --- scripts/build-ios-sim.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/build-ios-sim.sh b/scripts/build-ios-sim.sh index 78ec03cc..7d77290b 100755 --- a/scripts/build-ios-sim.sh +++ b/scripts/build-ios-sim.sh @@ -4,7 +4,7 @@ # Inputs/roots: # - E2E root: this repo (bitkit-e2e-tests) # - iOS root: $IOS_ROOT, or ../bitkit-ios if unset -# - Simulator architecture: $IOS_SIMULATOR_ARCH, or Xcode's default if unset +# - Simulator architecture: $IOS_SIMULATOR_ARCH, defaulting to arm64 for BitkitCore # # Output: # - Copies Debug iphonesimulator build: Bitkit.app -> aut/Bitkit.app @@ -39,6 +39,7 @@ else fi XCODE_EXTRA_ARGS+=( + "ARCHS=${IOS_SIMULATOR_ARCH:-arm64}" "E2E_BACKEND=$E2E_BACKEND" "E2E_NETWORK=$E2E_NETWORK" "TREZOR_BRIDGE=$TREZOR_BRIDGE" @@ -61,10 +62,6 @@ if [[ -n "${SOURCE_PACKAGES:-}" ]]; then ) fi -if [[ -n "${IOS_SIMULATOR_ARCH:-}" ]]; then - XCODE_EXTRA_ARGS+=("ARCHS=$IOS_SIMULATOR_ARCH") -fi - # Embed fixture endpoints so they survive Appium reinstalls and app relaunches. for key in USDT_RPC_URL USDT_BUNDLER_URL USDT_DEPOSITS_URL USDT_BRIDGES_URL USDT_BRIDGE_NETWORKS \ SPARK_LOCAL_CONFIG_B64 SPARK_LOCAL_CHAIN_URL; do