Skip to content

Commit 247e383

Browse files
committed
Add iOS port: simulator-tested app, sharing and SideStore releases
Roamlog now builds, runs and is tested in the iOS simulator on CI; no real iPhone has run it yet (docs/ios-plan.md, Phase 7). Shared mobile code - src/mobile.rs holds platform-neutral GPS fix rules, trip status text, sharing interval, demo GPS and file flows, moved out of android.rs. - sharing/android_app.rs becomes sharing/app.rs for Android and iOS; Keystore, DNS context and the locate service stay Android-only. - UI reaches platform code through crate::platform (android or ios). iOS (src/ios/) - In-process recording with CoreLocation background updates; recovery pauses a trip killed mid-way at its last fix. - Document picker import/export, share sheet, Settings link, local notifications (also in front), roamlog:// links via an app delegate. - Sharing: iroh identity in the Keychain, node in the app process, coarse background location while sharing Always, battery level, fresh-fix bursts on request. - Requires --features sharing, like Android. zgui (Quick-Flash/zgui branch ios) - Redraws re-issued outside drawRect: and paced by UIKit, full-screen surface, safe-area and keyboard insets, status bar style, coverage renderer where Vello lacks indirect execution. Dependencies - vendor/netdev and vendor/netwatch: libc 0.2.190+ gates Darwin route constants and in6_ifreq to macOS, breaking iroh on iOS (see NOTICE). Maps - Imagery picker: Esri, Google or Bing for satellite and 3D views. Build, CI, distribution - cargo xtask ios [--release] [--device] packages Roamlog.app or an unsigned roamlog.ipa (ios/package.sh); ios/check.sh type-checks iOS on Linux with a stub SDK and runs on every push. - Nightly (or manual) macOS job drives the simulator with idb (ios/scenario.sh): map, sheets, recording from simulated GPS, background recording, mid-trip kill recovery, GPX export, keyboard entry, sharing, invite links. - master builds attach roamlog.ipa to nightly releases and update the SideStore source on the fixed sidestore release; Android releases do not wait on iOS.
1 parent 04f79ec commit 247e383

153 files changed

Lines changed: 20093 additions & 450 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 148 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
push:
44
pull_request:
55
workflow_dispatch:
6+
# Nightly full iOS simulator scenario (schedules run on the default branch only).
7+
schedule:
8+
- cron: "0 7 * * *"
69
permissions:
710
contents: read
811
jobs:
@@ -14,20 +17,140 @@ jobs:
1417
with:
1518
toolchain: nightly-2026-03-27
1619
components: rustfmt, clippy
20+
targets: aarch64-apple-ios, aarch64-apple-ios-sim
1721
- name: Native build dependencies
1822
run: sudo apt-get update && sudo apt-get install -y build-essential pkg-config libfontconfig1-dev libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libx11-dev libxcb1-dev libxcursor-dev libxi-dev libxrandr-dev
1923
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
2024
with:
2125
key: checks
2226
- run: cargo xtask verify
27+
# iOS compile errors on every push, without a Mac; ios job below links and runs it.
28+
- name: Check iOS build
29+
run: bash ios/check.sh
2330

24-
android:
31+
# Full simulator scenario (~25 min on macOS): nightly, or started by hand from the Actions tab.
32+
ios:
33+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
34+
runs-on: macos-latest
35+
timeout-minutes: 60
36+
env:
37+
# Rust and C (ring, blake3) must target one iOS version, as ios/package.sh does.
38+
IPHONEOS_DEPLOYMENT_TARGET: "17.0"
39+
steps:
40+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
41+
- uses: dtolnay/rust-toolchain@2c76c034f9e32a5d6e2c104dc4df23a22476db04
42+
with:
43+
toolchain: nightly-2026-03-27
44+
targets: aarch64-apple-ios-sim, aarch64-apple-ios
45+
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
46+
with:
47+
key: ios
48+
# Same IPA path ios-release uses, checked on every push.
49+
- name: Build device IPA
50+
run: |
51+
set -euo pipefail
52+
cargo xtask ios --device
53+
plutil -lint target/aarch64-apple-ios/debug/Roamlog.app/Info.plist
54+
unzip -l target/aarch64-apple-ios/debug/roamlog.ipa | grep -E 'Payload/Roamlog.app/(Roamlog|Info.plist|AppIcon60x60@3x.png)$'
55+
mkdir -p ios-out && unzip -l target/aarch64-apple-ios/debug/roamlog.ipa > ios-out/ipa-contents.txt
56+
- name: Build simulator app
57+
run: cargo xtask ios
58+
- name: Boot simulator
59+
run: |
60+
set -euo pipefail
61+
udid="$(xcrun simctl list devices available -j | python3 -c 'import json,sys; print(next(d["udid"] for r,ds in json.load(sys.stdin)["devices"].items() if "iOS" in r for d in ds if d["name"].startswith("iPhone")))')"
62+
echo "UDID=$udid" >> "$GITHUB_ENV"
63+
xcrun simctl boot "$udid"
64+
xcrun simctl bootstatus "$udid" -b
65+
- name: Install app with demo data
66+
run: |
67+
set -euo pipefail
68+
xcrun simctl install "$UDID" target/aarch64-apple-ios-sim/debug/Roamlog.app
69+
data="$(xcrun simctl get_app_container "$UDID" dev.traveler data)/Library/Application Support/roamlog"
70+
mkdir -p "$data"
71+
cp tests/fixtures/downtown.pmtiles "$data/basemap.pmtiles"
72+
cargo run --locked --no-default-features -- "$data/trips.jsonl" < ios/seed-trips.jsonl > /dev/null
73+
- name: Install idb
74+
run: |
75+
set -euo pipefail
76+
brew tap facebook/fb
77+
brew install facebook/fb/idb-companion
78+
pipx install fb-idb
79+
- name: Run UI scenario
80+
run: |
81+
set -euo pipefail
82+
mkdir -p ios-out
83+
# Companion first: starting it after the app left the home screen in front.
84+
idb_companion --udid "$UDID" > ios-out/idb-companion.log 2>&1 &
85+
# Companion loads simulator frameworks first (~25 s on CI) before it listens.
86+
# No list-targets check: its slow describe makes the client drop the companion.
87+
connected=0
88+
for _ in $(seq 60); do idb connect localhost 10882 2>/dev/null && { connected=1; break; }; sleep 2; done
89+
[ "$connected" = 1 ] || { echo "::error::idb companion never accepted a connection"; exit 1; }
90+
# Location granted up front, so no permission prompt needs tapping.
91+
xcrun simctl privacy "$UDID" grant location dev.traveler
92+
# zgui latency trace (every loop wake, event, park), read back after the scenario.
93+
trace="$(xcrun simctl get_app_container "$UDID" dev.traveler data)/tmp/latency.jsonl"
94+
SIMCTL_CHILD_ZGUI_LATENCY="$trace" xcrun simctl launch --console-pty "$UDID" dev.traveler > ios-out/console.log 2>&1 &
95+
running=1
96+
ios/scenario.sh "$UDID" ios-out || running=0
97+
xcrun simctl spawn "$UDID" launchctl list | grep dev.traveler > /dev/null || { echo "::error::app not running after scenario"; running=0; }
98+
xcrun simctl terminate "$UDID" dev.traveler || true
99+
cp "$trace" ios-out/ || true
100+
[ "$running" = 1 ]
101+
- name: Collect logs
102+
if: always()
103+
run: |
104+
mkdir -p ios-out
105+
xcrun simctl spawn "$UDID" log show --last 10m --style compact --predicate 'process == "Roamlog"' > ios-out/system.log 2>&1 || true
106+
cp ~/Library/Logs/DiagnosticReports/Roamlog* ios-out/ 2>/dev/null || true
107+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
108+
if: always()
109+
with:
110+
name: ios-simulator
111+
path: ios-out/
112+
113+
# Unsigned IPA for SideStore, published with the APKs. No simulator run: a flaky scenario
114+
# must not hold back releases; the ios job tests the same code on every push.
115+
ios-release:
25116
needs: checks
26-
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
117+
if: github.event_name != 'pull_request' && github.event_name != 'schedule' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
118+
runs-on: macos-latest
119+
timeout-minutes: 60
120+
env:
121+
IPHONEOS_DEPLOYMENT_TARGET: "17.0"
122+
steps:
123+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
124+
with:
125+
fetch-depth: 0
126+
- uses: dtolnay/rust-toolchain@2c76c034f9e32a5d6e2c104dc4df23a22476db04
127+
with:
128+
toolchain: nightly-2026-03-27
129+
targets: aarch64-apple-ios
130+
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2
131+
with:
132+
key: ios-release
133+
- name: Build unsigned IPA
134+
run: |
135+
set -euo pipefail
136+
export ROAMLOG_VERSION_CODE="$((1000 + $(git rev-list --count HEAD)))"
137+
cargo xtask ios --release --device
138+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
139+
with:
140+
name: ios-ipa
141+
path: target/aarch64-apple-ios/release/roamlog.ipa
142+
if-no-files-found: error
143+
144+
android:
145+
needs: [checks, ios-release]
146+
# Android releases even when the iOS build failed; the IPA is attached only when it built.
147+
if: always() && needs.checks.result == 'success' && github.event_name != 'pull_request' && github.event_name != 'schedule' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
27148
runs-on: ubuntu-latest
28149
timeout-minutes: 60
29150
permissions:
30151
contents: write
152+
# Reads the ios-release job's IPA artifact.
153+
actions: read
31154
steps:
32155
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
33156
with:
@@ -60,6 +183,7 @@ jobs:
60183
- name: Build main and demo APKs
61184
env:
62185
ROAMLOG_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
186+
GH_TOKEN: ${{ github.token }}
63187
run: |
64188
set -euo pipefail
65189
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/28.2.13676358"
@@ -70,7 +194,10 @@ jobs:
70194
cargo xtask android --release --demo
71195
mkdir dist
72196
cp target/release/apk/roamlog.apk target/release/apk/roamlog-demo.apk dist/
73-
(cd dist && sha256sum *.apk > SHA256SUMS)
197+
if [ "${{ needs.ios-release.result }}" = success ]; then
198+
gh run download "$GITHUB_RUN_ID" --name ios-ipa --dir dist
199+
fi
200+
(cd dist && sha256sum *.apk $(ls *.ipa 2> /dev/null) > SHA256SUMS)
74201
echo "RELEASE_CODE=$ROAMLOG_VERSION_CODE" >> "$GITHUB_ENV"
75202
- name: Keep APK artifacts
76203
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -85,9 +212,26 @@ jobs:
85212
run: |
86213
set -euo pipefail
87214
tag="nightly-${RELEASE_CODE}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
88-
printf 'Automatic ARM64 Android build from %s.\n\nMain: roamlog.apk. Isolated demo: roamlog-demo.apk.\nInstall over existing app; never uninstall to update.\n' "$GITHUB_SHA" > notes.md
215+
printf 'Automatic ARM64 Android and iOS build from %s.\n\nMain: roamlog.apk. Isolated demo: roamlog-demo.apk.\nInstall over existing app; never uninstall to update.\n\niOS: roamlog.ipa (unsigned), installed with SideStore; see README.\n' "$GITHUB_SHA" > notes.md
89216
gh release create "$tag" dist/* --target "$GITHUB_SHA" --title "Roamlog build ${RELEASE_CODE}" --notes-file notes.md --prerelease --latest=false --draft
90217
gh release edit "$tag" --draft=false
218+
echo "RELEASE_TAG=$tag" >> "$GITHUB_ENV"
219+
- name: Point SideStore source at new IPA
220+
if: needs.ios-release.result == 'success'
221+
env:
222+
GH_TOKEN: ${{ github.token }}
223+
GH_REPO: ${{ github.repository }}
224+
run: |
225+
set -euo pipefail
226+
base="https://github.com/$GH_REPO/releases/download"
227+
python3 ios/source.py dist/roamlog.ipa "0.1.$RELEASE_CODE" "$RELEASE_CODE" \
228+
"$base/$RELEASE_TAG/roamlog.ipa" "$base/sidestore/roamlog-source.json" \
229+
"https://raw.githubusercontent.com/$GH_REPO/$GITHUB_SHA/assets/logo.png" > roamlog-source.json
230+
# Fixed tag, so the source URL users add in SideStore never changes.
231+
gh release view sidestore > /dev/null 2>&1 || gh release create sidestore \
232+
--title "SideStore source" --prerelease --latest=false \
233+
--notes "Add https://github.com/$GH_REPO/releases/download/sidestore/roamlog-source.json as a source in SideStore."
234+
gh release upload sidestore roamlog-source.json --clobber
91235
- name: Remove signing key
92236
if: always()
93237
run: rm -f "$RUNNER_TEMP/roamlog.keystore"

0 commit comments

Comments
 (0)