Harden E2E workflows with Ultra Redroid/iOS runners, sharding, health checks, and PGP traces (#3919)
What changed, and why it matters
This commit updates Cake Wallet's automated end-to-end (E2E) testing GitHub workflows. It changes which test runners are used, adds sharding (running tests in parallel pieces), adds a health check for an internal AI router, switches encrypted test logs from password-based AES encryption to PGP encryption, and tightens workflow permissions. Most changes are operational hardening, but a few security-relevant details appear: secrets are now passed through environment variables instead of being interpolated into shell scripts, PGP keys are read from repository variables rather than secrets, and workflow permissions are reduced. There is no direct evidence in the diff that these changes fix an active vulnerability; they look like preventive hardening of CI/CD infrastructure.
Treat as a routine CI/CD hardening update. Reviewers should verify that vars.QA_ARTIFACT_PGP_KEYS is populated with only intended recipient public keys, that the self-hosted runner labels are correctly secured, and that the new health-check endpoint and API key handling do not leak secrets in logs. No immediate application-level security response is indicated by the diff alone.
Security signals we found
Secrets removed from shell script interpolation and passed via env (reduces secret exposure in process listings and shell logs)
Trace encryption switched from symmetric AES passphrase (secret) to asymmetric PGP keys (variable)
Workflow permissions narrowed: top-level contents: read only; actions: write limited to resolve job; pull-requests: write limited to report job
junit.xml moved from public artifact uploads into encrypted trace archives
include-hidden-files: true added to artifact uploads so test output directories are not silently skipped
Branch-scoped test packages uninstalled before APK install to prevent stale package collisions
Health check added to fail fast on LLM router outage before starting emulator/simulator
Evidence from the diff
The patch modifies .github/workflows/e2e_android.yml, e2e_cache_nightly.yml, and e2e_ios.yml. Key technical changes: (1) runner defaults switch from ubuntu-latest to self-hosted cake-ultra-android-qa (Redroid/arm64) and cake-m5-ultra/cake-ios-qa for iOS; (2) test matrices are sharded (4-way Android Ultra, 3-way Android hosted/iOS); (3) a pre-flight curl to https://llm.cakewallet.com/v1/models is added, authenticating with secrets.LLM_API_KEY or secrets.DSPARK_API_KEY; (4) trace encryption changes from openssl aes-256-cbc -pass env:QA_ARTIFACT_PASSPHRASE to gpg –encrypt using vars.QA_ARTIFACT_PGP_KEYS; (5) junit.xml is moved out of public artifact uploads into the encrypted trace archive; (6) E2E_SECRET_WALLET_PASSPHRASE and other secrets are passed via env and ${{ }} interpolations are removed from shell blocks; (7) top-level permissions in e2e_android.yml are narrowed to contents: read, with actions: write scoped to the resolve job and pull-requests: write + actions: read scoped to the report job; (8) include-hidden-files: true is set on upload-artifact so .e2e directories are captured; (9) leftover com.cakewallet.test_* packages are uninstalled before installing the test APK. The commit does not change application source code, wallet cryptography, or network protocols.
Changed components
.github/workflows/e2e_android.yml.github/workflows/e2e_cache_nightly.yml.github/workflows/e2e_ios.ymlInspect captured patch +507 / −142
### .github/workflows/e2e_android.yml
@@ -11,15 +11,15 @@ on:
workflow_dispatch:
inputs:
runs_on:
- description: "runner label: ubuntu-latest (hosted KVM) or a self-hosted label"
+ description: "runner label: cake-ultra-android-qa (Redroid arm64) or ubuntu-latest (hosted KVM x86_64)"
type: string
- default: ubuntu-latest
+ default: cake-ultra-android-qa
build_run:
- description: "pr_test_build run id whose x86_64 APK artifact to test (empty = auto-resolve from the head SHA)"
+ description: "pr_test_build run id whose APK artifact to test (empty = auto-resolve from the head SHA)"
type: string
default: ""
shard:
- description: "e.g. 2/3 (empty = single run)"
+ description: "e.g. 2/4 (empty = 4-way shard matrix on Ultra or 3-way on ubuntu-latest)"
type: string
default: ""
qa_ref:
@@ -39,10 +39,6 @@ on:
permissions:
contents: read
- pull-requests: write
- # the resolve job's auto-retry runs `gh run rerun --failed`; without this the
- # 403 was swallowed by `|| true` and the retry silently never happened.
- actions: write
concurrency:
group: e2e-android-${{ github.event.pull_request.number || github.ref }}
@@ -54,34 +50,43 @@ jobs:
# AND integration tests (~90min), and keeping the wait in the suite job
# blew GitHub's 4h job cap before the suite even started.
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.fork == false
- runs-on: ${{ inputs.runs_on || 'ubuntu-latest' }}
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ actions: write
# REPORT-ONLY (a red step must not block; never a required check).
continue-on-error: true
timeout-minutes: 215
outputs:
run_id: ${{ steps.resolve.outputs.run_id }}
+ shards: ${{ steps.resolve.outputs.shards }}
steps:
- name: Resolve and download the build artifact
id: resolve
- # Criterion = OWNING an x86_64 APK artifact ("<branch>_x86.apk"; "android apk" on older runs); the run's conclusion can
- # be failure after the upload (learned on the 6.5.0 RC). No dev fallback.
env:
GH_TOKEN: ${{ github.token }}
+ INPUT_BUILD_RUN: ${{ inputs.build_run }}
+ INPUT_SHARD: ${{ inputs.shard }}
+ INPUT_GREP: ${{ inputs.grep }}
+ TARGET_RUNNER: ${{ inputs.runs_on || 'cake-ultra-android-qa' }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
set -euo pipefail
- RUN_ID="${{ inputs.build_run }}"
+ if [ "$TARGET_RUNNER" = "ubuntu-latest" ]; then
+ ARCH=x86_64
+ JQ_FILTER='[.artifacts[] | select(.expired == false) | .name | select(. == "android apk" or endswith("_x86.apk"))][0] // empty'
+ else
+ ARCH=arm64
+ JQ_FILTER='[.artifacts[] | select(.expired == false) | .name | select(endswith(".apk") and (endswith("_x86.apk") | not) and (endswith("_v7a.apk") | not))][0] // empty'
+ fi
+ RUN_ID="$INPUT_BUILD_RUN"
if [ -z "$RUN_ID" ]; then
- SHA="${{ github.event.pull_request.head.sha || github.sha }}"
+ SHA="$HEAD_SHA"
RERUN_TRIED=0
LOG_TRIES=0
- # The e2e lane starts in parallel with pr_test_build — WAIT for a
- # run that owns the artifact instead of racing it (learned on
- # PR #3700's first attempt). It gives up at the deadline below or
- # as soon as it can tell no artifact is coming.
- DEADLINE=$(( $(date +%s) + 11400 )) # builds observed 60-190min; job timeout is 210min
+ DEADLINE=$(( $(date +%s) + 11400 ))
while :; do
- RUNS=$(gh api "repos/${{ github.repository }}/actions/workflows/pr_test_build_android.yml/runs?head_sha=${SHA}&per_page=10" --jq '.workflow_runs[] | "\(.id) \(.status) \(.conclusion // "running")"') || {
- # A failed API call is a blip, not "no build": wait and ask again until the deadline.
+ RUNS=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/pr_test_build_android.yml/runs?head_sha=${SHA}&per_page=10" --jq '.workflow_runs[] | "\(.id) \(.status) \(.conclusion // "running")"') || {
if [ "$(date +%s)" -ge "$DEADLINE" ]; then echo "::error::timed out waiting for the pr_test_build artifact for ${SHA}"; exit 1; fi
echo "::warning::listing pr_test_build runs failed; retrying"
sleep 30
@@ -91,18 +96,17 @@ jobs:
while read -r id status conclusion; do
[ -z "$id" ] && continue
[ "$status" = "completed" ] || ALL_FINISHED=0
- if [ "$(gh api "repos/${{ github.repository }}/actions/runs/${id}/artifacts" --jq '[.artifacts[] | select(.expired == false) | .name | select(. == "android apk" or endswith("_x86.apk"))] | length > 0')" = "true" ]; then
+ if [ -n "$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/${id}/artifacts" --jq "$JQ_FILTER")" ]; then
RUN_ID=$id
break
fi
done <<< "$RUNS"
[ -n "$RUN_ID" ] && break
if [ "$ALL_FINISHED" = "1" ] && [ -n "$RUNS" ]; then
NEWEST=$(echo "$RUNS" | head -n 1 | awk '{print $1}')
- # The failed log can lag the run's completion: an empty or failed download is retried, not read as "not the flake".
FAILED_LOG=""
if [ "$RERUN_TRIED" -eq 0 ]; then
- FAILED_LOG=$(gh run view "$NEWEST" --log-failed -R "${{ github.repository }}" 2>/dev/null || true)
+ FAILED_LOG=$(gh run view "$NEWEST" --log-failed -R "$GITHUB_REPOSITORY" 2>/dev/null || true)
if [ -z "$FAILED_LOG" ] && [ "$LOG_TRIES" -lt 5 ]; then
LOG_TRIES=$((LOG_TRIES + 1))
sleep 30
@@ -111,13 +115,13 @@ jobs:
fi
if [ "$RERUN_TRIED" -eq 0 ] && grep -q 'IncrementalSplitterRunnable' <<< "$FAILED_LOG"; then
echo "::warning::pr_test_build for ${SHA} hit the gradle packageRelease/IncrementalSplitterRunnable flake — retrying its failed jobs once"
- gh run rerun "$NEWEST" --failed -R "${{ github.repository }}" || true
+ gh run rerun "$NEWEST" --failed -R "$GITHUB_REPOSITORY" || true
RERUN_TRIED=1
else
- echo "::error::pr_test_build for ${SHA} finished without an x86_64 APK artifact and it is not the packageRelease flake, or its one retry already ran (no dev fallback, per handoff)"
+ echo "::error::pr_test_build for ${SHA} finished without a ${ARCH} APK artifact and it is not the packageRelease flake, or its one retry already ran"
exit 1
fi
- elif [ -z "$RUNS" ] && [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
+ elif [ -z "$RUNS" ] && [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
echo "::error::no pr_test_build run for ${SHA}; pass build_run or dispatch on a branch with an open PR"
exit 1
fi
@@ -129,38 +133,74 @@ jobs:
done
fi
if [ -z "$RUN_ID" ]; then
- echo "::error::no pr_test_build run with an x86_64 APK artifact for this ref (no dev fallback, per handoff)"
+ echo "::error::no pr_test_build run with a ${ARCH} APK artifact for this ref"
exit 1
fi
echo "BUILD_RUN=$RUN_ID" >> "$GITHUB_ENV"
- ART=$(gh api "repos/${{ github.repository }}/actions/runs/${RUN_ID}/artifacts" --jq '[.artifacts[] | select(.expired == false) | .name | select(. == "android apk" or endswith("_x86.apk"))][0] // empty')
- [ -n "$ART" ] || { echo "::error::run ${RUN_ID} has no x86_64 APK artifact"; exit 1; }
- gh run download "$RUN_ID" -n "$ART" -D apk -R "${{ github.repository }}"
- # The build names the x86_64 APK after its branch (<branch>_x86.apk); the suite installs one fixed name.
- [ -f apk/app-x86_64-release.apk ] || mv "$(ls apk/*_x86.apk | head -n 1)" apk/app-x86_64-release.apk
- test -f apk/app-x86_64-release.apk || { echo "::error::app-x86_64-release.apk missing from artifact"; exit 1; }
+ ART=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/${RUN_ID}/artifacts" --jq "$JQ_FILTER")
+ [ -n "$ART" ] || { echo "::error::run ${RUN_ID} has no ${ARCH} APK artifact"; exit 1; }
+ gh run download "$RUN_ID" -n "$ART" -D apk-dl -R "$GITHUB_REPOSITORY"
+ mkdir -p apk
+ if [ "$ARCH" = "x86_64" ]; then
+ APK_SRC=$([ -f apk-dl/app-x86_64-release.apk ] && echo apk-dl/app-x86_64-release.apk || find apk-dl -maxdepth 2 -name '*_x86.apk' | head -n 1)
+ else
+ APK_SRC=$([ -f apk-dl/app-arm64-v8a-release.apk ] && echo apk-dl/app-arm64-v8a-release.apk || find apk-dl -maxdepth 2 -name '*.apk' ! -name '*_x86.apk' ! -name '*_v7a.apk' ! -name '*x86_64*' ! -name '*armeabi-v7a*' | head -n 1)
+ fi
+ [ -n "$APK_SRC" ] && [ -f "$APK_SRC" ] || { echo "::error::${ARCH} APK missing from artifact ${ART}"; exit 1; }
+ mv "$APK_SRC" apk/app-release.apk
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
-
+ if [ -n "$INPUT_SHARD" ]; then
+ python3 -c 'import json,os; print("shards=" + json.dumps([os.environ["INPUT_SHARD"]]))' >> "$GITHUB_OUTPUT"
+ elif [ -n "$INPUT_GREP" ]; then
+ echo 'shards=["1/1"]' >> "$GITHUB_OUTPUT"
+ elif [ "$TARGET_RUNNER" = "ubuntu-latest" ]; then
+ echo 'shards=["1/3","2/3","3/3"]' >> "$GITHUB_OUTPUT"
+ else
+ echo 'shards=["1/4","2/4","3/4","4/4"]' >> "$GITHUB_OUTPUT"
+ fi
- name: Hand the APK to the suite job
uses: actions/upload-artifact@v4
with:
name: e2e-apk
- path: apk/
+ path: apk/app-release.apk
+ retention-days: 1
if-no-files-found: error
e2e:
needs: resolve
- # Suite only when resolve handed us an artifact (its run_id output).
if: >-
needs.resolve.outputs.run_id != '' &&
(github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.fork == false)
- runs-on: ${{ inputs.runs_on || 'ubuntu-latest' }}
+ runs-on: ${{ fromJSON((inputs.runs_on || 'cake-ultra-android-qa') == 'cake-ultra-android-qa' && '["self-hosted","Linux","ARM64","cake-ultra-android-qa"]' || toJSON(inputs.runs_on)) }}
environment: qa
- # REPORT-ONLY, permanently until Seth says otherwise.
continue-on-error: true
- timeout-minutes: 210
+ timeout-minutes: 110
+ strategy:
+ fail-fast: false
+ matrix:
+ shard: ${{ fromJSON(needs.resolve.outputs.shards || '["1/4","2/4","3/4","4/4"]') }}
steps:
+ - name: Check LLM router health
+ env:
+ GLM_BASE_URL: https://llm.cakewallet.com/v1
+ GLM_API_KEY: ${{ secrets.LLM_API_KEY || secrets.DSPARK_API_KEY }}
+ run: |
+ set -euo pipefail
+ [ -n "$GLM_API_KEY" ] || { echo "::error::LLM API key secret is not configured"; exit 1; }
+ STATUS=$(curl -sS -o "$RUNNER_TEMP/llm-models.json" -w '%{http_code}' --max-time 15 --retry 2 --retry-delay 3 \
+ -H "Authorization: Bearer $GLM_API_KEY" \
+ "$GLM_BASE_URL/models" || echo "000")
+ if [ "$STATUS" != "200" ]; then
+ echo "::error::LLM router health check failed (HTTP $STATUS) at $GLM_BASE_URL/models"
+ head -c 300 "$RUNNER_TEMP/llm-models.json" 2>/dev/null || true
+ exit 1
+ fi
+ python3 -c 'import json,sys; d=json.load(open(sys.argv[1])).get("data",[]); assert isinstance(d,list) and len(d)>0' "$RUNNER_TEMP/llm-models.json" || {
+ echo "::error::LLM router returned no available models at $GLM_BASE_URL/models"
+ exit 1
+ }
+
- name: Checkout the QA project (cake-qa, via deploy key)
uses: actions/checkout@v4
with:
@@ -187,17 +227,45 @@ jobs:
name: e2e-apk
path: apk
- # Hosted runners need the udev rule or the action falls back to
- # -accel off (software emulation): 12-minute boots and the adb daemon
- # wedging under CPU load (three CI failures: 'Daemon request timed out').
+ - name: Start Redroid and run the no-funds slice
+ if: (inputs.runs_on || 'cake-ultra-android-qa') != 'ubuntu-latest'
+ env:
+ GLM_BASE_URL: https://llm.cakewallet.com/v1
+ GLM_API_KEY: ${{ secrets.LLM_API_KEY || secrets.DSPARK_API_KEY }}
+ E2E_SECRET_SEED_BTC: ${{ secrets.E2E_SECRET_SEED_BTC }}
+ E2E_SECRET_SEED_SOL: ${{ secrets.E2E_SECRET_SEED_SOL }}
+ E2E_SECRET_SEED_XMR: ${{ secrets.E2E_SECRET_SEED_XMR }}
+ E2E_SECRET_SEED_NANO: ${{ secrets.E2E_SECRET_SEED_NANO }}
+ E2E_SECRET_WALLET_PASSPHRASE: ${{ secrets.E2E_SECRET_WALLET_PASSPHRASE }}
+ SUITE: ${{ inputs.suite || 'tests/generated/no-funds.e2e.ts' }}
+ GREP: ${{ inputs.grep }}
+ SHARD: ${{ matrix.shard }}
+ run: |
+ set -euo pipefail
+ SERIAL=$(/usr/local/bin/start-redroid.sh 1)
+ while IFS= read -r pkg; do
+ if [ -n "$pkg" ]; then adb -s "$SERIAL" uninstall "$pkg" </dev/null; fi
+ done < <(adb -s "$SERIAL" shell pm list packages </dev/null | tr -d '\r' | sed -n 's/^package://p' | grep '^com\.cakewallet\.test_' || true)
+ adb -s "$SERIAL" install -r apk/app-release.apk
+ nohup node cake-qa/tools/glm-proxy.mjs > "$RUNNER_TEMP/glm-proxy.log" 2>&1 &
+ sleep 2
+ CW_PACKAGE=$(adb -s "$SERIAL" shell pm list packages </dev/null | tr -d '\r' | sed -n 's/^package://p' | grep -m1 '^com\.cakewallet\.test_')
+ [ -n "$CW_PACKAGE" ] || exit 1
+ cd cake-qa
+ ARGS=(--target pixel "$SUITE" --reporter list,junit,markdown --shard "$SHARD")
+ if [ -n "$GREP" ]; then ARGS+=(--grep "$GREP"); fi
+ CW_DEVICE="$SERIAL" CW_PACKAGE="$CW_PACKAGE" CW_ANDROID_SESSION="qa-android" node node_modules/.bin/e2e run "${ARGS[@]}"
+
- name: Enable KVM
+ if: inputs.runs_on == 'ubuntu-latest'
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls -la /dev/kvm
- name: Boot the emulator and run the no-funds slice
+ if: inputs.runs_on == 'ubuntu-latest'
uses: reactivecircus/android-emulator-runner@v2
env:
GLM_BASE_URL: https://llm.cakewallet.com/v1
@@ -206,89 +274,154 @@ jobs:
E2E_SECRET_SEED_SOL: ${{ secrets.E2E_SECRET_SEED_SOL }}
E2E_SECRET_SEED_XMR: ${{ secrets.E2E_SECRET_SEED_XMR }}
E2E_SECRET_SEED_NANO: ${{ secrets.E2E_SECRET_SEED_NANO }}
+ E2E_SECRET_WALLET_PASSPHRASE: ${{ secrets.E2E_SECRET_WALLET_PASSPHRASE }}
+ SUITE: ${{ inputs.suite || 'tests/generated/no-funds.e2e.ts' }}
+ GREP: ${{ inputs.grep }}
+ SHARD: ${{ matrix.shard }}
with:
api-level: 34
target: google_apis
arch: x86_64
- # hosted runners booted in 764s once and blew the 600s default on
- # the next run; 20min removes the flake, 4 cores shorten the boot.
emulator-boot-timeout: 1200
cores: 4
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -read-only -memory 4096 -no-snapshot-save
- # The handoff pins animations off, but NOT via the action's own
- # step: after a slow boot (764s observed) its `settings put` dies
- # with "Broken pipe" and the action tears the emulator down
- # (adb exit 224). The script settles first and sets the three
- # animation scales itself.
disable-animations: false
- # NOTE: the action's parseScript() runs EACH LINE as its own
- # `/usr/bin/sh -c` (dash): no bashisms, no multi-line constructs,
- # and `set -eu` on its own line has no effect on the others.
script: |
i=0; until adb shell settings get global window_animation_scale >/dev/null 2>&1; do i=$((i+1)); if [ "$i" -ge 60 ]; then break; fi; sleep 10; done
adb shell settings put global window_animation_scale 0 || true
adb shell settings put global transition_animation_scale 0 || true
adb shell settings put global animator_duration_scale 0 || true
- adb install -r apk/app-x86_64-release.apk
+ adb install -r apk/app-release.apk
nohup node cake-qa/tools/glm-proxy.mjs > "$RUNNER_TEMP/glm-proxy.log" 2>&1 &
sleep 2
adb kill-server; adb start-server; i=0; until adb shell true >/dev/null 2>&1; do i=$((i+1)); if [ "$i" -ge 30 ]; then break; fi; sleep 2; done
- CW_PACKAGE=$(adb shell pm list packages | tr -d '\r' | sed -n 's/^package://p' | grep -m1 'com\.cakewallet\.test'); [ -n "$CW_PACKAGE" ] || exit 1; SUITE="${{ inputs.suite || 'tests/generated/no-funds.e2e.ts' }}"; GREP="${{ inputs.grep }}"; if [ -n "${{ inputs.shard }}" ]; then cd cake-qa && CW_PACKAGE="$CW_PACKAGE" node node_modules/.bin/e2e run --target pixel "$SUITE" --reporter list,junit,markdown ${GREP:+--grep} ${GREP:+"$GREP"} --shard "${{ inputs.shard }}"; else cd cake-qa && CW_PACKAGE="$CW_PACKAGE" node node_modules/.bin/e2e run --target pixel "$SUITE" --reporter list,junit,markdown ${GREP:+--grep} ${GREP:+"$GREP"}; fi
+ CW_PACKAGE=$(adb shell pm list packages | tr -d '\r' | sed -n 's/^package://p' | grep -m1 'com\.cakewallet\.test'); [ -n "$CW_PACKAGE" ] || exit 1; cd cake-qa && CW_PACKAGE="$CW_PACKAGE" node node_modules/.bin/e2e run --target pixel "$SUITE" --reporter list,junit,markdown ${GREP:+--grep} ${GREP:+"$GREP"} --shard "$SHARD"
- name: Redact seed-like word runs from the results
id: redact
if: always()
- run: node cake-qa/tools/qa/redact.mjs cake-qa/.e2e
+ env:
+ SHARD: ${{ matrix.shard }}
+ run: |
+ python3 -c 'import os,re; s=re.sub(r"[^A-Za-z0-9_-]+","-",os.environ["SHARD"]).strip("-") or "shard"; print(f"shard_id={s}")' >> "$GITHUB_OUTPUT"
+ if [ -d cake-qa/.e2e ]; then
+ node cake-qa/tools/qa/redact.mjs cake-qa/.e2e
+ fi
- name: Upload results
if: always() && steps.redact.outcome == 'success'
uses: actions/upload-artifact@v4
with:
- name: e2e-results
- path: |
- cake-qa/.e2e/junit.xml
- cake-qa/.e2e/summary.md
+ name: e2e-results-${{ steps.redact.outputs.shard_id }}
+ path: cake-qa/.e2e/summary.md
+ include-hidden-files: true
if-no-files-found: warn
- name: Encrypt the agent trace and screenshots
if: always() && steps.redact.outcome == 'success'
- working-directory: cake-qa/.e2e
env:
- QA_ARTIFACT_PASSPHRASE: ${{ secrets.QA_ARTIFACT_PASSPHRASE }}
+ QA_ARTIFACT_PGP_KEYS: ${{ vars.QA_ARTIFACT_PGP_KEYS }}
run: |
- [ -n "$QA_ARTIFACT_PASSPHRASE" ] || exit 0
- FILES=$(ls -d report.json artifacts 2>/dev/null || true)
+ set -euo pipefail
+ [ -n "$QA_ARTIFACT_PGP_KEYS" ] || exit 0
+ [ -d cake-qa/.e2e ] || exit 0
+ cd cake-qa/.e2e
+ FILES=$(ls -d report.json junit.xml results artifacts 2>/dev/null || true)
[ -n "$FILES" ] || exit 0
- tar czf - $FILES | openssl enc -aes-256-cbc -pbkdf2 -salt -pass env:QA_ARTIFACT_PASSPHRASE -out "$RUNNER_TEMP/e2e-trace.tgz.enc"
+ export GNUPGHOME
+ GNUPGHOME=$(mktemp -d)
+ chmod 700 "$GNUPGHOME"
+ trap 'rm -rf "$GNUPGHOME"' EXIT
+ printf '%s\n' "$QA_ARTIFACT_PGP_KEYS" | gpg --batch --import
+ RECIPIENTS=()
+ while IFS= read -r fpr; do
+ [ -n "$fpr" ] && RECIPIENTS+=(-r "$fpr")
+ done < <(gpg --batch --list-keys --with-colons | awk -F: '$1=="pub" && $2!="e" && $2!="r"{p=1;next} $1=="fpr" && p{print $10; p=0} $1!="fpr"{p=0}')
+ [ "${#RECIPIENTS[@]}" -gt 0 ] || { echo "::error::no PGP recipient keys imported"; exit 1; }
+ tar czf - $FILES | gpg --batch --yes --trust-model always --encrypt "${RECIPIENTS[@]}" --output "$RUNNER_TEMP/e2e-trace.tgz.gpg"
- name: Upload the encrypted trace
if: always() && steps.redact.outcome == 'success'
uses: actions/upload-artifact@v4
with:
- name: e2e-trace
- path: ${{ runner.temp }}/e2e-trace.tgz.enc
+ name: e2e-trace-${{ steps.redact.outputs.shard_id }}
+ path: ${{ runner.temp }}/e2e-trace.tgz.gpg
if-no-files-found: ignore
+ report:
+ needs: [resolve, e2e]
+ if: >-
+ always() && !cancelled() &&
+ needs.resolve.result != 'cancelled' &&
+ needs.e2e.result != 'cancelled' &&
+ github.event_name == 'pull_request' &&
+ needs.resolve.outputs.run_id != '' &&
+ github.event.pull_request.head.repo.fork == false
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ actions: read
+ pull-requests: write
+ continue-on-error: true
+ timeout-minutes: 10
+ steps:
+ - name: Download shard results
+ continue-on-error: true
+ uses: actions/download-artifact@v4
+ with:
+ pattern: e2e-results-*
+ path: shard-results
+
- name: PR comment with counts, cost and cache hit rate
- # A cancelled run has no summary and must not overwrite the last real result.
- if: ${{ !cancelled() && github.event_name == 'pull_request' }}
uses: actions/github-script@v7
+ env:
+ EXPECTED_SHARDS: ${{ needs.resolve.outputs.shards }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
with:
script: |
const fs = require('fs');
+ const path = require('path');
const marker = '<!-- qa-e2e-android -->';
- let body = '_the run produced no summary (see the e2e-results artifact)_';
- try {
- const md = fs.readFileSync('cake-qa/.e2e/summary.md', 'utf8');
- const lines = md.split('\n').slice(0, 6).join('\n'); // counts + AI/cost line
- body = `${marker}\n#### QA e2e (report-only lane)\n\n${lines}\n\nArtifact: this run's \`e2e-results\`.`;
- } catch (e) {
- body = `${marker}\n#### QA e2e (report-only lane)\n\n_summary.md missing (${e.message}) — see the \`e2e-results\` artifact._`;
+ const shards = JSON.parse(process.env.EXPECTED_SHARDS || '["1/4","2/4","3/4","4/4"]');
+ const sha = (process.env.HEAD_SHA || '').slice(0, 9);
+ let totalPassed = 0;
+ let totalFailed = 0;
+ let missing = 0;
+ const sections = [];
+ for (const shard of shards) {
+ const slug = shard.replace(/[^A-Za-z0-9_-]+/g, '-').replace(/^-+|-+$/g, '') || 'shard';
+ const mdPath = path.join('shard-results', `e2e-results-${slug}`, 'summary.md');
+ if (!fs.existsSync(mdPath)) {
+ missing += 1;
+ sections.push(`**Shard ${shard}**: _summary.md missing — see job log_`);
+ continue;
+ }
+ const md = fs.readFileSync(mdPath, 'utf8');
+ const first = md.split('\n')[0] || '';
+ const p = first.match(/(\d+)\s+passed/);
+ const f = first.match(/(\d+)\s+failed/);
+ if (p) totalPassed += Number(p[1]);
+ if (f) totalFailed += Number(f[1]);
+ const lines = md.split('<details>')[0].trim().split('\n').slice(0, 6).join('\n').replace(/^#+\s*/, '').trim();
+ sections.push(`**Shard ${shard}**: ${lines}`);
}
+ const icon = totalFailed > 0 || missing > 0 ? '🔴' : '🟢';
+ const counts = [];
+ if (totalFailed > 0) counts.push(`${totalFailed} failed`);
+ if (totalPassed > 0) counts.push(`${totalPassed} passed`);
+ if (missing > 0) counts.push(`${missing} shard(s) missing`);
+ const headline = counts.length ? `${icon} e2e: ${counts.join(', ')}` : `${icon} e2e: no results`;
+ const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
+ const body = [
+ marker,
+ `#### QA e2e (report-only lane${sha ? ` · \`${sha}\`` : ''}) — ${headline}`,
+ sections.join('\n\n'),
+ `Artifacts: \`e2e-results-*\` on [this run](${runUrl}).`,
+ ].join('\n\n');
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
- const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number, per_page: 100 });
+ const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number, per_page: 100 });
const prev = comments.find((c) => c.body && c.body.includes(marker));
if (prev) {
await github.rest.issues.updateComment({ owner, repo, comment_id: prev.id, body });
### .github/workflows/e2e_cache_nightly.yml
@@ -6,14 +6,12 @@
name: E2E cache nightly
on:
- schedule:
- - cron: "0 3 * * *"
workflow_dispatch:
inputs:
runs_on:
- description: "runner label"
+ description: "runner label: cake-ultra-android-qa (Redroid arm64) or ubuntu-latest (hosted KVM x86_64)"
type: string
- default: ubuntu-latest
+ default: cake-ultra-android-qa
permissions:
contents: read
@@ -35,15 +33,32 @@ jobs:
refresh:
needs: build
- # The APK is uploaded before the build's own integration tests run, so a red test there must not skip the night.
if: ${{ !cancelled() }}
- runs-on: ${{ inputs.runs_on || 'ubuntu-latest' }}
- # qa-nightly holds the only key that can write to cake-qa; it is limited to dev.
+ runs-on: ${{ fromJSON((inputs.runs_on || 'cake-ultra-android-qa') == 'cake-ultra-android-qa' && '["self-hosted","Linux","ARM64","cake-ultra-android-qa"]' || toJSON(inputs.runs_on)) }}
environment: qa-nightly
- # Report-only family: a red night must not page anyone (handoff §9).
continue-on-error: true
- timeout-minutes: 150
+ timeout-minutes: 110
steps:
+ - name: Check LLM router health
+ env:
+ GLM_BASE_URL: https://llm.cakewallet.com/v1
+ GLM_API_KEY: ${{ secrets.LLM_API_KEY || secrets.DSPARK_API_KEY }}
+ run: |
+ set -euo pipefail
+ [ -n "$GLM_API_KEY" ] || { echo "::error::LLM API key secret is not configured"; exit 1; }
+ STATUS=$(curl -sS -o "$RUNNER_TEMP/llm-models.json" -w '%{http_code}' --max-time 15 --retry 2 --retry-delay 3 \
+ -H "Authorization: Bearer $GLM_API_KEY" \
+ "$GLM_BASE_URL/models" || echo "000")
+ if [ "$STATUS" != "200" ]; then
+ echo "::error::LLM router health check failed (HTTP $STATUS) at $GLM_BASE_URL/models"
+ head -c 300 "$RUNNER_TEMP/llm-models.json" 2>/dev/null || true
+ exit 1
+ fi
+ python3 -c 'import json,sys; d=json.load(open(sys.argv[1])).get("data",[]); assert isinstance(d,list) and len(d)>0' "$RUNNER_TEMP/llm-models.json" || {
+ echo "::error::LLM router returned no available models at $GLM_BASE_URL/models"
+ exit 1
+ }
+
- name: Checkout the QA project (cake-qa)
uses: actions/checkout@v4
with:
@@ -64,30 +79,73 @@ jobs:
run: npm ci
- name: Download this run's x86_64 APK
+ if: inputs.runs_on == 'ubuntu-latest'
uses: actions/download-artifact@v4
with:
pattern: "*_x86.apk"
- path: apk
+ path: apk-dl
+ merge-multiple: true
+
+ - name: Download this run's arm64 APK
+ if: (inputs.runs_on || 'cake-ultra-android-qa') != 'ubuntu-latest'
+ uses: actions/download-artifact@v4
+ with:
+ pattern: "*.apk"
+ path: apk-dl
merge-multiple: true
- name: Give the APK the name the suite installs
+ env:
+ TARGET_RUNNER: ${{ inputs.runs_on || 'cake-ultra-android-qa' }}
+ run: |
+ set -euo pipefail
+ mkdir -p apk
+ if [ "$TARGET_RUNNER" = "ubuntu-latest" ]; then
+ APK_SRC=$(find apk-dl -maxdepth 2 -name '*_x86.apk' | head -n 1)
+ else
+ APK_SRC=$(find apk-dl -maxdepth 2 -name '*.apk' ! -name '*_x86.apk' ! -name '*_v7a.apk' ! -name '*x86_64*' ! -name '*armeabi-v7a*' | head -n 1)
+ fi
+ [ -n "$APK_SRC" ] && [ -f "$APK_SRC" ] || { echo "::error::APK artifact not found"; exit 1; }
+ mv "$APK_SRC" apk/app-release.apk
+ echo "BUILD_RUN=$GITHUB_RUN_ID" >> "$GITHUB_ENV"
+
+ - name: Start Redroid and record the cache (read-write)
+ id: record_ultra
+ if: (inputs.runs_on || 'cake-ultra-android-qa') != 'ubuntu-latest'
+ env:
+ GLM_BASE_URL: https://llm.cakewallet.com/v1
+ GLM_API_KEY: ${{ secrets.LLM_API_KEY || secrets.DSPARK_API_KEY }}
+ E2E_SECRET_SEED_BTC: ${{ secrets.E2E_SECRET_SEED_BTC }}
+ E2E_SECRET_SEED_SOL: ${{ secrets.E2E_SECRET_SEED_SOL }}
+ E2E_SECRET_SEED_XMR: ${{ secrets.E2E_SECRET_SEED_XMR }}
+ E2E_SECRET_SEED_NANO: ${{ secrets.E2E_SECRET_SEED_NANO }}
+ E2E_SECRET_WALLET_PASSPHRASE: ${{ secrets.E2E_SECRET_WALLET_PASSPHRASE }}
+ QA_CACHE_MODE: read-write
run: |
set -euo pipefail
- mv "$(ls apk/*_x86.apk | head -n 1)" apk/app-x86_64-release.apk
- echo "BUILD_RUN=${{ github.run_id }}" >> "$GITHUB_ENV"
+ SERIAL=$(/usr/local/bin/start-redroid.sh 1)
+ while IFS= read -r pkg; do
+ if [ -n "$pkg" ]; then adb -s "$SERIAL" uninstall "$pkg" </dev/null; fi
+ done < <(adb -s "$SERIAL" shell pm list packages </dev/null | tr -d '\r' | sed -n 's/^package://p' | grep '^com\.cakewallet\.test_' || true)
+ adb -s "$SERIAL" install -r apk/app-release.apk
+ nohup node cake-qa/tools/glm-proxy.mjs > "$RUNNER_TEMP/glm-proxy.log" 2>&1 &
+ sleep 2
+ CW_PACKAGE=$(adb -s "$SERIAL" shell pm list packages </dev/null | tr -d '\r' | sed -n 's/^package://p' | grep -m1 '^com\.cakewallet\.test_')
+ [ -n "$CW_PACKAGE" ] || exit 1
+ cd cake-qa
+ CW_DEVICE="$SERIAL" CW_PACKAGE="$CW_PACKAGE" CW_ANDROID_SESSION="qa-nightly" node node_modules/.bin/e2e run --target pixel tests/generated/no-funds.e2e.ts --reporter list,junit,markdown
- # Hosted runners need the udev rule or the action falls back to
- # -accel off (software emulation): 12-minute boots and the adb daemon
- # wedging under CPU load (three CI failures: 'Daemon request timed out').
- name: Enable KVM
+ if: inputs.runs_on == 'ubuntu-latest'
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls -la /dev/kvm
- name: Boot the emulator and record the cache (read-write)
- id: record
+ id: record_emulator
+ if: inputs.runs_on == 'ubuntu-latest'
uses: reactivecircus/android-emulator-runner@v2
env:
GLM_BASE_URL: https://llm.cakewallet.com/v1
@@ -96,27 +154,23 @@ jobs:
E2E_SECRET_SEED_SOL: ${{ secrets.E2E_SECRET_SEED_SOL }}
E2E_SECRET_SEED_XMR: ${{ secrets.E2E_SECRET_SEED_XMR }}
E2E_SECRET_SEED_NANO: ${{ secrets.E2E_SECRET_SEED_NANO }}
- # the one override this lane exists for:
+ E2E_SECRET_WALLET_PASSPHRASE: ${{ secrets.E2E_SECRET_WALLET_PASSPHRASE }}
QA_CACHE_MODE: read-write
with:
api-level: 34
target: google_apis
arch: x86_64
- # hosted runners booted in 764s once and blew the 600s default on
- # the next run; 20min removes the flake, 4 cores shorten the boot.
emulator-boot-timeout: 1200
cores: 4
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -read-only -memory 3072 -no-snapshot-save
disable-animations: false
- # parseScript(): one sh -c (dash) per line — no bashisms, no loops
- # spanning lines, no reliance on `set -eu` persisting.
script: |
i=0; until adb shell settings get global window_animation_scale >/dev/null 2>&1; do i=$((i+1)); if [ "$i" -ge 60 ]; then break; fi; sleep 10; done
adb shell settings put global window_animation_scale 0 || true
adb shell settings put global transition_animation_scale 0 || true
adb shell settings put global animator_duration_scale 0 || true
- adb install -r apk/app-x86_64-release.apk
+ adb install -r apk/app-release.apk
nohup node cake-qa/tools/glm-proxy.mjs > "$RUNNER_TEMP/glm-proxy.log" 2>&1 &
sleep 2
adb kill-server; adb start-server; i=0; until adb shell true >/dev/null 2>&1; do i=$((i+1)); if [ "$i" -ge 30 ]; then break; fi; sleep 2; done
@@ -126,42 +180,57 @@ jobs:
id: redact
if: always()
run: |
- # Redact copies: the recorded cache under .e2e must be pushed as recorded.
+ rm -rf "$RUNNER_TEMP/results"
mkdir -p "$RUNNER_TEMP/results"
- cp cake-qa/.e2e/junit.xml cake-qa/.e2e/summary.md cake-qa/.e2e/report.json "$RUNNER_TEMP/results/" 2>/dev/null || true
- node cake-qa/tools/qa/redact.mjs "$RUNNER_TEMP/results"
+ if [ -d cake-qa/.e2e ]; then
+ cp cake-qa/.e2e/junit.xml cake-qa/.e2e/summary.md cake-qa/.e2e/report.json "$RUNNER_TEMP/results/" 2>/dev/null || true
+ for d in results artifacts; do
+ [ ! -d "cake-qa/.e2e/$d" ] || cp -r "cake-qa/.e2e/$d" "$RUNNER_TEMP/results/"
+ done
+ node cake-qa/tools/qa/redact.mjs "$RUNNER_TEMP/results"
+ fi
- name: Upload results
if: always() && steps.redact.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: e2e-nightly-results
- path: |
- ${{ runner.temp }}/results/junit.xml
- ${{ runner.temp }}/results/summary.md
+ path: ${{ runner.temp }}/results/summary.md
if-no-files-found: warn
- name: Encrypt the agent trace and screenshots
if: always() && steps.redact.outcome == 'success'
- working-directory: ${{ runner.temp }}/results
env:
- QA_ARTIFACT_PASSPHRASE: ${{ secrets.QA_ARTIFACT_PASSPHRASE }}
+ QA_ARTIFACT_PGP_KEYS: ${{ vars.QA_ARTIFACT_PGP_KEYS }}
run: |
- [ -n "$QA_ARTIFACT_PASSPHRASE" ] || exit 0
- FILES=$(ls -d report.json 2>/dev/null || true)
+ set -euo pipefail
+ [ -n "$QA_ARTIFACT_PGP_KEYS" ] || exit 0
+ [ -d "$RUNNER_TEMP/results" ] || exit 0
+ cd "$RUNNER_TEMP/results"
+ FILES=$(ls -d report.json junit.xml results artifacts 2>/dev/null || true)
[ -n "$FILES" ] || exit 0
- tar czf - $FILES | openssl enc -aes-256-cbc -pbkdf2 -salt -pass env:QA_ARTIFACT_PASSPHRASE -out "$RUNNER_TEMP/e2e-nightly-trace.tgz.enc"
+ export GNUPGHOME
+ GNUPGHOME=$(mktemp -d)
+ chmod 700 "$GNUPGHOME"
+ trap 'rm -rf "$GNUPGHOME"' EXIT
+ printf '%s\n' "$QA_ARTIFACT_PGP_KEYS" | gpg --batch --import
+ RECIPIENTS=()
+ while IFS= read -r fpr; do
+ [ -n "$fpr" ] && RECIPIENTS+=(-r "$fpr")
+ done < <(gpg --batch --list-keys --with-colons | awk -F: '$1=="pub" && $2!="e" && $2!="r"{p=1;next} $1=="fpr" && p{print $10; p=0} $1!="fpr"{p=0}')
+ [ "${#RECIPIENTS[@]}" -gt 0 ] || { echo "::error::no PGP recipient keys imported"; exit 1; }
+ tar czf - $FILES | gpg --batch --yes --trust-model always --encrypt "${RECIPIENTS[@]}" --output "$RUNNER_TEMP/e2e-nightly-trace.tgz.gpg"
- name: Upload the encrypted trace
if: always() && steps.redact.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: e2e-nightly-trace
- path: ${{ runner.temp }}/e2e-nightly-trace.tgz.enc
+ path: ${{ runner.temp }}/e2e-nightly-trace.tgz.gpg
if-no-files-found: ignore
- name: Push the refreshed cache to a nightly branch
- if: always() && steps.record.outcome == 'success'
+ if: always() && (steps.record_ultra.outcome == 'success' || steps.record_emulator.outcome == 'success')
working-directory: cake-qa
env:
QA_DEPLOY_KEY: ${{ secrets.QA_DEPLOY_KEY }}
@@ -172,7 +241,7 @@ jobs:
printf '%s\n' "$QA_DEPLOY_KEY" > "$KEY"
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > "$HOSTS"
export GIT_SSH_COMMAND="ssh -i $KEY -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOSTS -o StrictHostKeyChecking=yes"
- BRANCH="nightly/cache-$(date -u +%Y%m%d)-${{ github.run_id }}-${{ github.run_attempt }}"
+ BRANCH="nightly/cache-$(date -u +%Y%m%d)-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
git config user.name "qa-nightly-bot"
git config user.email "qa-nightly-bot@users.noreply.github.com"
git checkout -B "$BRANCH"
@@ -181,6 +250,6 @@ jobs:
echo "cache unchanged — no PR needed"
exit 0
fi
- git commit -m "nightly: refresh replay cache from dev (build run ${{ env.BUILD_RUN }})"
+ git commit -m "nightly: refresh replay cache from dev (build run $BUILD_RUN)"
git push git@github.com:cake-tech/cake-qa.git "HEAD:refs/heads/$BRANCH"
echo "pushed $BRANCH — cake-qa's PR workflow will open the PR"
### .github/workflows/e2e_ios.yml
@@ -12,7 +12,7 @@ on:
workflow_dispatch:
inputs:
shard:
- description: "e.g. 2/3 (empty = single run)"
+ description: "e.g. 2/3 (empty = 3-way parallel shards 1/3..3/3, or 1/1 when grep is set)"
type: string
default: ""
qa_ref:
@@ -37,7 +37,7 @@ concurrency:
jobs:
build:
- runs-on: [self-hosted, cake-m5-ultra]
+ runs-on: [self-hosted, macOS, ARM64, cake-m5-ultra]
# REPORT-ONLY, permanently until Seth says otherwise.
continue-on-error: true
timeout-minutes: 90
@@ -86,14 +86,32 @@ jobs:
e2e:
needs: build
- # build is report-only, so it "succeeds" even when it fails: run only when it handed over an app.
if: needs.build.outputs.built == 'true'
- runs-on: [self-hosted, cake-m4-qa]
+ runs-on: [self-hosted, macOS, ARM64, cake-ios-qa]
environment: qa
- # REPORT-ONLY, permanently until Seth says otherwise.
continue-on-error: true
- timeout-minutes: 180
+ timeout-minutes: 230
steps:
+ - name: Check LLM router health
+ env:
+ GLM_BASE_URL: https://llm.cakewallet.com/v1
+ GLM_API_KEY: ${{ secrets.LLM_API_KEY || secrets.DSPARK_API_KEY }}
+ run: |
+ set -euo pipefail
+ [ -n "$GLM_API_KEY" ] || { echo "::error::LLM API key secret is not configured"; exit 1; }
+ STATUS=$(curl -sS -o "$RUNNER_TEMP/llm-models.json" -w '%{http_code}' --max-time 15 --retry 2 --retry-delay 3 \
+ -H "Authorization: Bearer $GLM_API_KEY" \
+ "$GLM_BASE_URL/models" || echo "000")
+ if [ "$STATUS" != "200" ]; then
+ echo "::error::LLM router health check failed (HTTP $STATUS) at $GLM_BASE_URL/models"
+ head -c 300 "$RUNNER_TEMP/llm-models.json" 2>/dev/null || true
+ exit 1
+ fi
+ python3 -c 'import json,sys; d=json.load(open(sys.argv[1])).get("data",[]); assert isinstance(d,list) and len(d)>0' "$RUNNER_TEMP/llm-models.json" || {
+ echo "::error::LLM router returned no available models at $GLM_BASE_URL/models"
+ exit 1
+ }
+
- name: Checkout the QA project (cake-qa, via deploy key)
uses: actions/checkout@v4
with:
@@ -136,7 +154,10 @@ jobs:
available || xcodebuild -downloadPlatform iOS
available
- - name: Boot the simulator and install
+ - name: Boot simulators and install
+ env:
+ SHARD: ${{ inputs.shard }}
+ GREP: ${{ inputs.grep }}
run: |
set -euo pipefail
read -r RUNTIME DEVICE_TYPE < <(xcrun simctl list runtimes -j | python3 -c "
@@ -148,10 +169,33 @@ jobs:
pick=([d for d in ds if re.fullmatch(r'iPhone \\d+ Pro', d['name'])] or [d for d in ds if re.fullmatch(r'iPhone \\d+', d['name'])] or ds)[-1]
print(rt['identifier'], pick['identifier'])")
echo "runtime=$RUNTIME device=$DEVICE_TYPE"
- UDID=$(xcrun simctl create qa-e2e "$DEVICE_TYPE" "$RUNTIME")
- echo "UDID=$UDID" >> "$GITHUB_ENV"
- xcrun simctl bootstatus "$UDID" -b
- xcrun simctl install "$UDID" app/Runner.app
+ if [ -n "$SHARD" ]; then
+ SHARDS=("$SHARD")
+ elif [ -n "$GREP" ]; then
+ SHARDS=("1/1")
+ else
+ SHARDS=("1/3" "2/3" "3/3")
+ fi
+ : > "$RUNNER_TEMP/sim-udids.txt"
+ : > "$RUNNER_TEMP/sim-shards.txt"
+ UDIDS=()
+ for idx in "${!SHARDS[@]}"; do
+ i=$((idx + 1))
+ u=$(xcrun simctl create "qa-e2e-$i" "$DEVICE_TYPE" "$RUNTIME")
+ echo "$u" >> "$RUNNER_TEMP/sim-udids.txt"
+ echo "${SHARDS[$idx]}" >> "$RUNNER_TEMP/sim-shards.txt"
+ UDIDS+=("$u")
+ done
+ BOOT_PIDS=()
+ for u in "${UDIDS[@]}"; do
+ xcrun simctl boot "$u" >/dev/null 2>&1 || true
+ xcrun simctl bootstatus "$u" -b &
+ BOOT_PIDS+=($!)
+ done
+ for pid in "${BOOT_PIDS[@]}"; do wait "$pid"; done
+ for u in "${UDIDS[@]}"; do
+ xcrun simctl install "$u" app/Runner.app
+ done
- name: Run the no-funds slice
working-directory: cake-qa
@@ -162,52 +206,171 @@ jobs:
E2E_SECRET_SEED_SOL: ${{ secrets.E2E_SECRET_SEED_SOL }}
E2E_SECRET_SEED_XMR: ${{ secrets.E2E_SECRET_SEED_XMR }}
E2E_SECRET_SEED_NANO: ${{ secrets.E2E_SECRET_SEED_NANO }}
- CW_IOS_DEVICE: qa-e2e
+ E2E_SECRET_WALLET_PASSPHRASE: ${{ secrets.E2E_SECRET_WALLET_PASSPHRASE }}
CW_IOS_APP: ${{ github.workspace }}/app/Runner.app
SUITE: ${{ inputs.suite || 'tests/generated/no-funds.e2e.ts' }}
GREP: ${{ inputs.grep }}
- SHARD: ${{ inputs.shard }}
run: |
set -euo pipefail
nohup node tools/glm-proxy.mjs > "$RUNNER_TEMP/glm-proxy.log" 2>&1 &
sleep 2
- ARGS=(--target sim --reporter "list,junit,markdown")
- if [ -n "$SHARD" ]; then ARGS+=(--shard "$SHARD"); fi
- if [ -n "$GREP" ]; then ARGS+=(--grep "$GREP"); fi
- # node directly, not npx: npm rewrites its process title and on macOS the overflow
- # exposes the job's environment (the wallet seeds) to `ps`.
- node node_modules/.bin/e2e run "$SUITE" "${ARGS[@]}"
+ UDIDS=()
+ while IFS= read -r u; do [ -n "$u" ] && UDIDS+=("$u"); done < "$RUNNER_TEMP/sim-udids.txt"
+ SHARDS=()
+ while IFS= read -r s; do [ -n "$s" ] && SHARDS+=("$s"); done < "$RUNNER_TEMP/sim-shards.txt"
+ PIDS=()
+ for idx in "${!SHARDS[@]}"; do
+ i=$((idx + 1))
+ [ "$i" -gt 1 ] && sleep 5
+ S="${SHARDS[$idx]}"
+ U="${UDIDS[$idx]}"
+ ARGS=(--target sim --reporter "list,junit,markdown" --output ".e2e-shard-$i" --shard "$S")
+ if [ -n "$GREP" ]; then ARGS+=(--grep "$GREP"); fi
+ (
+ CW_IOS_DEVICE="$U" \
+ UDID="$U" \
+ CW_IOS_SESSION="qa-e2e-$i" \
+ SHADOW_OUT_ROOT=".e2e-shard-$i" \
+ node node_modules/.bin/e2e run "$SUITE" "${ARGS[@]}" > "$RUNNER_TEMP/shard-$i.log" 2>&1
+ ) &
+ PIDS+=($!)
+ done
+ RC=0
+ for idx in "${!PIDS[@]}"; do
+ i=$((idx + 1))
+ set +e
+ wait "${PIDS[$idx]}"
+ st=$?
+ set -e
+ echo "::group::Shard $i (${SHARDS[$idx]}) exit=$st"
+ cat "$RUNNER_TEMP/shard-$i.log" 2>/dev/null || true
+ echo "::endgroup::"
+ if [ "$st" -ne 0 ]; then RC=1; fi
+ done
+ exit "$RC"
+
+ - name: Clean up simulators
+ if: always()
+ run: |
+ [ -f "$RUNNER_TEMP/sim-udids.txt" ] || exit 0
+ while IFS= read -r u; do
+ [ -n "$u" ] || continue
+ xcrun simctl shutdown "$u" >/dev/null 2>&1 || true
+ xcrun simctl delete "$u" >/dev/null 2>&1 || true
+ done < "$RUNNER_TEMP/sim-udids.txt"
+
+ - name: Merge shard results
+ if: always()
+ run: |
+ [ -d cake-qa ] || exit 0
+ node - <<'NODE'
+ const fs = require('fs');
+ const path = require('path');
+ const root = 'cake-qa';
+ const outDir = path.join(root, '.e2e');
+ const shardsRaw = fs.existsSync(path.join(process.env.RUNNER_TEMP || '', 'sim-shards.txt'))
+ ? fs.readFileSync(path.join(process.env.RUNNER_TEMP, 'sim-shards.txt'), 'utf8').trim().split('\n').filter(Boolean)
+ : [];
+ const existing = fs.readdirSync(root)
+ .filter((d) => /^\.e2e-shard-\d+$/.test(d))
+ .sort((a, b) => Number(a.split('-').pop()) - Number(b.split('-').pop()));
+ const count = Math.max(shardsRaw.length, existing.length);
+ if (!count) process.exit(0);
+ fs.mkdirSync(outDir, { recursive: true });
+ let totalPassed = 0;
+ let totalFailed = 0;
+ let missing = 0;
+ const sections = [];
+ const suites = [];
+ for (let idx = 1; idx <= count; idx += 1) {
+ const label = shardsRaw[idx - 1] || String(idx);
+ const src = path.join(root, `.e2e-shard-${idx}`);
+ const mdPath = path.join(src, 'summary.md');
+ if (fs.existsSync(mdPath)) {
+ const md = fs.readFileSync(mdPath, 'utf8');
+ const first = md.split('\n')[0] || '';
+ const p = first.match(/(\d+)\s+passed/);
+ const f = first.match(/(\d+)\s+failed/);
+ if (p) totalPassed += Number(p[1]);
+ if (f) totalFailed += Number(f[1]);
+ const lines = md.split('<details>')[0].trim().split('\n').slice(0, 6).join('\n').replace(/^#+\s*/, '').trim();
+ sections.push(`**Shard ${label}**: ${lines}`);
+ } else {
+ missing += 1;
+ sections.push(`**Shard ${label}**: _summary.md missing_`);
+ }
+ const junitPath = path.join(src, 'junit.xml');
+ if (fs.existsSync(junitPath)) {
+ const xml = fs.readFileSync(junitPath, 'utf8').replace(/<\?xml[^>]*\?>/g, '').trim();
+ const inner = xml.replace(/^<testsuites\b[^>]*>/, '').replace(/<\/testsuites>\s*$/, '').trim();
+ if (inner) suites.push(inner);
+ }
+ const dstShard = path.join(outDir, 'shards', `shard-${idx}`);
+ for (const entry of ['report.json', 'junit.xml', 'results', 'artifacts']) {
+ const p = path.join(src, entry);
+ if (fs.existsSync(p)) {
+ fs.mkdirSync(dstShard, { recursive: true });
+ fs.cpSync(p, path.join(dstShard, entry), { recursive: true });
+ }
+ }
+ }
+ const icon = totalFailed > 0 || missing > 0 ? '🔴' : '🟢';
+ const counts = [];
+ if (totalFailed > 0) counts.push(`${totalFailed} failed`);
+ if (totalPassed > 0) counts.push(`${totalPassed} passed`);
+ if (missing > 0) counts.push(`${missing} shard(s) missing`);
+ const headline = counts.length ? `### ${icon} e2e: ${counts.join(', ')}` : `### ${icon} e2e: no results`;
+ fs.writeFileSync(path.join(outDir, 'summary.md'), `${headline}\n\n${sections.join('\n\n')}\n`);
+ if (suites.length) {
+ fs.writeFileSync(path.join(outDir, 'junit.xml'), `<?xml version="1.0" encoding="UTF-8"?>\n<testsuites>\n${suites.join('\n')}\n</testsuites>\n`);
+ }
+ NODE
- name: Redact seed-like word runs from the results
id: redact
if: always()
- run: node cake-qa/tools/qa/redact.mjs cake-qa/.e2e
+ run: |
+ if [ -d cake-qa/.e2e ]; then
+ node cake-qa/tools/qa/redact.mjs cake-qa/.e2e
+ fi
- name: Upload results
if: always() && steps.redact.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: e2e-results-ios
- path: |
- cake-qa/.e2e/junit.xml
- cake-qa/.e2e/summary.md
+ path: cake-qa/.e2e/summary.md
+ include-hidden-files: true
if-no-files-found: warn
- name: Encrypt the agent trace and screenshots
if: always() && steps.redact.outcome == 'success'
- working-directory: cake-qa/.e2e
env:
- QA_ARTIFACT_PASSPHRASE: ${{ secrets.QA_ARTIFACT_PASSPHRASE }}
+ QA_ARTIFACT_PGP_KEYS: ${{ vars.QA_ARTIFACT_PGP_KEYS }}
run: |
- [ -n "$QA_ARTIFACT_PASSPHRASE" ] || exit 0
- FILES=$(ls -d report.json artifacts 2>/dev/null || true)
+ set -euo pipefail
+ [ -n "$QA_ARTIFACT_PGP_KEYS" ] || exit 0
+ [ -d cake-qa/.e2e ] || exit 0
+ cd cake-qa/.e2e
+ FILES=$(ls -d report.json junit.xml results artifacts shards 2>/dev/null || true)
[ -n "$FILES" ] || exit 0
- tar czf - $FILES | openssl enc -aes-256-cbc -pbkdf2 -salt -pass env:QA_ARTIFACT_PASSPHRASE -out "$RUNNER_TEMP/e2e-trace-ios.tgz.enc"
+ command -v gpg >/dev/null 2>&1 || brew install gnupg >/dev/null
+ export GNUPGHOME
+ GNUPGHOME=$(mktemp -d)
+ chmod 700 "$GNUPGHOME"
+ trap 'rm -rf "$GNUPGHOME"' EXIT
+ printf '%s\n' "$QA_ARTIFACT_PGP_KEYS" | gpg --batch --import
+ RECIPIENTS=()
+ while IFS= read -r fpr; do
+ [ -n "$fpr" ] && RECIPIENTS+=(-r "$fpr")
+ done < <(gpg --batch --list-keys --with-colons | awk -F: '$1=="pub" && $2!="e" && $2!="r"{p=1;next} $1=="fpr" && p{print $10; p=0} $1!="fpr"{p=0}')
+ [ "${#RECIPIENTS[@]}" -gt 0 ] || { echo "::error::no PGP recipient keys imported"; exit 1; }
+ tar czf - $FILES | gpg --batch --yes --trust-model always --encrypt "${RECIPIENTS[@]}" --output "$RUNNER_TEMP/e2e-trace-ios.tgz.gpg"
- name: Upload the encrypted trace
if: always() && steps.redact.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: e2e-trace-ios
- path: ${{ runner.temp }}/e2e-trace-ios.tgz.enc
+ path: ${{ runner.temp }}/e2e-trace-ios.tgz.gpg
if-no-files-found: ignoreWhy this scored 27/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.