ci: Add lib-vt Android support (#10925)

The PR introduces `lib-vt` Android support as discussed in #10902. 

A few more notes:

- Introduces new CI for Android builds as a change requires NDK to be
configured.
- To build locally, it is required to have the NDK installed in the
system and either have the path exported via `ANDROID_NDK_HOME` pointing
to the exact NDK path or `ANDROID_HOME` or `ANDROID_SDK_ROOT` pointing
at the Android SDK path from which the build system will infer the NDK
path and version.
- 16kb page size alignment is configured for Android 15+. Builds are
backward compatible with 4kb page size devices.
This commit is contained in:
Mitchell Hashimoto
2026-02-21 21:13:23 -08:00
committed by GitHub
11 changed files with 274 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ jobs:
- build-examples
- build-flatpak
- build-libghostty-vt
- build-libghostty-vt-android
- build-libghostty-vt-macos
- build-linux
- build-linux-libghostty
@@ -350,6 +351,57 @@ jobs:
nix develop -c zig build lib-vt \
-Dtarget=${{ matrix.target }}
# lib-vt requires the Android NDK for Android builds
build-libghostty-vt-android:
strategy:
matrix:
target:
[aarch64-linux-android, x86_64-linux-android, arm-linux-androideabi]
runs-on: namespace-profile-ghostty-sm
needs: test
env:
ZIG_LOCAL_CACHE_DIR: /zig/local-cache
ZIG_GLOBAL_CACHE_DIR: /zig/global-cache
ANDROID_NDK_VERSION: r29
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Cache
uses: namespacelabs/nscloud-cache-action@4d61c33d0b4333a518e975a0c4de7633d28713bb # v1.4.1
with:
path: |
/nix
/zig
~/Android/ndk
# Install Nix and use that to run our tests so our environment matches exactly.
- uses: cachix/install-nix-action@2126ae7fc54c9df00dd18f7f18754393182c73cd # v31.9.1
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@3ba601ff5bbb07c7220846facfa2cd81eeee15a1 # v16
with:
name: ghostty
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Setup Android NDK
run: |
NDK_ROOT="$HOME/Android/ndk"
NDK_DIR="$NDK_ROOT/android-ndk-${{ env.ANDROID_NDK_VERSION }}"
if [ ! -d "$NDK_DIR" ]; then
curl -fsSL -o /tmp/ndk.zip \
"https://dl.google.com/android/repository/android-ndk-${{ env.ANDROID_NDK_VERSION }}-linux.zip"
mkdir -p $NDK_ROOT
unzip -q /tmp/ndk.zip -d $NDK_ROOT
rm /tmp/ndk.zip
fi
echo "ANDROID_NDK_HOME=$NDK_DIR" >> "$GITHUB_ENV"
- name: Build
run: |
nix develop -c zig build lib-vt \
-Dtarget=${{ matrix.target }}
build-linux:
strategy:
fail-fast: false