Skip to content
Open
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
0f63ab6
fix : run on lates ubuntu to fix 'awaiting for runner' CI issue
upwelling-twll Mar 2, 2026
a056c78
add temporary ci triger
upwelling-twll Mar 2, 2026
96e1809
fix : ci setup-ubuntu failing when ninja is preinstalled
upwelling-twll Mar 2, 2026
934e046
fix : try 22.04 instead of latest
upwelling-twll Mar 2, 2026
1866f2c
fix : use upload-artifact v4 as v3 is depricated
upwelling-twll Mar 2, 2026
cd66837
fix : vcpkg path must match submodule path hardcoded from CMakePresets
upwelling-twll Mar 2, 2026
6bab1f4
fix : use upload-artifact v4 as v3 is deprecated
upwelling-twll Mar 3, 2026
8862f71
fix : install ubuntu deps as a separate step
upwelling-twll Mar 3, 2026
e0bbab5
fix : rm duplicate shell definition
upwelling-twll Mar 3, 2026
619ccdc
upd: do not trigger on branch
upwelling-twll Mar 5, 2026
20eb56e
upd : remove exta ninja install
upwelling-twll Mar 5, 2026
a441a2a
fix : build-library for test-linux workflow
upwelling-twll Mar 5, 2026
68db8fc
fix missing wslay include in Linux CI builds
upwelling-twll Mar 5, 2026
422d4b2
Merge branch 'master' into ci-actions-linux
upwelling-twll Mar 9, 2026
d8371fd
update : use integrationtest/ instead of client-testrunner repo
upwelling-twll Mar 9, 2026
705fcae
fix : add shell
upwelling-twll Mar 9, 2026
fbc18a2
fix : working dir path
upwelling-twll Mar 9, 2026
4c73ce9
fix : use docker compose
upwelling-twll Mar 9, 2026
a94be73
fix : use root presets
upwelling-twll Mar 9, 2026
94960e2
fix : include lib
upwelling-twll Mar 9, 2026
e3a9cf5
upd : use Task
upwelling-twll Mar 10, 2026
1dd30cb
demonstrate test failure
upwelling-twll Mar 10, 2026
fa27dad
upd : rollback to working test
upwelling-twll Mar 10, 2026
57c0ea1
dbg : trigger on this branch
upwelling-twll Mar 11, 2026
54125dc
dbg : trigger on push
upwelling-twll Mar 11, 2026
65ead39
fix : use correct presets
upwelling-twll Mar 11, 2026
7d88430
fix : setup order, vcpkg path
upwelling-twll Mar 11, 2026
f9b82c9
fix : ensure setup ubuntu first
upwelling-twll Mar 11, 2026
1d994ec
try w/o preset
upwelling-twll Mar 11, 2026
d41c4af
upd : use gradle, install ndk, jdk
upwelling-twll Mar 16, 2026
7889bab
fix : sdkmanager path
upwelling-twll Mar 16, 2026
83394dd
upd : split android wworkflow to actions
upwelling-twll Mar 16, 2026
9377f27
fix : yml syntax
upwelling-twll Mar 16, 2026
5698133
upd : test android
upwelling-twll Mar 16, 2026
8d3de9f
fix : android package name
upwelling-twll Mar 16, 2026
0fd1014
fix : try release instead of debug
upwelling-twll Mar 17, 2026
8c153d8
set ndk in actions
upwelling-twll Mar 17, 2026
f812502
try using taskfile, set more ndk vars
upwelling-twll Mar 17, 2026
3ec779d
fix syntax error
upwelling-twll Mar 17, 2026
cb375e7
fix : run sell script in one line
upwelling-twll Mar 17, 2026
0c8ab0c
fix : emulator config
upwelling-twll Mar 17, 2026
6f18051
try emulator with arm64
upwelling-twll Mar 17, 2026
bcea4a9
accept liceanses
upwelling-twll Mar 17, 2026
24f09a3
accept licenses
upwelling-twll Mar 17, 2026
531b420
upd : try run on arm64
upwelling-twll Mar 17, 2026
eb51a78
fix : use correct runner name
upwelling-twll Mar 17, 2026
914e0c9
add sdk initialization to the runner
upwelling-twll Mar 17, 2026
dec1c94
add jdk
upwelling-twll Mar 17, 2026
983cc75
adjust to arm
upwelling-twll Mar 17, 2026
eec2d04
upd : build for x86_64
upwelling-twll Mar 17, 2026
fa44897
fix : reduce load test by 25mb
upwelling-twll Mar 17, 2026
bc589bd
dbg : mute throughput test
upwelling-twll Mar 17, 2026
f3c27e0
dbg : mute stress tests
upwelling-twll Mar 17, 2026
6562040
dbg : compile only 1 file at a time
upwelling-twll Mar 17, 2026
f342d8a
dbg : run tests sequentially
upwelling-twll Mar 17, 2026
326c233
dbg : thread for tst
upwelling-twll Mar 17, 2026
3ca5fb3
return mutes tests
upwelling-twll Mar 17, 2026
5b3cc6e
fix : define ANDROID to run tests sequentially on emulator
upwelling-twll Mar 18, 2026
8862ed3
Merge branch 'ci-actions-android' into ci-fix-android
upwelling-twll Mar 18, 2026
db16e45
upd : trigger linux and android build
upwelling-twll Mar 18, 2026
7d86ebf
upd : trigger linux and android tests
upwelling-twll Mar 18, 2026
56b24cd
upd : return to regulat workflow
upwelling-twll Mar 18, 2026
4004717
upd : reduce timeout, rm comments
upwelling-twll Mar 18, 2026
0a8228b
try prallel build
upwelling-twll Mar 18, 2026
6d6e0b9
Remove redundant cmake variables
upwelling-twll Mar 18, 2026
c39bbf7
upd: use commit sha for emulator-runner
upwelling-twll Mar 18, 2026
043fb6a
upd : rm double jdk install
upwelling-twll Mar 18, 2026
578647a
upd : rm useless preset var
upwelling-twll Mar 18, 2026
0a6deab
add script, rm teamplates from taskfile
upwelling-twll Mar 19, 2026
7d7ac2e
Merge branch 'ci-fix-android' into android-sh
upwelling-twll Mar 19, 2026
c346da0
upd : rm comments, add env presets
upwelling-twll Mar 19, 2026
e897c26
trigger on this branch
upwelling-twll Mar 19, 2026
e762b71
increase timeout
upwelling-twll Mar 19, 2026
248a31b
upd : gradle version to fix syntax
upwelling-twll Mar 19, 2026
3af9a2a
use gradle debug
upwelling-twll Mar 19, 2026
2ecad25
add : aapt2 repository
upwelling-twll Mar 19, 2026
7ec1d89
fix : add repos
upwelling-twll Mar 19, 2026
93acfe8
fix : matching minsdk versions
upwelling-twll Mar 19, 2026
80d99f0
fix : set adb
upwelling-twll Mar 19, 2026
0433eba
dbg: timeout
upwelling-twll Mar 20, 2026
cdb64e5
dbg : add caching, time
upwelling-twll Mar 20, 2026
3378072
fix : apk path
upwelling-twll Mar 20, 2026
4be85f0
fix : signing issue
upwelling-twll Mar 20, 2026
d3c9b6b
fix : bash syntax
upwelling-twll Mar 20, 2026
8a53097
fix : app now had sdk .so right in jniLib folder; add logs for androi…
upwelling-twll Mar 20, 2026
fe12a95
fix error type 3 issue with ANR
upwelling-twll Mar 20, 2026
c44dcfd
fixx recursion error
upwelling-twll Mar 21, 2026
f17e890
dbg : try reduced volume for throughout tests
upwelling-twll Mar 21, 2026
13b27a8
dbg : increase timeout
upwelling-twll Mar 23, 2026
75fe2a2
trigger in master
upwelling-twll Mar 23, 2026
ad9a97d
upd : increase timeout, build only release
upwelling-twll Mar 23, 2026
9b408fa
add release artifacts upload
upwelling-twll Mar 23, 2026
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
2 changes: 1 addition & 1 deletion .github/actions/build-library-and-upload/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
- id: build
run: |
rm -rf out
cmake --preset ${{ inputs.preset }} -DBUILD_SHARED_LIBS=ON
cmake --preset ${{ inputs.preset }}
cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} --verbose
cmake --install ./build/${{ inputs.preset }} --config ${{ inputs.build-type }}
working-directory: ${{ inputs.nakama-cpp-path }}
Expand Down
85 changes: 85 additions & 0 deletions .github/actions/setup-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: 'Setup Android'
description: 'Sets up Java and Android SDK components'
inputs:
java-version:
description: 'Java version'
required: false
default: '17'
ndk-version:
description: 'Android NDK version'
required: true
cmake-version:
description: 'Android CMake version'
required: true
install-emulator:
description: 'Whether to install emulator packages'
required: false
default: 'false'
system-image:
description: 'Android system image package'
required: false
default: ''

runs:
using: "composite"
steps:
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ inputs.java-version }}

- name: Install Android SDK packages
shell: bash
run: |
set -euo pipefail

# Initialize ANDROID_HOME if not set (standard on x86, missing on ARM)
if [ -z "${ANDROID_HOME:-}" ]; then
export ANDROID_HOME="$HOME/android-sdk"
mkdir -p "$ANDROID_HOME"
fi
echo "ANDROID_HOME=$ANDROID_HOME" >> "$GITHUB_ENV"

# Install command-line tools if missing
if [ ! -d "$ANDROID_HOME/cmdline-tools/latest" ]; then
echo "Downloading Android Command Line Tools..."
mkdir -p "$ANDROID_HOME/cmdline-tools"
curl -LSs https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -o cmdline-tools.zip
unzip -q cmdline-tools.zip -d "$ANDROID_HOME/cmdline-tools"
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest"
rm cmdline-tools.zip
fi

SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"

packages=(
"ndk;${{ inputs.ndk-version }}"
"cmake;${{ inputs.cmake-version }}"
)
Comment on lines +56 to +59

#use emulator for test-android
if [ "${{ inputs.install-emulator }}" = "true" ]; then
packages+=("emulator")
packages+=("platform-tools")
if [ -n "${{ inputs.system-image }}" ]; then
packages+=("${{ inputs.system-image }}")
fi
fi

# Accept licenses
yes | "$SDKMANAGER" --sdk_root="$ANDROID_HOME" --licenses || true

"$SDKMANAGER" --sdk_root="$ANDROID_HOME" "${packages[@]}"

- name: Set Android environment variables
shell: bash
run: |
export NDK_PATH="$ANDROID_HOME/ndk/${{ inputs.ndk-version }}"
echo "ANDROID_NDK=$NDK_PATH" >> "$GITHUB_ENV"
echo "ANDROID_NDK_HOME=$NDK_PATH" >> "$GITHUB_ENV"
echo "ANDROID_NDK_ROOT=$NDK_PATH" >> "$GITHUB_ENV"
echo "ANDROID_HOME=$ANDROID_HOME" >> "$GITHUB_ENV"
echo "$ANDROID_HOME/cmake/${{ inputs.cmake-version }}/bin" >> "$GITHUB_PATH"
echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH"
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH"
19 changes: 19 additions & 0 deletions .github/actions/setup-vcpkg-android/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Setup vcpkg for Android'
description: 'Setup vcpkg for Android workflow'
inputs:
vcpkg-path:
description: 'Path to vcpkg'
required: true

runs:
using: "composite"
steps:
- name: Set VCPKG_ROOT
shell: bash
run: echo "VCPKG_ROOT=${{ github.workspace }}/${{ inputs.vcpkg-path }}" >> $GITHUB_ENV

- name: Bootstrap vcpkg
shell: bash
run: ./bootstrap-vcpkg.sh -disableMetrics
working-directory: ${{ inputs.vcpkg-path }}

64 changes: 46 additions & 18 deletions .github/workflows/build_android.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,57 @@
name: Build Android
on: [workflow_call, workflow_dispatch]

jobs:
build_android:
timeout-minutes: 30
strategy:
matrix:
preset: ["android-arm64-v8a-host_linux-x64", "android-x64-host_linux-x64", "android-armeabi-v7a-host_linux-x64"]
build-type: [MinSizeRel]
timeout-minutes: 60
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Checkout nakama-cpp
uses: actions/checkout@v4
with:
path: nakama-cpp
- uses: ./nakama-cpp/.github/actions/setup-vcpkg
submodules: false

- name: Checkout vcpkg submodule
run: |
git submodule update --init --filter=blob:none -- submodules/vcpkg
working-directory: nakama-cpp

- uses: ./nakama-cpp/.github/actions/setup-android
with:
github_token: ${{ secrets.github_token }}
vcpkg-path: vcpkg
- uses: ./nakama-cpp/.github/actions/setup-ubuntu
- uses: ./nakama-cpp/.github/actions/build-library-and-upload
ndk-version: 27.2.12479018
cmake-version: 4.0.2

- uses: ./nakama-cpp/.github/actions/setup-vcpkg-android
with:
nakama-cpp-path: nakama-cpp
preset: ${{ matrix.preset }}
build-type: ${{ matrix.build-type }}
- if: failure()
uses: ./nakama-cpp/.github/actions/handle-failure
vcpkg-path: nakama-cpp/submodules/vcpkg

- name : Build with Gradle
run : ./gradlew build --no-daemon
working-directory: nakama-cpp/android

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
nakama-cpp-path: nakama-cpp
vcpkg-path: vcpkg
name: nakama-sdk-android-aar
path: nakama-cpp/android/nakama-sdk/build/outputs/aar/*.aar
if-no-files-found: error

# - name: Install NDK & CMake
# run: |
# # On GitHub ubuntu runners ANDROID_HOME is set as a shell env var.
# # sdkmanager is NOT on PATH, use the full path.
# "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \
# --sdk_root="$ANDROID_HOME" \
# "ndk;27.2.12479018" \
# "cmake;4.0.2"

# - name: Add CMake to PATH
# run: echo "$ANDROID_HOME/cmake/4.0.2/bin" >> "$GITHUB_PATH"

# - name: Set VCPKG_ROOT
# run: echo "VCPKG_ROOT=$GITHUB_WORKSPACE/nakama-cpp/submodules/vcpkg" >> $GITHUB_ENV

# - name: Bootstrap vcpkg
# run: ./bootstrap-vcpkg.sh -disableMetrics
# working-directory: nakama-cpp/submodules/vcpkg
59 changes: 59 additions & 0 deletions .github/workflows/test_android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Test Android
on: [workflow_call, workflow_dispatch, pull_request]

jobs:
test_android:
timeout-minutes: 90
runs-on: ubuntu-22.04
env:
ABI: x86_64
CMAKE_PRESET: android-x86_64

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Checkout nakama-cpp
uses: actions/checkout@v4
with:
path: nakama-cpp
submodules: false

- name: Checkout vcpkg submodule
run: |
git submodule update --init --filter=blob:none -- submodules/vcpkg
Comment on lines +18 to +20
working-directory: nakama-cpp

- uses: ./nakama-cpp/.github/actions/setup-android
with:
ndk-version: 27.2.12479018
cmake-version: 4.0.2
install-emulator: true
system-image: "system-images;android-29;google_apis;x86_64"

- uses: ./nakama-cpp/.github/actions/setup-vcpkg-android
with:
vcpkg-path: nakama-cpp/submodules/vcpkg

- name: Start Nakama server
run: docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait
working-directory: nakama-cpp

- name: Install Task
run: npm install -g @go-task/cli

- name: Run tests on emulator
uses: reactivecircus/android-emulator-runner@v2
Copy link
Contributor

@redbaron redbaron Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pin this third-party action to commit SHA pls

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@novabyte Wondering about licensing implications of this. The runner itself is Apache-2, but the sdk it pulls, especially the google_apis bit might be subject to stricter licensing?
Did we encounter something like this in the past and is this something we'd want to consider?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pin this third-party action to commit SHA pls

Done

with:
api-level: 29
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 4096 -cores 2
disable-animations: true
timeout: 50
script: |
set -xe && for port in 7349 7350 7351; do adb reverse tcp:$port tcp:$port; done && cd nakama-cpp && sleep 30 && task test-android ABI=$ABI CMAKE_EXTRA="-DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_ABI=$ABI"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this test-android task defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is line 65 in Taskfile

8 changes: 8 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@
"ANDROID_ABI": "armeabi-v7a"
}
},
{
"name": "android-x86_64",
"inherits": ["android-default"],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x86-64-android-heroic",
"ANDROID_ABI": "x86_64"
}
},
{
"name": "linux-amd64",
"inherits": ["default"],
Expand Down
3 changes: 2 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ tasks:
-DCMAKE_MAKE_PROGRAM="$(command -v ninja)"

cmake --build "build/{{.CMAKE_PRESET}}" --config Debug \
--target nakama-sdk nakama-test
--target nakama-sdk nakama-test -- -j 1

# --- Stage native libraries for Gradle ---
echo "=== Staging native libraries ==="
Expand All @@ -180,6 +180,7 @@ tasks:
case "{{.ABI}}" in
arm64-v8a) triple="aarch64-linux-android";;
armeabi-v7a) triple="arm-linux-androideabi";;
x86_64) triple="x86_64-linux-android";;
esac
stl_lib="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${HOST_OS}-x86_64/sysroot/usr/lib/${triple}/libc++_shared.so"
if [ -f "$stl_lib" ]; then
Expand Down
12 changes: 7 additions & 5 deletions integrationtests/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ buildscript {
}
}
plugins {
id('com.android.application') version '7.1.1'
id('com.android.application') version '7.3.0'
}

def abi = (project.findProperty("abi") ?: "arm64-v8a").toString()
def supportedAbis = ["arm64-v8a", "armeabi-v7a"]
def supportedAbis = ["arm64-v8a", "armeabi-v7a", "x86_64"]
if (!supportedAbis.contains(abi)) {
throw new GradleException("Unsupported abi '${abi}'. Supported values: ${supportedAbis}")
}
Expand All @@ -40,11 +40,13 @@ repositories {
}

android {
compileSdkVersion 30
compileSdk 34
ndkVersion "27.2.12479018"

defaultConfig {
applicationId "com.heroiclabs.nakamatest"
minSdkVersion 21
targetSdkVersion 31
minSdk 21
targetSdk 34
versionCode 1
versionName '1.0'
ndk {
Expand Down
10 changes: 10 additions & 0 deletions integrationtests/src/NTestLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,18 @@ int runAllTests(
// Run internals first (pure unit tests, no server)
test_internals();

#ifdef ANDROID
// Launch all test groups sequentially to avoid resource contention on emulator
auto startSuite = [](const char* suiteName, void (*suite)()) {
runSuiteSafely(suiteName, suite);
};
#else
// Launch all test groups in parallel threads
std::vector<std::thread> threads;
auto startSuite = [&threads](const char* suiteName, void (*suite)()) {
threads.emplace_back([suiteName, suite]() { runSuiteSafely(suiteName, suite); });
};
#endif

startSuite("test_authentication", test_authentication);
startSuite("test_session", test_session);
Expand All @@ -122,9 +129,12 @@ int runAllTests(
startSuite("test_throughput", test_throughput);
startSuite("test_cancellation", test_cancellation);

#ifndef ANDROID
for (auto& t : threads) {
t.join();
}
#endif


// total stats
uint32_t total = g_runTestsCount.load();
Expand Down
Loading