Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
mac_package: ${{ steps.scope.outputs.mac_package }}
focused: ${{ steps.scope.outputs.focused }}
full: ${{ steps.scope.outputs.full }}
mobile: ${{ steps.scope.outputs.mobile }}
docs_only: ${{ steps.docs.outputs.docs_only }}
env:
GH_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -863,6 +864,16 @@ jobs:
pr_macos: ${{ needs.version.outputs.mac_package == 'true' }}
full: ${{ needs.version.outputs.full == 'true' }}

mobile:
name: Check and deliver OX Mobile
needs: version
if: >-
needs.version.outputs.mobile == 'true' ||
(github.ref == 'refs/heads/main' && needs.version.outputs.docs_only != 'true' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch'))
uses: ./.github/workflows/mobile.yml
secrets: inherit

# The publish jobs run for the first time on main or a tag. This runs their
# asset check on the artifacts of a full-ci pull request, which builds the
# same four platforms, so a renamed artifact or file is caught before merge.
Expand Down Expand Up @@ -895,7 +906,7 @@ jobs:
merge:
name: OX merge check
if: ${{ always() && (github.event_name == 'pull_request' || github.event_name == 'merge_group') }}
needs: [version, fast, verify, release, native, focused, desktop-release, release-assets]
needs: [version, fast, verify, release, native, focused, desktop-release, mobile, release-assets]
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
Expand All @@ -908,7 +919,7 @@ jobs:
jobs = json.loads(os.environ["RESULTS"])
scope = jobs["version"]["outputs"]
selected = {"version", "fast", "verify", "release"}
for job, flag in [("native", "native"), ("desktop-release", "packages"),
for job, flag in [("native", "native"), ("desktop-release", "packages"), ("mobile", "mobile"),
("release-assets", "full")]:
if scope[flag] == "true":
selected.add(job)
Expand Down
191 changes: 191 additions & 0 deletions .github/workflows/mobile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: OX Mobile

on:
workflow_call:

permissions:
contents: read

jobs:
build:
name: Build unsigned iPhone app
runs-on: xcode-27
timeout-minutes: 40
env:
OX_IOS_BUNDLE_ID: dev.ox.mobile
OX_IOS_BUILD_NUMBER: ${{ github.run_number }}.${{ github.run_attempt }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust for iPhone
run: rustup toolchain install 1.100.0 --profile minimal --target aarch64-apple-ios
- name: Build the app and compile the icon
env:
RUSTUP_TOOLCHAIN: 1.100.0
CARGO_TARGET_DIR: ${{ runner.temp }}/ox-ios-target
run: desktop/ox-mobile/build-testflight.sh "$RUNNER_TEMP/mobile-ios-unsigned.zip"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: mobile-ios-unsigned
path: ${{ runner.temp }}/mobile-ios-unsigned.zip
if-no-files-found: error
compression-level: 0

launch:
name: Launch on an iOS 27 simulator
runs-on: xcode-27
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Rust for the iPhone simulator
run: rustup toolchain install 1.100.0 --profile minimal --target aarch64-apple-ios-sim
- name: Build for the iPhone simulator
env:
RUSTUP_TOOLCHAIN: 1.100.0
CARGO_TARGET_DIR: ${{ runner.temp }}/ox-ios-target
run: desktop/ox-mobile/build.sh aarch64-apple-ios-sim
- name: Launch OX Mobile in the iPhone simulator
run: |
bash desktop/ox-mobile/check-ios-launch.sh \
"$RUNNER_TEMP/ox-ios-target/aarch64-apple-ios-sim/OXGPUIProbe.app" "$RUNNER_TEMP/ox-ios-launch"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: mobile-ios-launch
path: ${{ runner.temp }}/ox-ios-launch

android:
name: Build and launch on Android
runs-on: ubuntu-24.04
timeout-minutes: 40
env:
RUSTUP_TOOLCHAIN: 1.100.0
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install the Android toolchain and emulator image
run: |
echo "CARGO_TARGET_DIR=$RUNNER_TEMP/ox-android-target" >> "$GITHUB_ENV"
printf '%s\n' "$ANDROID_HOME/cmdline-tools/latest/bin" "$ANDROID_HOME/emulator" \
"$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
export JAVA_HOME="$JAVA_HOME_21_X64"
rustup toolchain install 1.100.0 --profile minimal --target x86_64-linux-android
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install \
'ndk;29.0.14206865' 'platforms;android-36' 'build-tools;36.0.0' \
'emulator' 'system-images;android-35;default;x86_64'
- name: Build the debug APK
run: |
export JAVA_HOME="$JAVA_HOME_21_X64"
unset ANDROID_NDK_HOME
desktop/ox-mobile/build-android.sh x86_64-linux-android
- name: Launch OX Mobile in a headless emulator
env:
ANDROID_SERIAL: emulator-5554
run: |
sudo chown "$(id -u):$(id -g)" /dev/kvm
emulator -accel-check
adb start-server
# Give avdmanager and the emulator the same registry on hosted runners.
export ANDROID_AVD_HOME="$RUNNER_TEMP/ox-android-avd"
mkdir -p "$ANDROID_AVD_HOME"
printf 'no\n' | avdmanager create avd --name ox-mobile \
--package 'system-images;android-35;default;x86_64'
emulator -list-avds | grep -Fx ox-mobile
emulator_log="$RUNNER_TEMP/mobile-emulator.log"
# SwiftShader in emulator 37.3.10 can crash in the host Vulkan driver
# when the OX renderer creates its pipelines. Use the bundled Mesa ICD.
emulator -avd ox-mobile -port 5554 -accel on -no-window -no-audio \
-no-snapshot -no-boot-anim -gpu lavapipe > "$emulator_log" 2>&1 &
emulator_pid=$!
trap 'kill "$emulator_pid" 2>/dev/null || true' EXIT
booted=false
boot_deadline=$((SECONDS + 240))
while ((SECONDS < boot_deadline)); do
if ! kill -0 "$emulator_pid" 2>/dev/null; then
break
fi
if [[ "$(timeout 2 adb shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" == 1 ]]; then
booted=true
break
fi
sleep 2
done
if [[ "$booted" != true ]]; then
tail -60 "$emulator_log"
emulator_error="$(awk '/ERROR|FATAL|shared libraries/ { line=$0 } END { print line }' "$emulator_log")"
echo "::error::Android emulator did not boot. $emulator_error"
exit 1
fi
if ! timeout 60 adb install --no-incremental "$CARGO_TARGET_DIR/x86_64-linux-android/OXMobile-debug.apk" ||
! timeout 30 adb shell am start -W -n dev.ox.mobile/dev.gpui.mobile.GpuiInputActivity; then
tail -60 "$emulator_log"
exit 1
fi
sleep 5
if ! timeout 5 adb shell pidof dev.ox.mobile; then
tail -60 "$emulator_log"
timeout 10 adb logcat -d -t 500 || true
exit 1
fi
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: mobile-android-debug
path: |
${{ runner.temp }}/ox-android-target/x86_64-linux-android/OXMobile-debug.apk
${{ runner.temp }}/mobile-emulator.log

upload:
name: Sign and upload to TestFlight
needs: [build, launch]
if: >-
github.ref == 'refs/heads/main' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
# Use the macOS 15 keychain that signed the previous delivery successfully.
runs-on: macos-15
timeout-minutes: 30
environment: apple-release
env:
OX_IOS_BUNDLE_ID: dev.ox.mobile
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
sparse-checkout: desktop/ox-mobile
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: mobile-ios-unsigned
path: ${{ runner.temp }}/unsigned
- name: Sign the app
env:
APPLE_IOS_DISTRIBUTION_P12_BASE64: ${{ secrets.APPLE_IOS_DISTRIBUTION_P12_BASE64 }}
APPLE_IOS_DISTRIBUTION_P12_PASSWORD: ${{ secrets.APPLE_IOS_DISTRIBUTION_P12_PASSWORD }}
APPLE_IOS_APP_STORE_PROFILE_BASE64: ${{ secrets.APPLE_IOS_APP_STORE_PROFILE_BASE64 }}
run: desktop/ox-mobile/sign-testflight.sh "$RUNNER_TEMP/unsigned/mobile-ios-unsigned.zip" "$RUNNER_TEMP/OXMobile.ipa"
- name: Upload to App Store Connect
env:
DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer
APPLE_API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }}
run: |
set -euo pipefail
: "${APPLE_API_KEY_P8:?Missing App Store Connect API private key}"
: "${APPLE_API_KEY_ID:?Missing App Store Connect API key ID}"
: "${APPLE_API_ISSUER_ID:?Missing App Store Connect issuer ID}"
umask 077
export API_PRIVATE_KEYS_DIR
API_PRIVATE_KEYS_DIR="$(mktemp -d "$RUNNER_TEMP/ox-ios-api.XXXXXX")"
trap 'rm -rf "$API_PRIVATE_KEYS_DIR"' EXIT
printf '%s\n' "$APPLE_API_KEY_P8" > "$API_PRIVATE_KEYS_DIR/AuthKey_${APPLE_API_KEY_ID}.p8"
upload_log="$API_PRIVATE_KEYS_DIR/upload.log"
xcrun altool --upload-app --type ios --file "$RUNNER_TEMP/OXMobile.ipa" \
--apiKey "$APPLE_API_KEY_ID" --apiIssuer "$APPLE_API_ISSUER_ID" 2>&1 | tee "$upload_log"
if ! grep -Fq 'UPLOAD SUCCEEDED' "$upload_log"; then
echo '::error::App Store Connect did not report a successful upload.'
exit 1
fi
11 changes: 6 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ you call it done.
| Path | Where it lives | How to exercise it before merge |
| --- | --- | --- |
| Developer ID signing and notarization | `sign-cli` in `ci.yml`, `sign-macos` in `desktop.yml`, `desktop/ci/macos-*.sh` | Manual OX Desktop run with `sign` on a ref the `apple-release` environment admits. Ask the maintainer to admit the branch for that run. |
| TestFlight | `upload` in `mobile.yml` | Pull requests build the unsigned app and run the simulator. Verify signing and upload in the first run on `main`. |
| The release asset list | `desktop/ci/release-assets.sh`, used by both publish jobs | `full-ci` runs it on the pull request's unsigned artifacts (job `release-assets`). Signing itself still runs only on `main`. |
| Publishing | `publish-dev` and `publish` in `ci.yml` | The upload and the swap cannot be rehearsed. Keep changes small and watch the first `main` run. The "is a newer commit already released" test is one API call you can run by hand: `gh api repos/oxstack/ox/compare/<this commit>...<dev tag commit> --jq .status`. |
| Tagged release | `publish` in `ci.yml` | Has never run. Rehearse before the first `v*` tag. |
Expand Down Expand Up @@ -214,9 +215,9 @@ you call it done.
into its base at once and reach nobody. See "Stacked pull requests".
- **A platform a pull request skips is a platform it can break.** Linux ARM
and macOS Intel only run with `full-ci` or on `main`.
- **Any failed job on `main` loses the release for every platform.**
`publish-dev` needs every job. `retry-main.yml` re-runs failed jobs once;
it does not make an intermittent test acceptable.
- **A failed prerequisite of `publish-dev` holds every desktop platform.**
TestFlight delivery is independent. `retry-main.yml` re-runs failed jobs
once; it does not make an intermittent test acceptable.
- **`cargo test -p one-package` is not a slice of `--workspace`.** Cargo
resolves features for the packages it is asked for, so the narrower build
compiles the shared crates and the test again. The package job builds every
Expand Down Expand Up @@ -248,8 +249,8 @@ you call it done.

## Secrets

- The certificate and the App Store Connect key live only in the
`apple-release` environment. Only the two signing jobs enter it.
- The certificates and the App Store Connect key live only in the
`apple-release` environment. The CLI, desktop, and mobile signing jobs enter it.
- Never reference a secret in a job that compiles third-party crates or
installs third-party packages. That is why signing is a separate job.
- Which refs may enter the environment is a repository setting (`main` and
Expand Down
Loading
Loading