From 02047d9f0ca27334e965c47c228a1c6d868b4e15 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 12:42:38 +1100 Subject: [PATCH 01/16] split out different Zig versions in CI to improve clarity when people raise PRs --- .github/workflows/ci.yml | 116 +++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88f1768..d3e105f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,17 @@ concurrency: group: ${{ github.head_ref || github.run_id }}-${{ github.actor }} cancel-in-progress: true +env: + CI_JAVA_VERSION: 17 + # 35.0.0 = Android 15 + CI_ANDROID_SDK: "tools platform-tools platforms;android-35 build-tools;35.0.0 ndk;29.0.13113456" + jobs: - build: - name: Build + build-stable: + name: Build Zig Stable strategy: matrix: + max-parallel: 1 include: - os: "ubuntu-latest" - os: "windows-latest" @@ -26,29 +32,22 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK 17 + - name: Set up JDK $CI_JAVA_VERSION uses: actions/setup-java@v5 with: - java-version: '17' - distribution: 'temurin' + java-version: $CI_JAVA_VERSION + distribution: "temurin" - name: Setup Android SDK uses: android-actions/setup-android@v3 with: - # 35.0.0 = Android 15 - packages: 'tools platform-tools platforms;android-35 build-tools;35.0.0 ndk;29.0.13113456' - - # - # Stable Zig Builds - # + packages: "$CI_ANDROID_SDK" - - name: Setup Zig Stable (0.15.2) + - name: Setup Zig Stable # note(jae): 2024-09-15 # Uses download mirror first as preferred by Zig Foundation # see: https://ziglang.org/news/migrate-to-self-hosting/ uses: mlugg/setup-zig@v2 - with: - version: "0.15.2" - name: Build Minimal Example (Zig Stable) run: zig build -Dandroid=true --verbose @@ -99,31 +98,33 @@ jobs: # adb shell monkey --kill-process-after-error --monitor-native-crashes --pct-touch 100 -p com.zig.sdl2 --throttle 1000 -v 2 # working-directory: examples/sdl2 - # - # Previous Stable Zig Build - # - - - name: Setup Zig Previous Stable (0.14.0) - uses: mlugg/setup-zig@v2 - with: - version: "0.14.0" - - - name: Build Minimal Example (Zig Previous Stable) - run: zig build -Dandroid=true --verbose - working-directory: examples/minimal + build-nightly: + name: Build Zig Master (Latest Dev) + needs: build-stable + strategy: + max-parallel: 1 + matrix: + include: + - os: "ubuntu-latest" + - os: "windows-latest" + - os: "macos-14" # arm64 as per table: https://github.com/actions/runner-images/blob/8a1eeaf6ac70c66f675a04078d1a7222edd42008/README.md#available-images - - name: Build SDL2 Example (Zig Previous Stable) - run: zig build -Dandroid=true --verbose - working-directory: examples/sdl2 + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 - # "Raylib requires zig version 0.15.1" error occurs - # - name: Build Raylib Example (Zig Previous Stable) - # run: zig build -Dandroid=true --verbose - # working-directory: examples/raylib + - name: Set up JDK $CI_JAVA_VERSION + uses: actions/setup-java@v5 + with: + java-version: '$CI_JAVA_VERSION' + distribution: 'temurin' - # - # Nightly Zig Builds - # + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + with: + # 35.0.0 = Android 15 + packages: "$CI_ANDROID_SDK" - name: Setup Zig Nightly uses: mlugg/setup-zig@v2 @@ -144,3 +145,46 @@ jobs: # - name: Build Raylib Example (Zig Nightly) # run: zig build -Dandroid=true --verbose # working-directory: examples/raylib + build-previous: + name: Build Zig 0.14.0 (Previous Stable Release) + strategy: + matrix: + max-parallel: 1 + include: + - os: "ubuntu-latest" + - os: "windows-latest" + - os: "macos-14" # arm64 as per table: https://github.com/actions/runner-images/blob/8a1eeaf6ac70c66f675a04078d1a7222edd42008/README.md#available-images + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v6 + + - name: Set up JDK $CI_JAVA_VERSION + uses: actions/setup-java@v5 + with: + java-version: '$CI_JAVA_VERSION' + distribution: 'temurin' + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + with: + # 35.0.0 = Android 15 + packages: "$CI_ANDROID_SDK" + + # + # Previous Stable Zig Build + # + + - name: Setup Zig Previous Stable (0.14.0) + uses: mlugg/setup-zig@v2 + with: + version: "0.14.0" + + - name: Build Minimal Example (Zig Previous Stable) + run: zig build -Dandroid=true --verbose + working-directory: examples/minimal + + - name: Build SDL2 Example (Zig Previous Stable) + run: zig build -Dandroid=true --verbose + working-directory: examples/sdl2 From f89a5c5a7ee02bfe7de1db807c563cd17c2b7952 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 12:45:18 +1100 Subject: [PATCH 02/16] more --- .github/workflows/ci.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3e105f..5ebc0e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,8 @@ jobs: build-stable: name: Build Zig Stable strategy: + max-parallel: 1 matrix: - max-parallel: 1 include: - os: "ubuntu-latest" - os: "windows-latest" @@ -100,7 +100,7 @@ jobs: build-nightly: name: Build Zig Master (Latest Dev) - needs: build-stable + runs-on: ${{matrix.os}} strategy: max-parallel: 1 matrix: @@ -108,8 +108,6 @@ jobs: - os: "ubuntu-latest" - os: "windows-latest" - os: "macos-14" # arm64 as per table: https://github.com/actions/runner-images/blob/8a1eeaf6ac70c66f675a04078d1a7222edd42008/README.md#available-images - - runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v6 @@ -147,15 +145,14 @@ jobs: # working-directory: examples/raylib build-previous: name: Build Zig 0.14.0 (Previous Stable Release) + runs-on: ${{matrix.os}} strategy: + max-parallel: 1 matrix: - max-parallel: 1 include: - os: "ubuntu-latest" - os: "windows-latest" - os: "macos-14" # arm64 as per table: https://github.com/actions/runner-images/blob/8a1eeaf6ac70c66f675a04078d1a7222edd42008/README.md#available-images - - runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v6 From 114ef2737633e38c12a7f8eb917fc9121c43291c Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 12:46:44 +1100 Subject: [PATCH 03/16] go again --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ebc0e1..33a7d95 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,10 +32,10 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK $CI_JAVA_VERSION + - name: Set up JDK ${{CI_JAVA_VERSION}} uses: actions/setup-java@v5 with: - java-version: $CI_JAVA_VERSION + java-version: ${{CI_JAVA_VERSION}} distribution: "temurin" - name: Setup Android SDK @@ -112,10 +112,10 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK $CI_JAVA_VERSION + - name: Set up JDK ${{CI_JAVA_VERSION}} uses: actions/setup-java@v5 with: - java-version: '$CI_JAVA_VERSION' + java-version: ${{CI_JAVA_VERSION}} distribution: 'temurin' - name: Setup Android SDK @@ -157,11 +157,11 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK $CI_JAVA_VERSION + - name: Set up JDK ${{CI_JAVA_VERSION}} uses: actions/setup-java@v5 with: - java-version: '$CI_JAVA_VERSION' - distribution: 'temurin' + java-version: ${{CI_JAVA_VERSION}} + distribution: "temurin" - name: Setup Android SDK uses: android-actions/setup-android@v3 From 0e7f405690ceae2307e33631af1eff29cd4ec5d9 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 12:48:22 +1100 Subject: [PATCH 04/16] go --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33a7d95..ffc7eac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK ${{CI_JAVA_VERSION}} + - name: Set up JDK uses: actions/setup-java@v5 with: java-version: ${{CI_JAVA_VERSION}} @@ -112,11 +112,11 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK ${{CI_JAVA_VERSION}} + - name: Set up JDK uses: actions/setup-java@v5 with: java-version: ${{CI_JAVA_VERSION}} - distribution: 'temurin' + distribution: "temurin" - name: Setup Android SDK uses: android-actions/setup-android@v3 @@ -157,7 +157,7 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK ${{CI_JAVA_VERSION}} + - name: Set up JDK uses: actions/setup-java@v5 with: java-version: ${{CI_JAVA_VERSION}} From a186468e64a1f59fca69f9e4aead52f2cfe67be3 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 12:57:34 +1100 Subject: [PATCH 05/16] setup --- .github/workflows/ci.yml | 45 +++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffc7eac..602e81a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,19 @@ env: CI_ANDROID_SDK: "tools platform-tools platforms;android-35 build-tools;35.0.0 ndk;29.0.13113456" jobs: + # https://stackoverflow.com/questions/73797254/environment-variables-in-github-actions + setup: + runs-on: ubuntu-latest + steps: + - run: echo "null" + outputs: + java-version: ${{ env.CI_JAVA_VERSION }} + android-sdk: ${{ env.CI_JAVA_VERSION }} + build-stable: name: Build Zig Stable + needs: [setup] + runs-on: ${{matrix.os}} strategy: max-parallel: 1 matrix: @@ -26,23 +37,23 @@ jobs: - os: "ubuntu-latest" - os: "windows-latest" - os: "macos-14" # arm64 as per table: https://github.com/actions/runner-images/blob/8a1eeaf6ac70c66f675a04078d1a7222edd42008/README.md#available-images - - runs-on: ${{matrix.os}} steps: - uses: actions/checkout@v6 - - name: Set up JDK + # Setup Java and Android SDK + - name: Set up JDK ${{ needs.setup.outputs.java-version }} uses: actions/setup-java@v5 with: - java-version: ${{CI_JAVA_VERSION}} + java-version: ${{ needs.setup.outputs.java-version }} distribution: "temurin" - name: Setup Android SDK uses: android-actions/setup-android@v3 with: - packages: "$CI_ANDROID_SDK" + packages: ${{ needs.setup.outputs.android-sdk }} + # Setup Zig version and run examples - name: Setup Zig Stable # note(jae): 2024-09-15 # Uses download mirror first as preferred by Zig Foundation @@ -100,6 +111,7 @@ jobs: build-nightly: name: Build Zig Master (Latest Dev) + needs: [setup] runs-on: ${{matrix.os}} strategy: max-parallel: 1 @@ -112,18 +124,19 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK + # Setup Java and Android SDK + - name: Set up JDK ${{ needs.setup.outputs.java-version }} uses: actions/setup-java@v5 with: - java-version: ${{CI_JAVA_VERSION}} + java-version: ${{ needs.setup.outputs.java-version }} distribution: "temurin" - name: Setup Android SDK uses: android-actions/setup-android@v3 with: - # 35.0.0 = Android 15 - packages: "$CI_ANDROID_SDK" + packages: ${{ needs.setup.outputs.android-sdk }} + # Setup Zig version and run examples - name: Setup Zig Nightly uses: mlugg/setup-zig@v2 with: @@ -145,6 +158,7 @@ jobs: # working-directory: examples/raylib build-previous: name: Build Zig 0.14.0 (Previous Stable Release) + needs: [setup] runs-on: ${{matrix.os}} strategy: max-parallel: 1 @@ -157,22 +171,19 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Set up JDK + # Setup Java and Android SDK + - name: Set up JDK ${{ needs.setup.outputs.java-version }} uses: actions/setup-java@v5 with: - java-version: ${{CI_JAVA_VERSION}} + java-version: ${{ needs.setup.outputs.java-version }} distribution: "temurin" - name: Setup Android SDK uses: android-actions/setup-android@v3 with: - # 35.0.0 = Android 15 - packages: "$CI_ANDROID_SDK" - - # - # Previous Stable Zig Build - # + packages: ${{ needs.setup.outputs.android-sdk }} + # Setup Zig version and run examples - name: Setup Zig Previous Stable (0.14.0) uses: mlugg/setup-zig@v2 with: From e844943774d8df23cf62a4e71982efc98724aa70 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 12:59:13 +1100 Subject: [PATCH 06/16] fix android sdk version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 602e81a..c9e5411 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - run: echo "null" outputs: java-version: ${{ env.CI_JAVA_VERSION }} - android-sdk: ${{ env.CI_JAVA_VERSION }} + android-sdk: ${{ env.CI_ANDROID_SDK }} build-stable: name: Build Zig Stable From 998a0ccdb01ed92d0fa8d76b26ed97435f60fb4a Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 13:02:29 +1100 Subject: [PATCH 07/16] go again --- .github/workflows/ci.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9e5411..37e33e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ env: CI_JAVA_VERSION: 17 # 35.0.0 = Android 15 CI_ANDROID_SDK: "tools platform-tools platforms;android-35 build-tools;35.0.0 ndk;29.0.13113456" + CI_ZIG_PREVIOUS_STABLE_VERSION: "0.14.0" jobs: # https://stackoverflow.com/questions/73797254/environment-variables-in-github-actions @@ -25,6 +26,7 @@ jobs: outputs: java-version: ${{ env.CI_JAVA_VERSION }} android-sdk: ${{ env.CI_ANDROID_SDK }} + zig-previous-stable-version: ${{ env.CI_ZIG_PREVIOUS_STABLE_VERSION }} build-stable: name: Build Zig Stable @@ -110,7 +112,7 @@ jobs: # working-directory: examples/sdl2 build-nightly: - name: Build Zig Master (Latest Dev) + name: Build Zig Nightly needs: [setup] runs-on: ${{matrix.os}} strategy: @@ -156,8 +158,8 @@ jobs: # - name: Build Raylib Example (Zig Nightly) # run: zig build -Dandroid=true --verbose # working-directory: examples/raylib - build-previous: - name: Build Zig 0.14.0 (Previous Stable Release) + build-previous-stable: + name: Build Zig Previous (${{ needs.setup.outputs.zig-previous-stable-version }}) needs: [setup] runs-on: ${{matrix.os}} strategy: @@ -184,15 +186,15 @@ jobs: packages: ${{ needs.setup.outputs.android-sdk }} # Setup Zig version and run examples - - name: Setup Zig Previous Stable (0.14.0) + - name: Setup Zig uses: mlugg/setup-zig@v2 with: - version: "0.14.0" + version: ${{ needs.setup.outputs.zig-previous-stable-version }} - - name: Build Minimal Example (Zig Previous Stable) + - name: Build Minimal Example run: zig build -Dandroid=true --verbose working-directory: examples/minimal - - name: Build SDL2 Example (Zig Previous Stable) + - name: Build SDL2 Example run: zig build -Dandroid=true --verbose working-directory: examples/sdl2 From 031bef03ca12130bc846ddb075805807597775f0 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 13:17:44 +1100 Subject: [PATCH 08/16] fix --- examples/raylib/build.zig | 5 ----- examples/raylib/build.zig.zon | 4 ++-- src/androidbuild/apk.zig | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index c6f85bc..d362cbe 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -43,11 +43,6 @@ pub fn build(b: *std.Build) void { .linkage = .dynamic, .name = exe_name, .root_module = lib_mod, - // note(jae): 2025-09-19 - // Force use_llvm = true, to workaround issue in Zig 0.15.1 where an error occurs with - // - step: compile lib raylib Debug x86_64-linux-android failure - // panic: "TODO unhandled compression scheme" - .use_llvm = if (target.result.abi.isAndroid()) true else null, }); b.installArtifact(lib); diff --git a/examples/raylib/build.zig.zon b/examples/raylib/build.zig.zon index 3ae5c28..68a52c7 100644 --- a/examples/raylib/build.zig.zon +++ b/examples/raylib/build.zig.zon @@ -6,8 +6,8 @@ .dependencies = .{ .android = .{ .path = "../.." }, .raylib_zig = .{ - .url = "git+https://github.com/raylib-zig/raylib-zig#d64fc43f38949231dc7d6f1c016db8fcae858b8c", - .hash = "raylib_zig-5.6.0-dev-KE8REDc2BQCri1t11guC1tZA-Luc7NuVeml_59LSELLe", + .url = "git+https://github.com/raylib-zig/raylib-zig#cd71c85d571027ac8033357f83b124ee051825b3", + .hash = "raylib_zig-5.6.0-dev-KE8REENOBQC-m5nK7M2b5aKSIubJPbPLUYcRhT7aT3RN", }, }, .paths = .{ diff --git a/src/androidbuild/apk.zig b/src/androidbuild/apk.zig index 01e1ded..c9ca45f 100644 --- a/src/androidbuild/apk.zig +++ b/src/androidbuild/apk.zig @@ -94,7 +94,7 @@ pub fn create(sdk: *Sdk, options: Options) *Apk { .artifacts = .empty, .java_files = .empty, .resources = .empty, - .assets = .empty + .assets = .empty, }; return apk; } @@ -362,7 +362,7 @@ fn doInstallApk(apk: *Apk) std.mem.Allocator.Error!*Step.InstallFile { .directory => |asset_dir| { aapt2link.addArg("-A"); aapt2link.addDirectoryArg(asset_dir.source); - } + }, } } @@ -450,6 +450,18 @@ fn doInstallApk(apk: *Apk) std.mem.Allocator.Error!*Step.InstallFile { @panic(b.fmt("artifact[{d}] has no 'target' set", .{artifact_index})); }; + // NOTE(jae): 2026-02-01 + // If not explicitly set in users build, default to using LLVM and LLD for Android builds + // as that's the same toolchain that the Android SDK uses. + // + // This also can resolve issues with Zigs linker not yet supporting certain compression schemes/etc + if (artifact.use_llvm == null) { + artifact.use_llvm = true; + } + if (artifact.use_lld == null) { + artifact.use_lld = true; + } + // https://developer.android.com/ndk/guides/abis#native-code-in-app-packages const so_dir: []const u8 = switch (target.result.cpu.arch) { .aarch64 => "arm64-v8a", From d565da0bdd24b6dbf20ad9b1535f47e3365ce938 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 13:19:17 +1100 Subject: [PATCH 09/16] remove raylib patch --- examples/raylib/build.zig | 7 ------- 1 file changed, 7 deletions(-) diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index d362cbe..d50c60b 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -52,13 +52,6 @@ pub fn build(b: *std.Build) void { .optimize = optimize, .android_api_version = @as([]const u8, b.fmt("{}", .{@intFromEnum(apk.api_level)})), .android_ndk = @as([]const u8, apk.ndk.path), - // NOTE(jae): 2025-09-19 - // Avoid compilation errors on Linux systems that don't have 'wayland-scanner' - // ie. - // $ zig build -Dandroid=true --verbose - // `wayland-scanner` may not be installed on the system. - // You can switch to X11 in your `build.zig` by changing `Options.linux_display_backend` - .linux_display_backend = .X11, // Avoid build issues on Linux systems }) else b.dependency("raylib_zig", .{ From 56a8dc555beaa0fcf270d09231099291e7a572b8 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 13:34:08 +1100 Subject: [PATCH 10/16] more adjustments --- .github/workflows/ci.yml | 14 +++++++++----- examples/raylib/build.zig | 35 ++++++++++++++++------------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37e33e4..59761a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ env: # 35.0.0 = Android 15 CI_ANDROID_SDK: "tools platform-tools platforms;android-35 build-tools;35.0.0 ndk;29.0.13113456" CI_ZIG_PREVIOUS_STABLE_VERSION: "0.14.0" + CI_ZIG_STABLE_VERSION: "0.15.1" jobs: # https://stackoverflow.com/questions/73797254/environment-variables-in-github-actions @@ -26,10 +27,11 @@ jobs: outputs: java-version: ${{ env.CI_JAVA_VERSION }} android-sdk: ${{ env.CI_ANDROID_SDK }} + zig-stable-version: ${{ env.CI_ZIG_STABLE_VERSION }} zig-previous-stable-version: ${{ env.CI_ZIG_PREVIOUS_STABLE_VERSION }} build-stable: - name: Build Zig Stable + name: Build Zig Stable (${{ needs.setup.outputs.zig-stable-version }}) needs: [setup] runs-on: ${{matrix.os}} strategy: @@ -56,11 +58,13 @@ jobs: packages: ${{ needs.setup.outputs.android-sdk }} # Setup Zig version and run examples - - name: Setup Zig Stable + - name: Setup Zig # note(jae): 2024-09-15 # Uses download mirror first as preferred by Zig Foundation # see: https://ziglang.org/news/migrate-to-self-hosting/ uses: mlugg/setup-zig@v2 + with: + version: ${{ needs.setup.outputs.zig-stable-version }} - name: Build Minimal Example (Zig Stable) run: zig build -Dandroid=true --verbose @@ -72,9 +76,9 @@ jobs: zig build -Dandroid=true -Dcrash-on-exception --verbose working-directory: examples/sdl2 - - name: Build Raylib Example (Zig Stable) - run: zig build -Dandroid=true --verbose - working-directory: examples/raylib + # - name: Build Raylib Example (Zig Stable) + # run: zig build -Dandroid=true --verbose + # working-directory: examples/raylib # TODO(jae): 2025-03-30 # Need to figure out how to get 'adb shell monkey' to return an error code or be able to return an error code diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index d50c60b..5f57cd9 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -1,5 +1,5 @@ -const android = @import("android"); const std = @import("std"); +const android = @import("android"); const exe_name = "raylib"; @@ -33,18 +33,12 @@ pub fn build(b: *std.Build) void { }; for (targets) |target| { - const lib_mod = b.createModule(.{ + const app = b.createModule(.{ .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, .link_libc = true, }); - const lib = b.addLibrary(.{ - .linkage = .dynamic, - .name = exe_name, - .root_module = lib_mod, - }); - b.installArtifact(lib); const raylib_dep = if (android_apk) |apk| b.dependency("raylib_zig", .{ @@ -57,28 +51,31 @@ pub fn build(b: *std.Build) void { b.dependency("raylib_zig", .{ .target = target, .optimize = optimize, - .linkage = std.builtin.LinkMode.dynamic, + .linkage = .dynamic, }); - const raylib_artifact = raylib_dep.artifact("raylib"); - lib.root_module.linkLibrary(raylib_artifact); - const raylib_mod = raylib_dep.module("raylib"); - lib.root_module.addImport("raylib", raylib_mod); + app.linkLibrary(raylib_dep.artifact("raylib")); + app.addImport("raylib", raylib_dep.module("raylib")); if (android_apk) |apk| { const android_dep = b.dependency("android", .{ .target = target, .optimize = optimize, }); - lib.root_module.addImport("android", android_dep.module("android")); - lib.root_module.linkSystemLibrary("android", .{}); + app.addImport("android", android_dep.module("android")); + app.linkSystemLibrary("android", .{}); const native_app_glue_dir: std.Build.LazyPath = .{ .cwd_relative = b.fmt("{s}/sources/android/native_app_glue", .{apk.ndk.path}) }; - lib.root_module.addCSourceFile(.{ .file = native_app_glue_dir.path(b, "android_native_app_glue.c") }); - lib.root_module.addIncludePath(native_app_glue_dir); - apk.addArtifact(lib); + app.addCSourceFile(.{ .file = native_app_glue_dir.path(b, "android_native_app_glue.c") }); + app.addIncludePath(native_app_glue_dir); + + apk.addArtifact(b.addLibrary(.{ + .linkage = .dynamic, + .name = exe_name, + .root_module = app, + })); } else { - const exe = b.addExecutable(.{ .name = exe_name, .root_module = lib_mod }); + const exe = b.addExecutable(.{ .name = exe_name, .root_module = app }); b.installArtifact(exe); const run_exe = b.addRunArtifact(exe); From cda30ea106b9912a6a02cb034a359be63094203f Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 13:49:32 +1100 Subject: [PATCH 11/16] fix link mode --- examples/raylib/build.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index 5f57cd9..37616bb 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -1,5 +1,6 @@ const std = @import("std"); const android = @import("android"); +const LinkMode = std.builtin.LinkMode; const exe_name = "raylib"; @@ -51,7 +52,7 @@ pub fn build(b: *std.Build) void { b.dependency("raylib_zig", .{ .target = target, .optimize = optimize, - .linkage = .dynamic, + .linkage = LinkMode.dynamic, }); app.linkLibrary(raylib_dep.artifact("raylib")); From 6464a4814ba7d89e459d584decf2742e46238f4b Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 13:52:19 +1100 Subject: [PATCH 12/16] run --- .github/workflows/ci.yml | 3 +++ examples/raylib/build.zig | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59761a3..e38f0a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,9 @@ jobs: with: version: ${{ needs.setup.outputs.zig-stable-version }} + - name: Format Check + run: zig fmt --check . + - name: Build Minimal Example (Zig Stable) run: zig build -Dandroid=true --verbose working-directory: examples/minimal diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index 37616bb..8604592 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -61,7 +61,7 @@ pub fn build(b: *std.Build) void { if (android_apk) |apk| { const android_dep = b.dependency("android", .{ .target = target, - .optimize = optimize, + .optimize = optimize }); app.addImport("android", android_dep.module("android")); app.linkSystemLibrary("android", .{}); From 5d3ab5405861c65a8f90aac986d95b91590df9f1 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 14:03:05 +1100 Subject: [PATCH 13/16] add format check step --- .github/workflows/ci.yml | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e38f0a4..24d7519 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,8 +19,28 @@ env: CI_ZIG_STABLE_VERSION: "0.15.1" jobs: + format: + name: zig fmt --check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Setup Zig + uses: mlugg/setup-zig@v2 + + # Run format check + - name: Zig Format Check + run: zig fmt --check . + + # Run AST check + - name: AST Check (src/androidbuild) + run: + - zig fmt --ast-check ./build.zig + - zig fmt --ast-check ./src/androidbuild + # https://stackoverflow.com/questions/73797254/environment-variables-in-github-actions setup: + needs: [format] runs-on: ubuntu-latest steps: - run: echo "null" @@ -30,6 +50,7 @@ jobs: zig-stable-version: ${{ env.CI_ZIG_STABLE_VERSION }} zig-previous-stable-version: ${{ env.CI_ZIG_PREVIOUS_STABLE_VERSION }} + build-stable: name: Build Zig Stable (${{ needs.setup.outputs.zig-stable-version }}) needs: [setup] @@ -66,9 +87,6 @@ jobs: with: version: ${{ needs.setup.outputs.zig-stable-version }} - - name: Format Check - run: zig fmt --check . - - name: Build Minimal Example (Zig Stable) run: zig build -Dandroid=true --verbose working-directory: examples/minimal @@ -79,9 +97,9 @@ jobs: zig build -Dandroid=true -Dcrash-on-exception --verbose working-directory: examples/sdl2 - # - name: Build Raylib Example (Zig Stable) - # run: zig build -Dandroid=true --verbose - # working-directory: examples/raylib + - name: Build Raylib Example (Zig Stable) + run: zig build -Dandroid=true --verbose + working-directory: examples/raylib # TODO(jae): 2025-03-30 # Need to figure out how to get 'adb shell monkey' to return an error code or be able to return an error code From 730bbf4626f61a9a5859e35d96c982a8e7000552 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 14:09:32 +1100 Subject: [PATCH 14/16] go --- .github/workflows/ci.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24d7519..3e9f592 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,8 @@ env: CI_ZIG_STABLE_VERSION: "0.15.1" jobs: + # NOTE(jae): 2026-02-01 + # Run a Zig format check before any other steps on latest Zig stable format: name: zig fmt --check runs-on: ubuntu-latest @@ -28,16 +30,19 @@ jobs: - name: Setup Zig uses: mlugg/setup-zig@v2 + # Run AST check + # + # Specifically ignore ./src/android as the runtime has different Zig version for compile-time features + # like @EnumLiteral + - name: AST Check (src/androidbuild) + run: | + zig fmt --ast-check ./build.zig + zig fmt --ast-check ./src/androidbuild + # Run format check - name: Zig Format Check run: zig fmt --check . - # Run AST check - - name: AST Check (src/androidbuild) - run: - - zig fmt --ast-check ./build.zig - - zig fmt --ast-check ./src/androidbuild - # https://stackoverflow.com/questions/73797254/environment-variables-in-github-actions setup: needs: [format] From b748550f77e7e6470eec4e7d01ce43f0bef25b86 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 14:13:01 +1100 Subject: [PATCH 15/16] go --- examples/raylib/build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/raylib/build.zig b/examples/raylib/build.zig index 8604592..37616bb 100644 --- a/examples/raylib/build.zig +++ b/examples/raylib/build.zig @@ -61,7 +61,7 @@ pub fn build(b: *std.Build) void { if (android_apk) |apk| { const android_dep = b.dependency("android", .{ .target = target, - .optimize = optimize + .optimize = optimize, }); app.addImport("android", android_dep.module("android")); app.linkSystemLibrary("android", .{}); From 25c006361cc75213107b1792f5288fe317f7d697 Mon Sep 17 00:00:00 2001 From: Jae B Date: Sun, 1 Feb 2026 14:14:16 +1100 Subject: [PATCH 16/16] adjust --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e9f592..967b441 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,7 @@ jobs: # https://stackoverflow.com/questions/73797254/environment-variables-in-github-actions setup: + name: setup environment variables as outputs needs: [format] runs-on: ubuntu-latest steps: @@ -57,7 +58,7 @@ jobs: build-stable: - name: Build Zig Stable (${{ needs.setup.outputs.zig-stable-version }}) + name: Build Zig Stable needs: [setup] runs-on: ${{matrix.os}} strategy: @@ -189,7 +190,7 @@ jobs: # run: zig build -Dandroid=true --verbose # working-directory: examples/raylib build-previous-stable: - name: Build Zig Previous (${{ needs.setup.outputs.zig-previous-stable-version }}) + name: Build Zig Previous needs: [setup] runs-on: ${{matrix.os}} strategy: