From 0f63ab69fc741b23e8f366939ead24f558edee51 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 2 Mar 2026 19:58:35 +0400 Subject: [PATCH 001/103] fix : run on lates ubuntu to fix 'awaiting for runner' CI issue --- .github/workflows/build_linux.yml | 2 +- .github/workflows/test_linux.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index ffe79d4d2..dfc37fed1 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -6,7 +6,7 @@ jobs: strategy: matrix: build-type: [MinSizeRel] - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/test_linux.yml b/.github/workflows/test_linux.yml index 0588db580..6d9a215bb 100644 --- a/.github/workflows/test_linux.yml +++ b/.github/workflows/test_linux.yml @@ -6,7 +6,7 @@ jobs: strategy: matrix: build-type: [MinSizeRel] - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: From a056c78a5d935a04d24ba92cfecdd50bd3b43dbd Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 2 Mar 2026 21:11:34 +0400 Subject: [PATCH 002/103] add temporary ci triger --- .github/workflows/build_linux.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index dfc37fed1..0d15b4dac 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -1,5 +1,10 @@ name: Build Linux -on: [workflow_call, workflow_dispatch] +on: + workflow_call: + workflow_dispatch: + push: + branches: + - nata/cicd-linux jobs: build_linux: timeout-minutes: 30 From 96e1809b373c44480349faf580ba845b496a4a4b Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 2 Mar 2026 21:34:59 +0400 Subject: [PATCH 003/103] fix : ci setup-ubuntu failing when ninja is preinstalled --- .github/actions/setup-ubuntu/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-ubuntu/action.yml b/.github/actions/setup-ubuntu/action.yml index 20ac6c635..4fa4ff654 100644 --- a/.github/actions/setup-ubuntu/action.yml +++ b/.github/actions/setup-ubuntu/action.yml @@ -4,9 +4,9 @@ runs: using: "composite" steps: - run: | + mkdir -p ~/bin install_ninja() { ( - mkdir -p ~/bin cd /tmp curl -L -O https://github.com/ninja-build/ninja/releases/download/v1.11.0/ninja-linux.zip unzip ninja-linux.zip From 934e046919b905d2db168ccb733302ac8cccbfff Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 2 Mar 2026 22:04:52 +0400 Subject: [PATCH 004/103] fix : try 22.04 instead of latest --- .github/workflows/build_linux.yml | 2 +- .github/workflows/test_linux.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 0d15b4dac..575c6097f 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: build-type: [MinSizeRel] - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/test_linux.yml b/.github/workflows/test_linux.yml index 6d9a215bb..70c5f0a47 100644 --- a/.github/workflows/test_linux.yml +++ b/.github/workflows/test_linux.yml @@ -6,7 +6,7 @@ jobs: strategy: matrix: build-type: [MinSizeRel] - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 with: From 1866f2ccbf690c5c8acc854b61b25be92fcef15d Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 2 Mar 2026 22:13:03 +0400 Subject: [PATCH 005/103] fix : use upload-artifact v4 as v3 is depricated --- .github/actions/build-library-and-upload/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-library-and-upload/action.yml b/.github/actions/build-library-and-upload/action.yml index fd3e5484f..c59cf95aa 100644 --- a/.github/actions/build-library-and-upload/action.yml +++ b/.github/actions/build-library-and-upload/action.yml @@ -68,7 +68,7 @@ runs: if: runner.os == 'Windows' - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.get-folder-name-unix.outputs.folder-name }} path: ${{ steps.create-zip-unix.outputs.artifact-path }} @@ -76,7 +76,7 @@ runs: if: runner.os != 'Windows' - name: Upload artifact (Windows) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ steps.get-folder-name-windows.outputs.folder-name }}-${{ inputs.build-type }} path: ${{ steps.create-zip-windows.outputs.artifact-path }} From cd66837a383b00d03e29de079480f2b083467c6e Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 2 Mar 2026 22:41:21 +0400 Subject: [PATCH 006/103] fix : vcpkg path must match submodule path hardcoded from CMakePresets --- .github/workflows/build_linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 575c6097f..c2d748c15 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -20,7 +20,7 @@ jobs: - uses: ./nakama-cpp/.github/actions/setup-vcpkg with: github_token: ${{ secrets.github_token }} - vcpkg-path: vcpkg + vcpkg-path: nakama-cpp/submodules/vcpkg - uses: ./nakama-cpp/.github/actions/build-library-and-upload with: nakama-cpp-path: nakama-cpp @@ -30,4 +30,4 @@ jobs: uses: ./nakama-cpp/.github/actions/handle-failure with: nakama-cpp-path: nakama-cpp - vcpkg-path: vcpkg \ No newline at end of file + vcpkg-path: nakama-cpp/submodules/vcpkg \ No newline at end of file From 6bab1f45b69c09cfea0c3f43dfeeca41d2bac317 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 3 Mar 2026 15:03:06 +0400 Subject: [PATCH 007/103] fix : use upload-artifact v4 as v3 is deprecated --- .github/actions/handle-failure/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/handle-failure/action.yml b/.github/actions/handle-failure/action.yml index 3b780323d..51d4d4c26 100644 --- a/.github/actions/handle-failure/action.yml +++ b/.github/actions/handle-failure/action.yml @@ -65,7 +65,7 @@ runs: Pop-Location } shell: powershell - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: ${{ steps.build.outputs.artifact_name }}-workdir-debug path: | From 8862f719aeef791d37614f19d8e9b1013ec9ed11 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 3 Mar 2026 16:08:12 +0400 Subject: [PATCH 008/103] fix : install ubuntu deps as a separate step --- .github/actions/setup-ubuntu/action.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-ubuntu/action.yml b/.github/actions/setup-ubuntu/action.yml index 4fa4ff654..5d5ca1875 100644 --- a/.github/actions/setup-ubuntu/action.yml +++ b/.github/actions/setup-ubuntu/action.yml @@ -3,7 +3,22 @@ description: 'Sets up prereqs for all ubuntu machines' runs: using: "composite" steps: - - run: | + - name: Install Ubuntu dependencies + shell: bash + run: | + set -euo pipefail + sudo apt-get update + sudo apt-get install -y \ + cmake \ + ninja-build \ + libcurl4-openssl-dev \ + gcc \ + g++ + + - name: Ensure ninja + mono available + shell: bash + run: | + set -euo pipefail mkdir -p ~/bin install_ninja() { ( From e0bbab541b176ec82935775bec9f1c26f990decd Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 3 Mar 2026 16:11:33 +0400 Subject: [PATCH 009/103] fix : rm duplicate shell definition --- .github/actions/setup-ubuntu/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/setup-ubuntu/action.yml b/.github/actions/setup-ubuntu/action.yml index 5d5ca1875..ac11b6108 100644 --- a/.github/actions/setup-ubuntu/action.yml +++ b/.github/actions/setup-ubuntu/action.yml @@ -43,5 +43,4 @@ runs: ninja --version 2>/dev/null || install_ninja ensure_mono - shell: bash From 619ccdc89cc747ad772107bd791ce2fdcb88e679 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 5 Mar 2026 15:35:38 +0400 Subject: [PATCH 010/103] upd: do not trigger on branch --- .github/workflows/build_linux.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index c2d748c15..0c970adec 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -1,10 +1,5 @@ name: Build Linux -on: - workflow_call: - workflow_dispatch: - push: - branches: - - nata/cicd-linux +on: [workflow_call, workflow_dispatch] jobs: build_linux: timeout-minutes: 30 From 20eb56ea40d0359539e7ca4549d7b7c29aa6435e Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 5 Mar 2026 16:32:24 +0400 Subject: [PATCH 011/103] upd : remove exta ninja install --- .github/actions/setup-ubuntu/action.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/actions/setup-ubuntu/action.yml b/.github/actions/setup-ubuntu/action.yml index ac11b6108..54a3edf78 100644 --- a/.github/actions/setup-ubuntu/action.yml +++ b/.github/actions/setup-ubuntu/action.yml @@ -20,15 +20,6 @@ runs: run: | set -euo pipefail mkdir -p ~/bin - install_ninja() { - ( - cd /tmp - curl -L -O https://github.com/ninja-build/ninja/releases/download/v1.11.0/ninja-linux.zip - unzip ninja-linux.zip - mv ninja /usr/local/bin/ - ) - ninja --version 2>/dev/null - } # vcpkg wants mono, make sure it finds one # see: https://github.com/microsoft/vcpkg/issues/25585 From a441a2aff6510db7148c3f9717bc3251b3036147 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 5 Mar 2026 19:17:44 +0400 Subject: [PATCH 012/103] fix : build-library for test-linux workflow --- .github/workflows/test_linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_linux.yml b/.github/workflows/test_linux.yml index 70c5f0a47..667754444 100644 --- a/.github/workflows/test_linux.yml +++ b/.github/workflows/test_linux.yml @@ -15,7 +15,7 @@ jobs: - uses: ./nakama-cpp/.github/actions/setup-vcpkg with: github_token: ${{ secrets.github_token }} - vcpkg-path: vcpkg + vcpkg-path: nakama-cpp/submodules/vcpkg - uses: ./nakama-cpp/.github/actions/build-library-and-upload with: nakama-cpp-path: nakama-cpp @@ -31,4 +31,4 @@ jobs: uses: ./nakama-cpp/.github/actions/handle-failure with: nakama-cpp-path: nakama-cpp - vcpkg-path: vcpkg \ No newline at end of file + vcpkg-path: nakama-cpp/submodules/vcpkg \ No newline at end of file From 68db8fc9a3087f8d001136722e7dd8497b679700 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 5 Mar 2026 19:32:28 +0400 Subject: [PATCH 013/103] fix missing wslay include in Linux CI builds Fixes missing during library compilation on Linux Ubuntu. --- impl/wsWslay/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/impl/wsWslay/CMakeLists.txt b/impl/wsWslay/CMakeLists.txt index 83d77d28e..82675c216 100644 --- a/impl/wsWslay/CMakeLists.txt +++ b/impl/wsWslay/CMakeLists.txt @@ -14,6 +14,7 @@ target_link_libraries(nakama-impl-ws-wslay nakama::sdk-interface PRIVATE nakama::sdk-core-common nakama::sdk-core-misc wslay + INTERFACE wslay ) target_include_directories(nakama-impl-ws-wslay From d8371fd3ce1bdfe466f14e257d9d208fcb2f9e2e Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 9 Mar 2026 18:58:50 +0400 Subject: [PATCH 014/103] update : use integrationtest/ instead of client-testrunner repo --- .github/actions/build-test-and-run/action.yml | 19 +++++-------------- .github/workflows/test_linux.yml | 1 - .github/workflows/test_osx.yml | 1 - .github/workflows/test_windows.yml | 1 - 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.github/actions/build-test-and-run/action.yml b/.github/actions/build-test-and-run/action.yml index caf8047c4..9ca122fea 100644 --- a/.github/actions/build-test-and-run/action.yml +++ b/.github/actions/build-test-and-run/action.yml @@ -7,9 +7,6 @@ inputs: nakama-cpp-path: description: 'Relative path under $GITHUB_WORKSPACE to the nakama-cpp repository' required: true - testrunner-pat: - description: 'PAT to access the private Nakama testrunner' - required: true build-type: description: The build type. required: true @@ -20,20 +17,14 @@ inputs: runs: using: "composite" steps: - - name: Checkout nakama-client-testrunner - uses: actions/checkout@v2 - with: - repository: heroiclabs/nakama-client-testrunner - token: ${{ inputs.testrunner-pat }} - path: nakama-client-testrunner - - name: Start docker containers for nakama-client-testrunner + + - name: Start docker containers for nakama-integration-tests run: | - docker-compose up -d - working-directory: nakama-client-testrunner + docker-compose -f integrationtests/server/docker-compose.yml up -d + working-directory: integrationtests/server shell: bash - id: build run: | cmake --preset ${{ inputs.preset }} -DBUILD_SHARED_NAKAMA_SDK=ON cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} --target install run -- ${{ inputs.native-tool-options }} - shell: bash - working-directory: ${{ inputs.nakama-cpp-path }}/test + working-directory: ${{ inputs.nakama-cpp-path }}/integrationtests diff --git a/.github/workflows/test_linux.yml b/.github/workflows/test_linux.yml index 667754444..8518e0ace 100644 --- a/.github/workflows/test_linux.yml +++ b/.github/workflows/test_linux.yml @@ -25,7 +25,6 @@ jobs: with: nakama-cpp-path: nakama-cpp preset: linux-amd64 - testrunner-pat: ${{ secrets.GH_PAT }} build-type: ${{ matrix.build-type }} - if: failure() uses: ./nakama-cpp/.github/actions/handle-failure diff --git a/.github/workflows/test_osx.yml b/.github/workflows/test_osx.yml index c5cbd9475..33ca592a6 100644 --- a/.github/workflows/test_osx.yml +++ b/.github/workflows/test_osx.yml @@ -57,7 +57,6 @@ jobs: with: nakama-cpp-path: nakama-cpp preset: ${{ matrix.preset }} - testrunner-pat: ${{ secrets.GH_PAT }} native-tool-options: "-allowProvisioningUpdates" build-type: ${{ matrix.build-type }} - if: failure() diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index d48224a76..e713605fa 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -25,7 +25,6 @@ jobs: with: nakama-cpp-path: nakama-cpp preset: ${{ matrix.preset }} - testrunner-pat: ${{ secrets.GH_PAT }} build-type: ${{ matrix.build-type }} - if: failure() uses: ./nakama-cpp/.github/actions/handle-failure From 705fcaebbb3602236f9c3b18cc6274fddc3cffaa Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 9 Mar 2026 19:14:03 +0400 Subject: [PATCH 015/103] fix : add shell --- .github/actions/build-test-and-run/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/build-test-and-run/action.yml b/.github/actions/build-test-and-run/action.yml index 9ca122fea..0b5d91029 100644 --- a/.github/actions/build-test-and-run/action.yml +++ b/.github/actions/build-test-and-run/action.yml @@ -19,11 +19,12 @@ runs: steps: - name: Start docker containers for nakama-integration-tests + shell: bash run: | docker-compose -f integrationtests/server/docker-compose.yml up -d working-directory: integrationtests/server - shell: bash - id: build + shell: bash run: | cmake --preset ${{ inputs.preset }} -DBUILD_SHARED_NAKAMA_SDK=ON cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} --target install run -- ${{ inputs.native-tool-options }} From fbc18a2dfa8bca6308658e1623b2d984c100ab29 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 9 Mar 2026 19:27:34 +0400 Subject: [PATCH 016/103] fix : working dir path --- .github/actions/build-test-and-run/action.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-test-and-run/action.yml b/.github/actions/build-test-and-run/action.yml index 0b5d91029..ac51bd27f 100644 --- a/.github/actions/build-test-and-run/action.yml +++ b/.github/actions/build-test-and-run/action.yml @@ -17,12 +17,11 @@ inputs: runs: using: "composite" steps: - - - name: Start docker containers for nakama-integration-tests + - name: Start docker container for nakama-integration-tests shell: bash run: | - docker-compose -f integrationtests/server/docker-compose.yml up -d - working-directory: integrationtests/server + docker-compose up -d + working-directory: ${{ inputs.nakama-cpp-path }}/integrationtests/server - id: build shell: bash run: | From 4c73ce96ce65e694cd7c23d2a1203c61206b58c0 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 9 Mar 2026 19:39:57 +0400 Subject: [PATCH 017/103] fix : use docker compose --- .github/actions/build-test-and-run/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-test-and-run/action.yml b/.github/actions/build-test-and-run/action.yml index ac51bd27f..adac55666 100644 --- a/.github/actions/build-test-and-run/action.yml +++ b/.github/actions/build-test-and-run/action.yml @@ -20,7 +20,7 @@ runs: - name: Start docker container for nakama-integration-tests shell: bash run: | - docker-compose up -d + docker compose up -d working-directory: ${{ inputs.nakama-cpp-path }}/integrationtests/server - id: build shell: bash From a94be73a137355fe49e68612129848230a31c77d Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 9 Mar 2026 19:53:18 +0400 Subject: [PATCH 018/103] fix : use root presets --- .github/actions/build-test-and-run/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-test-and-run/action.yml b/.github/actions/build-test-and-run/action.yml index adac55666..972ebd8fd 100644 --- a/.github/actions/build-test-and-run/action.yml +++ b/.github/actions/build-test-and-run/action.yml @@ -27,4 +27,4 @@ runs: run: | cmake --preset ${{ inputs.preset }} -DBUILD_SHARED_NAKAMA_SDK=ON cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} --target install run -- ${{ inputs.native-tool-options }} - working-directory: ${{ inputs.nakama-cpp-path }}/integrationtests + working-directory: ${{ inputs.nakama-cpp-path }} From 94960e2bb6fec17dea88ae1aca1087a978136dc4 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 9 Mar 2026 20:13:35 +0400 Subject: [PATCH 019/103] fix : include lib --- satori-cpp/test/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/satori-cpp/test/main.cpp b/satori-cpp/test/main.cpp index 9ed17852b..239904613 100644 --- a/satori-cpp/test/main.cpp +++ b/satori-cpp/test/main.cpp @@ -15,6 +15,7 @@ */ #include +#include #include "nakama-cpp/satori/SatoriClientFactory.h" From e3a9cf5d469d13d319edf0ae530c4c169aa65c89 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 10 Mar 2026 16:45:34 +0400 Subject: [PATCH 020/103] upd : use Task --- .github/actions/build-test-and-run/action.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/actions/build-test-and-run/action.yml b/.github/actions/build-test-and-run/action.yml index 972ebd8fd..1f1ffb6a1 100644 --- a/.github/actions/build-test-and-run/action.yml +++ b/.github/actions/build-test-and-run/action.yml @@ -17,14 +17,11 @@ inputs: runs: using: "composite" steps: - - name: Start docker container for nakama-integration-tests + - name: Install Task shell: bash - run: | - docker compose up -d - working-directory: ${{ inputs.nakama-cpp-path }}/integrationtests/server - - id: build + run: npm install -g @go-task/cli + + - name: Run tests with Task shell: bash - run: | - cmake --preset ${{ inputs.preset }} -DBUILD_SHARED_NAKAMA_SDK=ON - cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} --target install run -- ${{ inputs.native-tool-options }} + run: task test working-directory: ${{ inputs.nakama-cpp-path }} From 1dd30cb127bf4031c085534240ccc5934d25b895 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 10 Mar 2026 18:17:47 +0400 Subject: [PATCH 021/103] demonstrate test failure --- integrationtests/src/test_authentication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrationtests/src/test_authentication.cpp b/integrationtests/src/test_authentication.cpp index 545a58613..6cec39be4 100644 --- a/integrationtests/src/test_authentication.cpp +++ b/integrationtests/src/test_authentication.cpp @@ -30,7 +30,7 @@ using namespace std; void test_authenticateEmail1() { NTest test(__func__); - auto successCallback = [&test](NSessionPtr session) { test.stopTest(!session->getAuthToken().empty()); }; + auto successCallback = [&test](NSessionPtr session) { test.stopTest(session->getAuthToken().empty()); }; test.client->authenticateEmail("test@mail.com", "12345678", "", true, {}, successCallback); test.runTest(); From fa27dadac4ec9139e90fed6a9703bb973a512178 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 10 Mar 2026 18:30:19 +0400 Subject: [PATCH 022/103] upd : rollback to working test --- integrationtests/src/test_authentication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrationtests/src/test_authentication.cpp b/integrationtests/src/test_authentication.cpp index 6cec39be4..545a58613 100644 --- a/integrationtests/src/test_authentication.cpp +++ b/integrationtests/src/test_authentication.cpp @@ -30,7 +30,7 @@ using namespace std; void test_authenticateEmail1() { NTest test(__func__); - auto successCallback = [&test](NSessionPtr session) { test.stopTest(session->getAuthToken().empty()); }; + auto successCallback = [&test](NSessionPtr session) { test.stopTest(!session->getAuthToken().empty()); }; test.client->authenticateEmail("test@mail.com", "12345678", "", true, {}, successCallback); test.runTest(); From 57c0ea17635ec1c7a9787a642b9305756c170695 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 11 Mar 2026 13:46:06 +0400 Subject: [PATCH 023/103] dbg : trigger on this branch --- .github/workflows/build_android.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index eed9994bc..ac4952cef 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -1,5 +1,7 @@ name: Build Android -on: [workflow_call, workflow_dispatch] +# on: [workflow_call, workflow_dispatch] +on: + branch: ci-actions-android jobs: build_android: timeout-minutes: 30 From 54125dc593dc9cf9917dcc53935bb971aeefd627 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 11 Mar 2026 16:21:31 +0400 Subject: [PATCH 024/103] dbg : trigger on push --- .github/workflows/build_android.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index ac4952cef..456005cf9 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -1,7 +1,10 @@ name: Build Android -# on: [workflow_call, workflow_dispatch] +# on: [workflow_call, workflow_dispatch] on: - branch: ci-actions-android + push: + branches: + - ci-actions-android + jobs: build_android: timeout-minutes: 30 From 65ead394dbcba49eb4d8afc26acfacc0499e7618 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 11 Mar 2026 16:34:56 +0400 Subject: [PATCH 025/103] fix : use correct presets --- .github/workflows/build_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 456005cf9..da0a8ed5e 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -10,7 +10,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - preset: ["android-arm64-v8a-host_linux-x64", "android-x64-host_linux-x64", "android-armeabi-v7a-host_linux-x64"] + preset: ["android-arm64-v8a", "android-armeabi-v7a"] build-type: [MinSizeRel] runs-on: ubuntu-22.04 steps: From 7d884300882af9ed21260846560e6d87a243f212 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 11 Mar 2026 16:55:46 +0400 Subject: [PATCH 026/103] fix : setup order, vcpkg path --- .github/workflows/build_android.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index da0a8ed5e..e24a60535 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -20,7 +20,7 @@ jobs: - uses: ./nakama-cpp/.github/actions/setup-vcpkg with: github_token: ${{ secrets.github_token }} - vcpkg-path: vcpkg + vcpkg-path: nakama-cpp/submodules/vcpkg - uses: ./nakama-cpp/.github/actions/setup-ubuntu - uses: ./nakama-cpp/.github/actions/build-library-and-upload with: @@ -31,4 +31,4 @@ jobs: uses: ./nakama-cpp/.github/actions/handle-failure with: nakama-cpp-path: nakama-cpp - vcpkg-path: vcpkg \ No newline at end of file + vcpkg-path: nakama-cpp/submodules/vcpkg \ No newline at end of file From f9b82c9c89a0d7ca012955429b35cb37b1028a27 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 11 Mar 2026 17:13:21 +0400 Subject: [PATCH 027/103] fix : ensure setup ubuntu first --- .github/workflows/build_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index e24a60535..4009e346f 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -17,11 +17,11 @@ jobs: - uses: actions/checkout@v3 with: path: nakama-cpp + - uses: ./nakama-cpp/.github/actions/setup-ubuntu - uses: ./nakama-cpp/.github/actions/setup-vcpkg with: github_token: ${{ secrets.github_token }} vcpkg-path: nakama-cpp/submodules/vcpkg - - uses: ./nakama-cpp/.github/actions/setup-ubuntu - uses: ./nakama-cpp/.github/actions/build-library-and-upload with: nakama-cpp-path: nakama-cpp From 1d994ec8fe99eb0d2c4c43a94e0518827cbf8380 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 11 Mar 2026 18:01:35 +0400 Subject: [PATCH 028/103] try w/o preset --- .github/actions/build-library-and-upload/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-library-and-upload/action.yml b/.github/actions/build-library-and-upload/action.yml index c59cf95aa..5a7bb4fbc 100644 --- a/.github/actions/build-library-and-upload/action.yml +++ b/.github/actions/build-library-and-upload/action.yml @@ -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 }} From d41c4afbe6752f8fe063a17fcc5d9454be0d12d9 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 16 Mar 2026 13:50:55 +0400 Subject: [PATCH 029/103] upd : use gradle, install ndk, jdk --- .github/workflows/build_android.yml | 64 ++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 4009e346f..e79ae8bf1 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -1,5 +1,5 @@ name: Build Android -# on: [workflow_call, workflow_dispatch] +# on: [workflow_call, workflow_dispatch] on: push: branches: @@ -7,28 +7,52 @@ on: jobs: build_android: - timeout-minutes: 30 - strategy: - matrix: - preset: ["android-arm64-v8a", "android-armeabi-v7a"] - 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-ubuntu - - uses: ./nakama-cpp/.github/actions/setup-vcpkg - with: - github_token: ${{ secrets.github_token }} - vcpkg-path: nakama-cpp/submodules/vcpkg - - uses: ./nakama-cpp/.github/actions/build-library-and-upload + submodules: false + + - name: Checkout vcpkg submodule + run: | + git submodule update --init --filter=blob:none -- submodules/vcpkg + working-directory: nakama-cpp + + - name: Set up JDK + uses: actions/setup-java@v4 with: - nakama-cpp-path: nakama-cpp - preset: ${{ matrix.preset }} - build-type: ${{ matrix.build-type }} - - if: failure() - uses: ./nakama-cpp/.github/actions/handle-failure + distribution: temurin + java-version: '17' + + - name: Install NDK & CMake + run: | + # The GitHub ubuntu-22.04 runner ships with Android SDK at $ANDROID_HOME + sdkmanager --install \ + "ndk;27.2.12479018" \ + "cmake;4.0.2" + env: + ANDROID_HOME: ${{ env.ANDROID_HOME }} + + - 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 + + - 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: nakama-cpp/submodules/vcpkg \ No newline at end of file + name: nakama-sdk-android-aar + path: nakama-cpp/android/nakama-sdk/build/outputs/aar/*.aar + if-no-files-found: error \ No newline at end of file From 7889babdf8a1f8d4f92fd9701913b06c4a2d3a18 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 16 Mar 2026 13:57:06 +0400 Subject: [PATCH 030/103] fix : sdkmanager path --- .github/workflows/build_android.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index e79ae8bf1..e37df4164 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -29,15 +29,15 @@ jobs: - name: Install NDK & CMake run: | - # The GitHub ubuntu-22.04 runner ships with Android SDK at $ANDROID_HOME - sdkmanager --install \ + # 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" - env: - ANDROID_HOME: ${{ env.ANDROID_HOME }} - name: Add CMake to PATH - run: echo "$ANDROID_HOME/cmake/4.0.2/bin" >> $GITHUB_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 From 83394dd26af092ec74ef4ac681e76dc3ad5760a0 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 16 Mar 2026 15:37:55 +0400 Subject: [PATCH 031/103] upd : split android wworkflow to actions --- .github/actions/setup-android/action.yml | 55 ++++++ .../actions/setup-vcpkg-android/action.yml | 19 +++ .github/workflows/build_android.yml | 57 ++++--- .github/workflows/test_android.yml | 157 ++++++++++++++++++ 4 files changed, 261 insertions(+), 27 deletions(-) create mode 100644 .github/actions/setup-android/action.yml create mode 100644 .github/actions/setup-vcpkg-android/action.yml create mode 100644 .github/workflows/test_android.yml diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml new file mode 100644 index 000000000..5a14014a5 --- /dev/null +++ b/.github/actions/setup-android/action.yml @@ -0,0 +1,55 @@ +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 + + packages=( + "ndk;${{ inputs.ndk-version }}" + "cmake;${{ inputs.cmake-version }}" + ) + + if [ "${{ inputs.install-emulator }}" = "true" ]; then + packages+=("emulator") + if [ -n "${{ inputs.system-image }}" ]; then + packages+=("${{ inputs.system-image }}") + fi + fi + + "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \ + --sdk_root="$ANDROID_HOME" \ + "${packages[@]}" + + - name: Add CMake to PATH + shell: bash + run: echo "$ANDROID_HOME/cmake/${{ inputs.cmake-version }}/bin" >> "$GITHUB_PATH" \ No newline at end of file diff --git a/.github/actions/setup-vcpkg-android/action.yml b/.github/actions/setup-vcpkg-android/action.yml new file mode 100644 index 000000000..f6d08293b --- /dev/null +++ b/.github/actions/setup-vcpkg-android/action.yml @@ -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 }} + diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index e37df4164..0cf492804 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -21,38 +21,41 @@ jobs: git submodule update --init --filter=blob:none -- submodules/vcpkg working-directory: nakama-cpp - - name: Set up JDK - uses: actions/setup-java@v4 + - uses: ./nakama-cpp/.github/actions/setup-android with: - distribution: temurin - java-version: '17' - - - 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 + ndk-version: 27.2.12479018 + cmake-version: 4.0.2 + + - uses: ./nakama-cpp/.github/actions/setup-vcpkg-android + with: + vcpkg-path: nakama-cpp/submodules/vcpkg - - name: Build with Gradle - run: ./gradlew build --no-daemon + - name : Build with Gradle + run : ./gradlew build --no-daemon working-directory: nakama-cpp/android - name: Upload artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4 with: name: nakama-sdk-android-aar path: nakama-cpp/android/nakama-sdk/build/outputs/aar/*.aar - if-no-files-found: error \ No newline at end of file + 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 diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml new file mode 100644 index 000000000..7a30161d2 --- /dev/null +++ b/.github/workflows/test_android.yml @@ -0,0 +1,157 @@ +name: Test Android +# on: [workflow_call, workflow_dispatch] +on: + workflow_dispatch: + +jobs: + test_android: + timeout-minutes: 60 + runs-on: ubuntu-22.04 + env: + ABI: arm64-v8a + CMAKE_PRESET: android-arm64-v8a + + steps: + - 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 + working-directory: nakama-cpp + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + + - 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" \ + "emulator" \ + "system-images;android-28;google_apis;x86_64" + + - 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 + + - name: Start Nakama server + run: docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait + working-directory: nakama-cpp + + - name: Configure & build native test libs + run: | + cmake --preset "$CMAKE_PRESET" \ + -DBUILD_TESTING=ON \ + -DCMAKE_ANDROID_NDK="$ANDROID_HOME/ndk/27.2.12479018" + + cmake --build "build/$CMAKE_PRESET" --config Debug \ + --target nakama-sdk nakama-test + working-directory: nakama-cpp + + - name: Stage native libs into jniLibs + run: | + jni_dir="integrationtests/android/jniLibs/$ABI" + mkdir -p "$jni_dir" + + cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" + cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" + + # Copy libc++_shared.so from NDK + triple="aarch64-linux-android" + stl_lib="$ANDROID_HOME/ndk/27.2.12479018/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/${triple}/libc++_shared.so" + cp "$stl_lib" "$jni_dir/" + working-directory: nakama-cpp + + - name: Build test APK + run: ./gradlew assembleCustomDebugType -Pabi="$ABI" --no-daemon + working-directory: nakama-cpp/integrationtests/android + + - name: Create AVD + run: | + echo "no" | "$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" create avd \ + --name test_avd \ + --package "system-images;android-28;google_apis;x86_64" \ + --force + + - name: Run tests on emulator + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 28 + target: google_apis + arch: x86_64 + avd-name: test_avd + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 2048 + disable-animations: true + script: | + APK="nakama-cpp/integrationtests/android/build/outputs/apk/customDebugType/nakamatest-customDebugType.apk" + PACKAGE="com.heroiclabs.nakamatest" + ACTIVITY="${PACKAGE}/.MainActivity" + TIMEOUT=300 + LOG_TAG="nakama" + + # Reverse-forward Nakama server ports into emulator + for port in 7349 7350 7351; do + adb reverse tcp:$port tcp:$port + done + + # Install APK + adb uninstall "$PACKAGE" 2>/dev/null || true + adb install -r "$APK" + + # Clear logcat, launch app + adb logcat -c + adb shell am start -n "$ACTIVITY" + + # Stream logcat output and watch for result + logfile="logcat-output.tmp" + > "$logfile" + adb logcat -s "${LOG_TAG}:V" -v raw > "$logfile" 2>/dev/null & + logcat_pid=$! + trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT + + result="" + SECONDS=0 + last_line=0 + while [ "$SECONDS" -lt "$TIMEOUT" ]; do + line_num=0 + while IFS= read -r line; do + line_num=$((line_num + 1)) + [ "$line_num" -le "$last_line" ] && continue + echo "$line" + if [[ "$line" == *"Tests failed: 0"* ]]; then + result="passed" + elif [[ "$line" == *"Tests failed:"* ]]; then + result="failed" + fi + done < "$logfile" + last_line=$line_num + [ -n "$result" ] && break + sleep 1 + done + + kill $logcat_pid 2>/dev/null || true + echo "---" + + if [ -z "$result" ]; then + echo "TIMEOUT: Tests did not complete within ${TIMEOUT}s."; exit 1 + elif [ "$result" = "passed" ]; then + echo "ALL TESTS PASSED"; exit 0 + else + echo "TESTS FAILED"; exit 1 + fi From 9377f278dc2cb4c0eedb879994a777f85ce85d7b Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 16 Mar 2026 15:51:46 +0400 Subject: [PATCH 032/103] fix : yml syntax --- .github/workflows/build_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 0cf492804..d9627577b 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -35,7 +35,7 @@ jobs: working-directory: nakama-cpp/android - name: Upload artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v4 with: name: nakama-sdk-android-aar path: nakama-cpp/android/nakama-sdk/build/outputs/aar/*.aar From 56981338c3349f20a9fb1491d02158f5baa81969 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 16 Mar 2026 17:20:39 +0400 Subject: [PATCH 033/103] upd : test android --- .github/actions/setup-android/action.yml | 3 +- .github/workflows/build_android.yml | 10 +++--- .github/workflows/test_android.yml | 40 ++++++++---------------- 3 files changed, 20 insertions(+), 33 deletions(-) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index 5a14014a5..eb2bbd02f 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -38,7 +38,8 @@ runs: "ndk;${{ inputs.ndk-version }}" "cmake;${{ inputs.cmake-version }}" ) - + + #use emulator for test-android if [ "${{ inputs.install-emulator }}" = "true" ]; then packages+=("emulator") if [ -n "${{ inputs.system-image }}" ]; then diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index d9627577b..04712cd02 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -1,9 +1,9 @@ name: Build Android -# on: [workflow_call, workflow_dispatch] -on: - push: - branches: - - ci-actions-android +on: [workflow_call, workflow_dispatch] +# on: +# push: +# branches: +# - ci-actions-android jobs: build_android: diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 7a30161d2..f6a93d8b0 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -1,7 +1,9 @@ name: Test Android # on: [workflow_call, workflow_dispatch] on: - workflow_dispatch: + push: + branches: + - ci-actions-android jobs: test_android: @@ -23,32 +25,16 @@ jobs: git submodule update --init --filter=blob:none -- submodules/vcpkg working-directory: nakama-cpp - - name: Set up JDK - uses: actions/setup-java@v4 + - uses: ./nakama-cpp/.github/actions/setup-android with: - distribution: temurin - java-version: '17' - - - 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" \ - "emulator" \ - "system-images;android-28;google_apis;x86_64" - - - 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 + ndk-version: 27.2.12479018 + cmake-version: 4.0.2 + install-emulator: true + system-image: "android-28;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 @@ -69,7 +55,7 @@ jobs: jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" - cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" + cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" # Copy libc++_shared.so from NDK From 8d3de9f19c5f2cf2fc8b6498c962111773ef00bb Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 16 Mar 2026 17:30:56 +0400 Subject: [PATCH 034/103] fix : android package name --- .github/actions/setup-android/action.yml | 3 ++- .github/workflows/test_android.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index eb2bbd02f..a7286e5be 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -38,10 +38,11 @@ runs: "ndk;${{ inputs.ndk-version }}" "cmake;${{ inputs.cmake-version }}" ) - + #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 diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index f6a93d8b0..b0896baf3 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -30,7 +30,7 @@ jobs: ndk-version: 27.2.12479018 cmake-version: 4.0.2 install-emulator: true - system-image: "android-28;google_apis;x86_64" + system-image: "system-images;android-28;google_apis;x86_64" - uses: ./nakama-cpp/.github/actions/setup-vcpkg-android with: From 0fd101463586a2b6e657c17303de210c2c21d0a4 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 13:35:27 +0400 Subject: [PATCH 035/103] fix : try release instead of debug --- .github/workflows/test_android.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index b0896baf3..dc6e75b7e 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -40,23 +40,23 @@ jobs: run: docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait working-directory: nakama-cpp - - name: Configure & build native test libs + - name: Configure & build test run: | cmake --preset "$CMAKE_PRESET" \ -DBUILD_TESTING=ON \ -DCMAKE_ANDROID_NDK="$ANDROID_HOME/ndk/27.2.12479018" - cmake --build "build/$CMAKE_PRESET" --config Debug \ + cmake --build "build/$CMAKE_PRESET" --config Release \ --target nakama-sdk nakama-test working-directory: nakama-cpp - - name: Stage native libs into jniLibs + - name: Stage tests into jniLibs run: | jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" - cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" - cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" + cp "build/$CMAKE_PRESET/Release/libnakama-sdk.so" "$jni_dir/" + cp "build/$CMAKE_PRESET/integrationtests/Release/libnakama-test.so" "$jni_dir/" # Copy libc++_shared.so from NDK triple="aarch64-linux-android" From 8c153d8086a7212c6e89719f8e923113d164ca52 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 13:48:47 +0400 Subject: [PATCH 036/103] set ndk in actions --- .github/actions/setup-android/action.yml | 6 ++++-- .github/workflows/test_android.yml | 14 +++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index a7286e5be..ec0050306 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -52,6 +52,8 @@ runs: --sdk_root="$ANDROID_HOME" \ "${packages[@]}" - - name: Add CMake to PATH + - name: Set Android environment variables shell: bash - run: echo "$ANDROID_HOME/cmake/${{ inputs.cmake-version }}/bin" >> "$GITHUB_PATH" \ No newline at end of file + run: | + echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/${{ inputs.ndk-version }}" >> "$GITHUB_ENV" + echo "$ANDROID_HOME/cmake/${{ inputs.cmake-version }}/bin" >> "$GITHUB_PATH" \ No newline at end of file diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index dc6e75b7e..86a739cf4 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -40,23 +40,23 @@ jobs: run: docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait working-directory: nakama-cpp - - name: Configure & build test + - name: Configure & build native test libs run: | + # vcpkg uses ANDROID_NDK_HOME env var to find the NDK toolchain cmake --preset "$CMAKE_PRESET" \ - -DBUILD_TESTING=ON \ - -DCMAKE_ANDROID_NDK="$ANDROID_HOME/ndk/27.2.12479018" + -DBUILD_TESTING=ON - cmake --build "build/$CMAKE_PRESET" --config Release \ + cmake --build "build/$CMAKE_PRESET" --config Debug \ --target nakama-sdk nakama-test working-directory: nakama-cpp - - name: Stage tests into jniLibs + - name: Stage native libs into jniLibs run: | jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" - cp "build/$CMAKE_PRESET/Release/libnakama-sdk.so" "$jni_dir/" - cp "build/$CMAKE_PRESET/integrationtests/Release/libnakama-test.so" "$jni_dir/" + cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" + cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" # Copy libc++_shared.so from NDK triple="aarch64-linux-android" From f81250204ea287c2512029ff0da628b37d09a2d6 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 14:09:34 +0400 Subject: [PATCH 037/103] try using taskfile, set more ndk vars --- .github/actions/setup-android/action.yml | 8 +- .github/workflows/test_android.yml | 94 ++---------------------- 2 files changed, 14 insertions(+), 88 deletions(-) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index ec0050306..eee28bf5a 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -55,5 +55,9 @@ runs: - name: Set Android environment variables shell: bash run: | - echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/${{ inputs.ndk-version }}" >> "$GITHUB_ENV" - echo "$ANDROID_HOME/cmake/${{ inputs.cmake-version }}/bin" >> "$GITHUB_PATH" \ No newline at end of file + 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/cmake/${{ inputs.cmake-version }}/bin" >> "$GITHUB_PATH" + echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH" \ No newline at end of file diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 86a739cf4..f4f22b44c 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -40,40 +40,8 @@ jobs: run: docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait working-directory: nakama-cpp - - name: Configure & build native test libs - run: | - # vcpkg uses ANDROID_NDK_HOME env var to find the NDK toolchain - cmake --preset "$CMAKE_PRESET" \ - -DBUILD_TESTING=ON - - cmake --build "build/$CMAKE_PRESET" --config Debug \ - --target nakama-sdk nakama-test - working-directory: nakama-cpp - - - name: Stage native libs into jniLibs - run: | - jni_dir="integrationtests/android/jniLibs/$ABI" - mkdir -p "$jni_dir" - - cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" - cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" - - # Copy libc++_shared.so from NDK - triple="aarch64-linux-android" - stl_lib="$ANDROID_HOME/ndk/27.2.12479018/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/${triple}/libc++_shared.so" - cp "$stl_lib" "$jni_dir/" - working-directory: nakama-cpp - - - name: Build test APK - run: ./gradlew assembleCustomDebugType -Pabi="$ABI" --no-daemon - working-directory: nakama-cpp/integrationtests/android - - - name: Create AVD - run: | - echo "no" | "$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager" create avd \ - --name test_avd \ - --package "system-images;android-28;google_apis;x86_64" \ - --force + - name: Install Task + run: npm install -g @go-task/cli - name: Run tests on emulator uses: reactivecircus/android-emulator-runner@v2 @@ -81,63 +49,17 @@ jobs: api-level: 28 target: google_apis arch: x86_64 - avd-name: test_avd emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 2048 disable-animations: true script: | - APK="nakama-cpp/integrationtests/android/build/outputs/apk/customDebugType/nakamatest-customDebugType.apk" - PACKAGE="com.heroiclabs.nakamatest" - ACTIVITY="${PACKAGE}/.MainActivity" - TIMEOUT=300 - LOG_TAG="nakama" - # Reverse-forward Nakama server ports into emulator + # so the test app can find the server running on the host for port in 7349 7350 7351; do adb reverse tcp:$port tcp:$port done - # Install APK - adb uninstall "$PACKAGE" 2>/dev/null || true - adb install -r "$APK" - - # Clear logcat, launch app - adb logcat -c - adb shell am start -n "$ACTIVITY" - - # Stream logcat output and watch for result - logfile="logcat-output.tmp" - > "$logfile" - adb logcat -s "${LOG_TAG}:V" -v raw > "$logfile" 2>/dev/null & - logcat_pid=$! - trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT - - result="" - SECONDS=0 - last_line=0 - while [ "$SECONDS" -lt "$TIMEOUT" ]; do - line_num=0 - while IFS= read -r line; do - line_num=$((line_num + 1)) - [ "$line_num" -le "$last_line" ] && continue - echo "$line" - if [[ "$line" == *"Tests failed: 0"* ]]; then - result="passed" - elif [[ "$line" == *"Tests failed:"* ]]; then - result="failed" - fi - done < "$logfile" - last_line=$line_num - [ -n "$result" ] && break - sleep 1 - done - - kill $logcat_pid 2>/dev/null || true - echo "---" - - if [ -z "$result" ]; then - echo "TIMEOUT: Tests did not complete within ${TIMEOUT}s."; exit 1 - elif [ "$result" = "passed" ]; then - echo "ALL TESTS PASSED"; exit 0 - else - echo "TESTS FAILED"; exit 1 - fi + # We pass ABI and additional CMake flags to solve the CURL mismatch + # CMAKE_ANDROID_ARCH_ABI is the key for CMake's built-in Android support + cd nakama-cpp + task test-android ABI=$ABI \ + CMAKE_EXTRA="-DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_ABI=$ABI" From 3ec779d63d0c5e0f6d02bec7f1928f008f38a115 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 14:33:39 +0400 Subject: [PATCH 038/103] fix syntax error --- .github/workflows/test_android.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index f4f22b44c..aaf47c729 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -52,14 +52,7 @@ jobs: emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 2048 disable-animations: true script: | - # Reverse-forward Nakama server ports into emulator - # so the test app can find the server running on the host - for port in 7349 7350 7351; do - adb reverse tcp:$port tcp:$port - done - - # We pass ABI and additional CMake flags to solve the CURL mismatch - # CMAKE_ANDROID_ARCH_ABI is the key for CMake's built-in Android support + set -xe + for port in 7349 7350 7351; do adb reverse tcp:$port tcp:$port; done cd nakama-cpp - task test-android ABI=$ABI \ - CMAKE_EXTRA="-DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_ABI=$ABI" + task test-android ABI=$ABI CMAKE_EXTRA="-DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_ABI=$ABI" From cb375e7b8739483d52771b5177f279f6b03ddd20 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 14:45:37 +0400 Subject: [PATCH 039/103] fix : run sell script in one line --- .github/workflows/test_android.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index aaf47c729..c28bf9788 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -52,7 +52,4 @@ jobs: emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 2048 disable-animations: true script: | - set -xe - for port in 7349 7350 7351; do adb reverse tcp:$port tcp:$port; done - cd nakama-cpp - task test-android ABI=$ABI CMAKE_EXTRA="-DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_ABI=$ABI" + set -xe && for port in 7349 7350 7351; do adb reverse tcp:$port tcp:$port; done && cd nakama-cpp && task test-android ABI=$ABI CMAKE_EXTRA="-DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_ABI=$ABI" From 0c8ab0cedfccf201b6dfa17833af9fc5e0260816 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 15:23:07 +0400 Subject: [PATCH 040/103] fix : emulator config --- .github/workflows/test_android.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index c28bf9788..5980eb559 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -30,7 +30,7 @@ jobs: ndk-version: 27.2.12479018 cmake-version: 4.0.2 install-emulator: true - system-image: "system-images;android-28;google_apis;x86_64" + system-image: "system-images;android-29;google_apis;x86_64" - uses: ./nakama-cpp/.github/actions/setup-vcpkg-android with: @@ -46,10 +46,11 @@ jobs: - name: Run tests on emulator uses: reactivecircus/android-emulator-runner@v2 with: - api-level: 28 + api-level: 29 target: google_apis arch: x86_64 - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -memory 2048 + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 3072 -cores 2 disable-animations: true script: | - set -xe && for port in 7349 7350 7351; do adb reverse tcp:$port tcp:$port; done && cd nakama-cpp && task test-android ABI=$ABI CMAKE_EXTRA="-DCMAKE_ANDROID_ARCH_ABI=$ABI -DANDROID_ABI=$ABI" + 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" From 6f18051a6326363b987fa1c331499e69f346dd6b Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 16:59:47 +0400 Subject: [PATCH 041/103] try emulator with arm64 --- .github/workflows/test_android.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 5980eb559..020816b92 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -30,7 +30,7 @@ jobs: ndk-version: 27.2.12479018 cmake-version: 4.0.2 install-emulator: true - system-image: "system-images;android-29;google_apis;x86_64" + system-image: "system-images;android-29;google_apis;arm64-v8a" - uses: ./nakama-cpp/.github/actions/setup-vcpkg-android with: @@ -48,9 +48,9 @@ jobs: with: api-level: 29 target: google_apis - arch: x86_64 + arch: arm64-v8a force-avd-creation: false - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 3072 -cores 2 + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 4096 -cores 2 disable-animations: true 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" From bcea4a921e305d9bbef9a9645b1258e26ab5f2bb Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 17:04:28 +0400 Subject: [PATCH 042/103] accept liceanses --- .github/actions/setup-android/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index eee28bf5a..9b1b8fa3c 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -48,6 +48,9 @@ runs: fi fi + # Accept licenses + yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$ANDROID_HOME" --licenses + "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \ --sdk_root="$ANDROID_HOME" \ "${packages[@]}" From 24f09a3ee18767ba7462167be49c189fd9044dd6 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 17:06:51 +0400 Subject: [PATCH 043/103] accept licenses --- .github/actions/setup-android/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index 9b1b8fa3c..5d6a2f35b 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -48,8 +48,8 @@ runs: fi fi - # Accept licenses - yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$ANDROID_HOME" --licenses + # Accept licenses (wrap in subshell/ignore error to avoid pipefail issues with 'yes') + (yes || true) | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$ANDROID_HOME" --licenses || true "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \ --sdk_root="$ANDROID_HOME" \ From 531b4202d296c6b28cc045d3fc1145031bc80888 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 17:55:00 +0400 Subject: [PATCH 044/103] upd : try run on arm64 --- .github/workflows/test_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 020816b92..b92dd9096 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -8,7 +8,7 @@ on: jobs: test_android: timeout-minutes: 60 - runs-on: ubuntu-22.04 + runs-on: ubuntu-22.04-arm64 env: ABI: arm64-v8a CMAKE_PRESET: android-arm64-v8a From eb51a7897b394224b0a89367ced1a2823903451e Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 17:59:01 +0400 Subject: [PATCH 045/103] fix : use correct runner name --- .github/workflows/test_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index b92dd9096..3e115d4c2 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -8,7 +8,7 @@ on: jobs: test_android: timeout-minutes: 60 - runs-on: ubuntu-22.04-arm64 + runs-on: ubuntu-22.04-arm env: ABI: arm64-v8a CMAKE_PRESET: android-arm64-v8a From 914e0c97fb4555d895ca3ee7ea3c02fa93b55994 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 18:22:41 +0400 Subject: [PATCH 046/103] add sdk initialization to the runner --- .github/workflows/test_android.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 3e115d4c2..9960e7350 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -25,6 +25,9 @@ jobs: git submodule update --init --filter=blob:none -- submodules/vcpkg working-directory: nakama-cpp + - name: Set up Android SDK + uses: android-actions/setup-android@v3 + - uses: ./nakama-cpp/.github/actions/setup-android with: ndk-version: 27.2.12479018 From dec1c94f63ff22ef29c2ec561e8d756381d61399 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 18:25:40 +0400 Subject: [PATCH 047/103] add jdk --- .github/workflows/test_android.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 9960e7350..0c76c0093 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -14,6 +14,12 @@ jobs: CMAKE_PRESET: android-arm64-v8a 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: From 983cc75458b141ac8a36a1285f6e15c1f2251c38 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 18:33:13 +0400 Subject: [PATCH 048/103] adjust to arm --- .github/actions/setup-android/action.yml | 31 +++++++++++++++++++----- .github/workflows/test_android.yml | 3 --- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index 5d6a2f35b..9d5210fb6 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -34,6 +34,25 @@ runs: 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 }}" @@ -48,12 +67,10 @@ runs: fi fi - # Accept licenses (wrap in subshell/ignore error to avoid pipefail issues with 'yes') - (yes || true) | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --sdk_root="$ANDROID_HOME" --licenses || true + # Accept licenses + yes | "$SDKMANAGER" --sdk_root="$ANDROID_HOME" --licenses || true - "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \ - --sdk_root="$ANDROID_HOME" \ - "${packages[@]}" + "$SDKMANAGER" --sdk_root="$ANDROID_HOME" "${packages[@]}" - name: Set Android environment variables shell: bash @@ -62,5 +79,7 @@ runs: 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" \ No newline at end of file + echo "$ANDROID_HOME/platform-tools" >> "$GITHUB_PATH" + echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> "$GITHUB_PATH" \ No newline at end of file diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 0c76c0093..470d1e271 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -31,9 +31,6 @@ jobs: git submodule update --init --filter=blob:none -- submodules/vcpkg working-directory: nakama-cpp - - name: Set up Android SDK - uses: android-actions/setup-android@v3 - - uses: ./nakama-cpp/.github/actions/setup-android with: ndk-version: 27.2.12479018 From eec2d04cb2c241baeb5a500289c00037fa9bc3ea Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 20:43:45 +0400 Subject: [PATCH 049/103] upd : build for x86_64 --- .github/workflows/test_android.yml | 10 +++++----- CMakePresets.json | 8 ++++++++ Taskfile.yml | 1 + integrationtests/android/build.gradle | 12 +++++++----- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 470d1e271..93244a003 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -8,10 +8,10 @@ on: jobs: test_android: timeout-minutes: 60 - runs-on: ubuntu-22.04-arm + runs-on: ubuntu-22.04 env: - ABI: arm64-v8a - CMAKE_PRESET: android-arm64-v8a + ABI: x86_64 + CMAKE_PRESET: android-x86_64 steps: - name: Set up JDK 17 @@ -36,7 +36,7 @@ jobs: ndk-version: 27.2.12479018 cmake-version: 4.0.2 install-emulator: true - system-image: "system-images;android-29;google_apis;arm64-v8a" + system-image: "system-images;android-29;google_apis;x86_64" - uses: ./nakama-cpp/.github/actions/setup-vcpkg-android with: @@ -54,7 +54,7 @@ jobs: with: api-level: 29 target: google_apis - arch: arm64-v8a + 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 diff --git a/CMakePresets.json b/CMakePresets.json index 34a2042dc..26e940ea7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -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"], diff --git a/Taskfile.yml b/Taskfile.yml index 3aeba4162..1f9b338f8 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -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 diff --git a/integrationtests/android/build.gradle b/integrationtests/android/build.gradle index bb51530aa..62edd6361 100644 --- a/integrationtests/android/build.gradle +++ b/integrationtests/android/build.gradle @@ -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}") } @@ -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 { From fa44897e91a062f48e68e1489cbca5c34a2eb90a Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 22:23:59 +0400 Subject: [PATCH 050/103] fix : reduce load test by 25mb --- .github/workflows/test_android.yml | 3 ++- integrationtests/src/test_throughput.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 93244a003..161485ad0 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -7,7 +7,7 @@ on: jobs: test_android: - timeout-minutes: 60 + timeout-minutes: 90 runs-on: ubuntu-22.04 env: ABI: x86_64 @@ -58,5 +58,6 @@ jobs: 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" diff --git a/integrationtests/src/test_throughput.cpp b/integrationtests/src/test_throughput.cpp index a7ffc6d91..182bf0c40 100644 --- a/integrationtests/src/test_throughput.cpp +++ b/integrationtests/src/test_throughput.cpp @@ -203,8 +203,8 @@ void test_throughput_rpcPipelinedSmall() { } } -// Pipelined 100MB total: stress-tests sustained throughput with large aggregate volume -void test_throughput_rpc100MB() { +// Pipelined 25MB total: stress-tests sustained throughput with large aggregate volume +void test_throughput_rpc25MB() { NTest test(__func__, true); test.setTestTimeoutMs(300000); test.runTest(); @@ -214,17 +214,17 @@ void test_throughput_rpc100MB() { test.addSession(session); test.rtClient->connectAsync(session, false, NTest::RtProtocol).get(); - // ~64KB payload, ~1600 messages ≈ 100MB sent (+ 100MB received = 200MB round-trip) + // ~64KB payload, ~400 messages ≈ 25MB sent (+ 25MB received = 50MB round-trip) const size_t payloadSize = 64 * 1024; string payload(payloadSize, 'w'); payload = "{\"d\":\"" + payload + "\"}"; - const size_t targetBytes = 100ULL * 1024 * 1024; + const size_t targetBytes = 25ULL * 1024 * 1024; const int messageCount = static_cast(targetBytes / payload.size()); const size_t totalBytesSent = payload.size() * messageCount; const size_t totalBytesRoundTrip = totalBytesSent * 2; - NLOG_INFO("100MB test: sending " + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + + NLOG_INFO("25MB test: sending " + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + "KB = " + to_string(totalBytesSent / (1024 * 1024)) + " MB"); auto start = chrono::steady_clock::now(); @@ -244,7 +244,7 @@ void test_throughput_rpc100MB() { double roundTripMBs = (totalBytesRoundTrip / (1024.0 * 1024.0)) / seconds; double msgsPerSec = messageCount / seconds; - NLOG_INFO("100MB Pipelined RPC (" + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + "KB):"); + NLOG_INFO("25MB Pipelined RPC (" + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + "KB):"); NLOG_INFO(" " + to_string(totalBytesSent / (1024 * 1024)) + " MB sent in " + to_string(ms) + " ms"); NLOG_INFO(" Send: " + to_string(sendMBs) + " MB/s"); NLOG_INFO(" Round-trip: " + to_string(roundTripMBs) + " MB/s"); @@ -252,7 +252,7 @@ void test_throughput_rpc100MB() { test.stopTest(true); } catch (const exception& e) { - NLOG_INFO("100MB throughput test failed: " + string(e.what())); + NLOG_INFO("25MB throughput test failed: " + string(e.what())); test.stopTest(false); } } @@ -262,7 +262,7 @@ void test_throughput() { test_throughput_rpcPipelinedSmall(); test_throughput_rpcPipelined(); test_throughput_rpcPipelinedLarge(); - test_throughput_rpc100MB(); + test_throughput_rpc25MB(); } } // namespace Test From bc589bd907e40a1c22df3927c55cc6a28b83d904 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 23:18:26 +0400 Subject: [PATCH 051/103] dbg : mute throughput test --- integrationtests/src/NTestLib.cpp | 2 +- integrationtests/src/test_throughput.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/integrationtests/src/NTestLib.cpp b/integrationtests/src/NTestLib.cpp index 1651d6f9f..c9ff11601 100644 --- a/integrationtests/src/NTestLib.cpp +++ b/integrationtests/src/NTestLib.cpp @@ -119,7 +119,7 @@ int runAllTests( startSuite("test_profiling", test_profiling); startSuite("test_stress", test_stress); startSuite("test_realtime", test_realtime); - startSuite("test_throughput", test_throughput); + // startSuite("test_throughput", test_throughput); startSuite("test_cancellation", test_cancellation); for (auto& t : threads) { diff --git a/integrationtests/src/test_throughput.cpp b/integrationtests/src/test_throughput.cpp index 182bf0c40..a7ffc6d91 100644 --- a/integrationtests/src/test_throughput.cpp +++ b/integrationtests/src/test_throughput.cpp @@ -203,8 +203,8 @@ void test_throughput_rpcPipelinedSmall() { } } -// Pipelined 25MB total: stress-tests sustained throughput with large aggregate volume -void test_throughput_rpc25MB() { +// Pipelined 100MB total: stress-tests sustained throughput with large aggregate volume +void test_throughput_rpc100MB() { NTest test(__func__, true); test.setTestTimeoutMs(300000); test.runTest(); @@ -214,17 +214,17 @@ void test_throughput_rpc25MB() { test.addSession(session); test.rtClient->connectAsync(session, false, NTest::RtProtocol).get(); - // ~64KB payload, ~400 messages ≈ 25MB sent (+ 25MB received = 50MB round-trip) + // ~64KB payload, ~1600 messages ≈ 100MB sent (+ 100MB received = 200MB round-trip) const size_t payloadSize = 64 * 1024; string payload(payloadSize, 'w'); payload = "{\"d\":\"" + payload + "\"}"; - const size_t targetBytes = 25ULL * 1024 * 1024; + const size_t targetBytes = 100ULL * 1024 * 1024; const int messageCount = static_cast(targetBytes / payload.size()); const size_t totalBytesSent = payload.size() * messageCount; const size_t totalBytesRoundTrip = totalBytesSent * 2; - NLOG_INFO("25MB test: sending " + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + + NLOG_INFO("100MB test: sending " + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + "KB = " + to_string(totalBytesSent / (1024 * 1024)) + " MB"); auto start = chrono::steady_clock::now(); @@ -244,7 +244,7 @@ void test_throughput_rpc25MB() { double roundTripMBs = (totalBytesRoundTrip / (1024.0 * 1024.0)) / seconds; double msgsPerSec = messageCount / seconds; - NLOG_INFO("25MB Pipelined RPC (" + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + "KB):"); + NLOG_INFO("100MB Pipelined RPC (" + to_string(messageCount) + " x " + to_string(payload.size() / 1024) + "KB):"); NLOG_INFO(" " + to_string(totalBytesSent / (1024 * 1024)) + " MB sent in " + to_string(ms) + " ms"); NLOG_INFO(" Send: " + to_string(sendMBs) + " MB/s"); NLOG_INFO(" Round-trip: " + to_string(roundTripMBs) + " MB/s"); @@ -252,7 +252,7 @@ void test_throughput_rpc25MB() { test.stopTest(true); } catch (const exception& e) { - NLOG_INFO("25MB throughput test failed: " + string(e.what())); + NLOG_INFO("100MB throughput test failed: " + string(e.what())); test.stopTest(false); } } @@ -262,7 +262,7 @@ void test_throughput() { test_throughput_rpcPipelinedSmall(); test_throughput_rpcPipelined(); test_throughput_rpcPipelinedLarge(); - test_throughput_rpc25MB(); + test_throughput_rpc100MB(); } } // namespace Test From f3c27e0f411016c4d21a49384c7903a1c4a0e75f Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 17 Mar 2026 23:48:15 +0400 Subject: [PATCH 052/103] dbg : mute stress tests --- integrationtests/src/NTestLib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrationtests/src/NTestLib.cpp b/integrationtests/src/NTestLib.cpp index c9ff11601..7116d18ae 100644 --- a/integrationtests/src/NTestLib.cpp +++ b/integrationtests/src/NTestLib.cpp @@ -117,7 +117,7 @@ int runAllTests( startSuite("test_notifications_rest", test_notifications_rest); startSuite("test_rpc_rest", test_rpc_rest); startSuite("test_profiling", test_profiling); - startSuite("test_stress", test_stress); + // startSuite("test_stress", test_stress); startSuite("test_realtime", test_realtime); // startSuite("test_throughput", test_throughput); startSuite("test_cancellation", test_cancellation); From 6562040c8ee4c7f9ea10c30156abc5503ec27e74 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 00:37:11 +0400 Subject: [PATCH 053/103] dbg : compile only 1 file at a time --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 1f9b338f8..7238f24f1 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -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 ===" From f342d8ac31e8fd5a7f84ac9ea908804f536e2135 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 01:12:20 +0400 Subject: [PATCH 054/103] dbg : run tests sequentially --- integrationtests/src/NTestLib.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integrationtests/src/NTestLib.cpp b/integrationtests/src/NTestLib.cpp index 7116d18ae..4eb57fd2e 100644 --- a/integrationtests/src/NTestLib.cpp +++ b/integrationtests/src/NTestLib.cpp @@ -91,10 +91,10 @@ int runAllTests( // Run internals first (pure unit tests, no server) test_internals(); - // Launch all test groups in parallel threads - std::vector threads; - auto startSuite = [&threads](const char* suiteName, void (*suite)()) { - threads.emplace_back([suiteName, suite]() { runSuiteSafely(suiteName, suite); }); + // Launch all test groups sequentially to avoid resource contention on emulator + // std::vector threads; + auto startSuite = [](const char* suiteName, void (*suite)()) { + runSuiteSafely(suiteName, suite); }; startSuite("test_authentication", test_authentication); From 326c233c248b1ad4d8f8f530b3c9ba17d52008b1 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 01:35:07 +0400 Subject: [PATCH 055/103] dbg : thread for tst --- integrationtests/src/NTestLib.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/integrationtests/src/NTestLib.cpp b/integrationtests/src/NTestLib.cpp index 4eb57fd2e..ed2b26b25 100644 --- a/integrationtests/src/NTestLib.cpp +++ b/integrationtests/src/NTestLib.cpp @@ -122,9 +122,6 @@ int runAllTests( // startSuite("test_throughput", test_throughput); startSuite("test_cancellation", test_cancellation); - for (auto& t : threads) { - t.join(); - } // total stats uint32_t total = g_runTestsCount.load(); From 3ca5fb3dbfa9ccdf271e568b2ed34986d6d09c6e Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 02:08:55 +0400 Subject: [PATCH 056/103] return mutes tests --- integrationtests/src/NTestLib.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integrationtests/src/NTestLib.cpp b/integrationtests/src/NTestLib.cpp index ed2b26b25..c184bd6e2 100644 --- a/integrationtests/src/NTestLib.cpp +++ b/integrationtests/src/NTestLib.cpp @@ -117,9 +117,9 @@ int runAllTests( startSuite("test_notifications_rest", test_notifications_rest); startSuite("test_rpc_rest", test_rpc_rest); startSuite("test_profiling", test_profiling); - // startSuite("test_stress", test_stress); + startSuite("test_stress", test_stress); startSuite("test_realtime", test_realtime); - // startSuite("test_throughput", test_throughput); + startSuite("test_throughput", test_throughput); startSuite("test_cancellation", test_cancellation); From 5b3cc6e1f37418e893679e2cd207ba0b60e5948a Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 15:20:06 +0400 Subject: [PATCH 057/103] fix : define ANDROID to run tests sequentially on emulator --- integrationtests/src/NTestLib.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/integrationtests/src/NTestLib.cpp b/integrationtests/src/NTestLib.cpp index c184bd6e2..2e17bf1b4 100644 --- a/integrationtests/src/NTestLib.cpp +++ b/integrationtests/src/NTestLib.cpp @@ -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 - // std::vector threads; auto startSuite = [](const char* suiteName, void (*suite)()) { runSuiteSafely(suiteName, suite); }; +#else + // Launch all test groups in parallel threads + std::vector 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); @@ -122,6 +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(); From db16e4508bbd7698c4b06ef3314fd08a91ecb716 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 16:05:59 +0400 Subject: [PATCH 058/103] upd : trigger linux and android build --- .github/workflows/build_all.yml | 18 +++++++++++------- .github/workflows/build_android.yml | 4 ---- .github/workflows/test_android.yml | 6 +----- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 280521766..2399a27e7 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -1,13 +1,17 @@ name: Build All -on: [workflow_dispatch] +# on: [workflow_dispatch] +on: + push: + branches: + - ci-fix-android jobs: build_android: uses: ./.github/workflows/build_android.yml - build_ios: - uses: ./.github/workflows/build_ios.yml + # build_ios: + # uses: ./.github/workflows/build_ios.yml build_linux: uses: ./.github/workflows/build_linux.yml - build_osx: - uses: ./.github/workflows/build_osx.yml - build_windows: - uses: ./.github/workflows/build_windows.yml + # build_osx: + # uses: ./.github/workflows/build_osx.yml + # build_windows: + # uses: ./.github/workflows/build_windows.yml diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 04712cd02..00ee656f5 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -1,9 +1,5 @@ name: Build Android on: [workflow_call, workflow_dispatch] -# on: -# push: -# branches: -# - ci-actions-android jobs: build_android: diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 161485ad0..c0bf35441 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -1,9 +1,5 @@ name: Test Android -# on: [workflow_call, workflow_dispatch] -on: - push: - branches: - - ci-actions-android +on: [workflow_call, workflow_dispatch] jobs: test_android: From 7d86ebff2a0e289ca28b069b3ab54d195c7191f3 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 16:08:21 +0400 Subject: [PATCH 059/103] upd : trigger linux and android tests --- .github/workflows/build_all.yml | 18 +++++++----------- .github/workflows/test_all.yml | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index 2399a27e7..280521766 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -1,17 +1,13 @@ name: Build All -# on: [workflow_dispatch] -on: - push: - branches: - - ci-fix-android +on: [workflow_dispatch] jobs: build_android: uses: ./.github/workflows/build_android.yml - # build_ios: - # uses: ./.github/workflows/build_ios.yml + build_ios: + uses: ./.github/workflows/build_ios.yml build_linux: uses: ./.github/workflows/build_linux.yml - # build_osx: - # uses: ./.github/workflows/build_osx.yml - # build_windows: - # uses: ./.github/workflows/build_windows.yml + build_osx: + uses: ./.github/workflows/build_osx.yml + build_windows: + uses: ./.github/workflows/build_windows.yml diff --git a/.github/workflows/test_all.yml b/.github/workflows/test_all.yml index bf2b72f13..578ac55c5 100644 --- a/.github/workflows/test_all.yml +++ b/.github/workflows/test_all.yml @@ -1,12 +1,19 @@ name: Test All -on: [workflow_dispatch] +# on: [workflow_dispatch] +on: + push: + branches: + - ci-fix-android jobs: test_linux: uses: ./.github/workflows/test_linux.yml secrets: inherit - test_osx: - uses: ./.github/workflows/test_osx.yml - secrets: inherit - test_windows: - uses: ./.github/workflows/test_windows.yml + test_android: + uses: ./.github/workflows/test_android.yml secrets: inherit + # test_osx: + # uses: ./.github/workflows/test_osx.yml + # secrets: inherit + # test_windows: + # uses: ./.github/workflows/test_windows.yml + # secrets: inherit From 56b24cd8b4826135bc2d4f25eae00a5a6e1e61d4 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 16:29:46 +0400 Subject: [PATCH 060/103] upd : return to regulat workflow --- .github/workflows/test_all.yml | 19 ++++++------------- .github/workflows/test_android.yml | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test_all.yml b/.github/workflows/test_all.yml index 578ac55c5..bf2b72f13 100644 --- a/.github/workflows/test_all.yml +++ b/.github/workflows/test_all.yml @@ -1,19 +1,12 @@ name: Test All -# on: [workflow_dispatch] -on: - push: - branches: - - ci-fix-android +on: [workflow_dispatch] jobs: test_linux: uses: ./.github/workflows/test_linux.yml secrets: inherit - test_android: - uses: ./.github/workflows/test_android.yml + test_osx: + uses: ./.github/workflows/test_osx.yml + secrets: inherit + test_windows: + uses: ./.github/workflows/test_windows.yml secrets: inherit - # test_osx: - # uses: ./.github/workflows/test_osx.yml - # secrets: inherit - # test_windows: - # uses: ./.github/workflows/test_windows.yml - # secrets: inherit diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index c0bf35441..c71de967d 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -1,5 +1,5 @@ name: Test Android -on: [workflow_call, workflow_dispatch] +on: [workflow_call, workflow_dispatch, pull_request] jobs: test_android: From 4004717e35e38e1634960c18c5646f82072582d3 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 22:21:13 +0400 Subject: [PATCH 061/103] upd : reduce timeout, rm comments --- .github/workflows/build_android.yml | 23 ++--------------------- .github/workflows/test_android.yml | 2 +- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 00ee656f5..e058d6934 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -3,7 +3,7 @@ on: [workflow_call, workflow_dispatch] jobs: build_android: - timeout-minutes: 60 + timeout-minutes: 30 runs-on: ubuntu-22.04 steps: - name: Checkout nakama-cpp @@ -35,23 +35,4 @@ jobs: with: 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 + if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index c71de967d..8e01fcdec 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -3,7 +3,7 @@ on: [workflow_call, workflow_dispatch, pull_request] jobs: test_android: - timeout-minutes: 90 + timeout-minutes: 30 runs-on: ubuntu-22.04 env: ABI: x86_64 From 0a8228b611b6730e8d2f584681f8704ebfaca7b9 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 22:22:52 +0400 Subject: [PATCH 062/103] try prallel build --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 7238f24f1..1f9b338f8 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -167,7 +167,7 @@ tasks: -DCMAKE_MAKE_PROGRAM="$(command -v ninja)" cmake --build "build/{{.CMAKE_PRESET}}" --config Debug \ - --target nakama-sdk nakama-test -- -j 1 + --target nakama-sdk nakama-test # --- Stage native libraries for Gradle --- echo "=== Staging native libraries ===" From 6d6e0b9491583cae7ed1931243a56c60061a852e Mon Sep 17 00:00:00 2001 From: upwelling-twll <92473270+upwelling-twll@users.noreply.github.com> Date: Wed, 18 Mar 2026 22:32:19 +0400 Subject: [PATCH 063/103] Remove redundant cmake variables Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/test_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 8e01fcdec..6243b6594 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -56,4 +56,4 @@ jobs: 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" + 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 From c39bbf7491c0629942bc40a840e8400dac557034 Mon Sep 17 00:00:00 2001 From: twillian Date: Wed, 18 Mar 2026 23:43:46 +0400 Subject: [PATCH 064/103] upd: use commit sha for emulator-runner --- .github/workflows/test_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 6243b6594..06096442c 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -46,7 +46,7 @@ jobs: run: npm install -g @go-task/cli - name: Run tests on emulator - uses: reactivecircus/android-emulator-runner@v2 + uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a with: api-level: 29 target: google_apis From 043fb6a94fe98a71a0806ca2b6e219876b5a08ed Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 19 Mar 2026 00:10:06 +0400 Subject: [PATCH 065/103] upd : rm double jdk install --- .github/workflows/test_android.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 06096442c..80ee8468b 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -10,12 +10,6 @@ jobs: 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: From 578647a7bd01bb45194c65de73b9a55993bb9e0f Mon Sep 17 00:00:00 2001 From: upwelling-twll <92473270+upwelling-twll@users.noreply.github.com> Date: Thu, 19 Mar 2026 00:22:44 +0400 Subject: [PATCH 066/103] upd : rm useless preset var Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/test_android.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 80ee8468b..f0ba0382c 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -7,7 +7,6 @@ jobs: runs-on: ubuntu-22.04 env: ABI: x86_64 - CMAKE_PRESET: android-x86_64 steps: - name: Checkout nakama-cpp From 0a6deab821939613c05a2d65d8fbc276a08ecf87 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 19 Mar 2026 18:10:58 +0400 Subject: [PATCH 067/103] add script, rm teamplates from taskfile --- Taskfile.yml | 12 +- integrationtests/android/build.gradle | 2 +- integrationtests/android/settings.gradle | 4 +- integrationtests/android/test_android.sh | 176 +++++++++++++++++++++++ 4 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 integrationtests/android/test_android.sh diff --git a/Taskfile.yml b/Taskfile.yml index 1f9b338f8..2896395ac 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -64,11 +64,15 @@ tasks: test-android: desc: Build and run Android integration tests (optional DEVICE=, ABI=arm64-v8a|armeabi-v7a) - vars: - ABI: '{{default "arm64-v8a" .ABI}}' - DEVICE: '{{default "" .DEVICE}}' - CMAKE_PRESET: "android-{{.ABI}}" + env: + ABI: '{{.ABI}}' + CMAKE_PRESET: '{{.CMAKE_PRESET}}' + VCPKG_ROOT: '{{.VCPKG_ROOT}}' + ANDROID_NDK_HOME: '{{.ANDROID_NDK_HOME}}' + DEVICE: '{{.DEVICE}}' cmds: + - bash integrationtests/android/test_android.sh + - docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait - | set -euo pipefail diff --git a/integrationtests/android/build.gradle b/integrationtests/android/build.gradle index 62edd6361..9c886ed65 100644 --- a/integrationtests/android/build.gradle +++ b/integrationtests/android/build.gradle @@ -31,6 +31,7 @@ if (!supportedAbis.contains(abi)) { dependencies { implementation 'androidx.annotation:annotation:1.7.1' + implementation project(':nakama-sdk') } repositories { @@ -58,7 +59,6 @@ android { // and the project's vcpkg-based toolchain. sourceSets { main { - java.srcDirs += '../../android/nakama-sdk/src/main/java' jniLibs.srcDirs = ['jniLibs'] } } diff --git a/integrationtests/android/settings.gradle b/integrationtests/android/settings.gradle index d5244b5f5..e7c8f362a 100644 --- a/integrationtests/android/settings.gradle +++ b/integrationtests/android/settings.gradle @@ -6,4 +6,6 @@ pluginManagement { } } -rootProject.name = 'nakamatest' \ No newline at end of file +rootProject.name = 'nakamatest' +include ':nakama-sdk' +project(':nakama-sdk').projectDir = new File(settingsDir, '../../android/nakama-sdk') \ No newline at end of file diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh new file mode 100644 index 000000000..9ca90559e --- /dev/null +++ b/integrationtests/android/test_android.sh @@ -0,0 +1,176 @@ +#!/bin/bash +set -eo pipefail + +: "${ABI:?Set ABI}" +: "${CMAKE_PRESET:?Set CMAKE_PRESET}" +: "${VCPKG_ROOT:?Set VCPKG_ROOT}" +: "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME}" + +echo "=== Building C++ Test Library ===" +cmake --preset "$CMAKE_PRESET" \ + -DBUILD_TESTING=ON \ + -DCMAKE_ANDROID_NDK="$ANDROID_NDK_HOME" \ + -DCMAKE_ANDROID_ARCH_ABI="$ABI" \ + -DCMAKE_MAKE_PROGRAM="$(command -v ninja)" + +cmake --build "build/$CMAKE_PRESET" --config Debug --target nakama-test + +jni_dir="integrationtests/android/jniLibs/$ABI" +mkdir -p "$jni_dir" + +# ONLY stage the test library. The SDK is handled by Gradle. +cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" + +case "$ABI" in + arm64-v8a) triple="aarch64-linux-android";; + armeabi-v7a) triple="arm-linux-androideabi";; + x86_64) triple="x86_64-linux-android";; +esac + +HOST_OS=$(uname -s | tr '[:upper:]' '[:lower:]') +stl_lib="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${HOST_OS}-x86_64/sysroot/usr/lib/$triple/libc++_shared.so" +if [ -f "$stl_lib" ]; then + cp "$stl_lib" "$jni_dir/" +fi + +echo "=== Building Official Android SDK (Release) ===" +cd android +./gradlew assembleRelease --no-daemon +cd .. + +echo "=== Building Integration Tests ===" +cd integrationtests/android +./gradlew assembleCustomDebugType --no-daemon +cd ../../ + + + # --- Resolve device serial --- +PACKAGE="com.heroiclabs.nakamatest" + ACTIVITY="${PACKAGE}/.MainActivity" + TIMEOUT=300 + LOG_TAG="nakama" + APK_PATH="integrationtests/android/build/outputs/apk/customDebugType/nakamatest-customDebugType.apk" + + parse_devices() { + devices=() + local output + output=$("$ADB" devices) + while IFS= read -r line; do + if [[ "$line" == *$'\t'device ]]; then + devices+=("${line%%$'\t'*}") + fi + done <<< "$output" + } + + serial="${DEVICE}" + if [ -z "$serial" ]; then + parse_devices + + if [ ${#devices[@]} -eq 0 ]; then + echo "No connected devices/emulators found. Starting emulator..." + EMULATOR="$ANDROID_HOME/emulator/emulator" + if [ ! -x "$EMULATOR" ] && [ -x "${EMULATOR}.exe" ]; then + EMULATOR="${EMULATOR}.exe" + fi + avd=$("$EMULATOR" -list-avds) + avd="${avd%%$'\n'*}" + avd="${avd//$'\r'/}" + if [ -z "$avd" ]; then + echo "Error: No AVDs found. Create one in Android Studio first." + exit 1 + fi + echo "Starting AVD: $avd" + {{if eq OS "windows"}}powershell.exe -Command "Start-Process -FilePath '${EMULATOR}' -ArgumentList '-avd','${avd}' -WindowStyle Hidden"{{else}}"$EMULATOR" -avd "$avd" &>/dev/null &{{end}} + echo "Waiting for device to come online..." + "$ADB" wait-for-device + while [[ "$("$ADB" shell getprop sys.boot_completed 2>/dev/null)" != *"1"* ]]; do + _sleep 2 + done + echo "Emulator booted." + parse_devices + fi + + if [ ${#devices[@]} -gt 1 ]; then + echo "Error: Multiple devices connected. Specify DEVICE=:" + "$ADB" devices + exit 1 + fi + serial="${devices[0]}" + echo "Auto-detected device: $serial" + fi + + adb_cmd() { + "$ADB" -s "$serial" "$@" + } + + # --- Port forwarding --- + echo "Setting up port forwarding..." + for port in 7349 7350 7351; do + adb_cmd reverse tcp:$port tcp:$port + done + + # --- Install APK --- + if [ ! -f "$APK_PATH" ]; then + echo "Error: APK not found at $APK_PATH" + exit 1 + fi + + echo "Installing APK..." + adb_cmd uninstall "$PACKAGE" 2>/dev/null || true + adb_cmd install -r "$APK_PATH" + + # --- Clear logcat and launch --- + adb_cmd logcat -c + echo "Launching $ACTIVITY..." + adb_cmd shell am start -n "$ACTIVITY" + + # --- Monitor logcat for test results --- + echo "Waiting for test results (timeout: ${TIMEOUT}s)..." + echo "---" + + logfile="logcat-output.tmp" + > "$logfile" + "$ADB" -s "$serial" logcat -s "${LOG_TAG}:V" -v raw > "$logfile" 2>/dev/null & + logcat_pid=$! + trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT + + result="" + SECONDS=0 + last_line=0 + + while [ "$SECONDS" -lt "$TIMEOUT" ]; do + line_num=0 + while IFS= read -r line; do + line_num=$((line_num + 1)) + if [ "$line_num" -le "$last_line" ]; then + continue + fi + echo "$line" + if [[ "$line" == *"Tests failed: 0"* ]]; then + result="passed" + elif [[ "$line" == *"Tests failed:"* ]]; then + result="failed" + fi + done < "$logfile" + last_line=$line_num + [ -n "$result" ] && break + _sleep 1 + done + + kill $logcat_pid 2>/dev/null || true + + echo "---" + + if [ -z "$result" ]; then + echo "TIMEOUT: Tests did not complete within ${TIMEOUT}s." + exit 1 + elif [ "$result" = "passed" ]; then + echo "ALL TESTS PASSED" + exit 0 + else + echo "TESTS FAILED" + exit 1 + fi + + + From c346da081bdee31c2864de042a68a38312206917 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 19 Mar 2026 18:31:01 +0400 Subject: [PATCH 068/103] upd : rm comments, add env presets --- .github/workflows/test_android.yml | 1 + Taskfile.yml | 255 +---------------------------- 2 files changed, 2 insertions(+), 254 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index f0ba0382c..80ee8468b 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -7,6 +7,7 @@ jobs: runs-on: ubuntu-22.04 env: ABI: x86_64 + CMAKE_PRESET: android-x86_64 steps: - name: Checkout nakama-cpp diff --git a/Taskfile.yml b/Taskfile.yml index 2896395ac..6e402c075 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -71,257 +71,4 @@ tasks: ANDROID_NDK_HOME: '{{.ANDROID_NDK_HOME}}' DEVICE: '{{.DEVICE}}' cmds: - - bash integrationtests/android/test_android.sh - - - docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait - - | - set -euo pipefail - - HOST_OS="{{OS}}" - - # Portable sleep (Taskfile's Windows shell lacks sleep/read -t) - _sleep() { - {{if eq OS "windows"}}powershell.exe -Command "Start-Sleep -Seconds $1"{{else}}sleep "$1"{{end}} - } - - # --- Resolve ANDROID_HOME --- - if [ -z "${ANDROID_HOME:-}" ]; then - case "$HOST_OS" in - windows) - _localappdata="${LOCALAPPDATA:-}" - if [ -n "$_localappdata" ] && [ -d "$_localappdata/Android/Sdk" ]; then - export ANDROID_HOME="$_localappdata/Android/Sdk" - fi;; - darwin) - if [ -d "$HOME/Library/Android/sdk" ]; then - export ANDROID_HOME="$HOME/Library/Android/sdk" - fi;; - esac - fi - if [ -z "${ANDROID_HOME:-}" ]; then - echo "Error: ANDROID_HOME not set and could not be auto-detected." - exit 1 - fi - ANDROID_HOME="${ANDROID_HOME//\\//}" - - # --- Resolve adb --- - if command -v adb &>/dev/null; then - ADB="adb" - else - ADB="$ANDROID_HOME/platform-tools/adb" - if [ ! -x "$ADB" ] && [ -x "${ADB}.exe" ]; then - ADB="${ADB}.exe" - fi - fi - - # --- Resolve ANDROID_NDK_HOME --- - if [ -z "${ANDROID_NDK_HOME:-}" ]; then - if [ -d "$ANDROID_HOME/ndk" ]; then - for _d in "$ANDROID_HOME/ndk"/*/; do [ -d "$_d" ] && ANDROID_NDK_HOME="${_d%/}"; done - fi - if [ -z "${ANDROID_NDK_HOME:-}" ] || [ ! -d "${ANDROID_NDK_HOME}" ]; then - echo "Error: Could not find Android NDK. Set ANDROID_NDK_HOME." - exit 1 - fi - echo "Auto-detected NDK: $ANDROID_NDK_HOME" - export ANDROID_NDK_HOME - fi - ANDROID_NDK_HOME="${ANDROID_NDK_HOME//\\//}" - - # --- JDK 17 detection (Gradle 7.x requires it) --- - _need_jdk17=false - if [ -n "${JAVA_HOME:-}" ]; then - _jv=$("$JAVA_HOME/bin/java" -version 2>&1); _jv=${_jv#*\"}; _jv=${_jv%%.*} - [ "${_jv:-0}" -gt 17 ] 2>/dev/null && _need_jdk17=true || true - elif command -v java &>/dev/null; then - _jv=$(java -version 2>&1); _jv=${_jv#*\"}; _jv=${_jv%%.*} - [ "${_jv:-0}" -gt 17 ] 2>/dev/null && _need_jdk17=true || true - fi - if [ "$_need_jdk17" = true ]; then - _found="" - case "$HOST_OS" in - windows) - for _d in "/c/Program Files/Eclipse Adoptium"/jdk-17.*; do - [ -d "$_d" ] && _found="$_d" && break - done;; - darwin) - for _d in /Library/Java/JavaVirtualMachines/temurin-17.*/Contents/Home; do - [ -d "$_d" ] && _found="$_d" && break - done;; - linux) - for _d in /usr/lib/jvm/temurin-17-* /usr/lib/jvm/java-17-*; do - [ -d "$_d" ] && _found="$_d" && break - done;; - esac - if [ -n "$_found" ]; then - echo "Auto-detected JDK 17: $_found" - export JAVA_HOME="$_found" - else - echo "Warning: Java ${_jv} detected but Gradle 7.x needs JDK 17. Set JAVA_HOME to JDK 17." - fi - fi - - # --- Build native libraries --- - echo "=== Building native libraries (preset: {{.CMAKE_PRESET}}) ===" - - cmake --preset "{{.CMAKE_PRESET}}" \ - -DBUILD_TESTING=ON \ - -DCMAKE_ANDROID_NDK="$ANDROID_NDK_HOME" \ - -DCMAKE_ANDROID_ARCH_ABI="{{.ABI}}" \ - -DCMAKE_MAKE_PROGRAM="$(command -v ninja)" - - cmake --build "build/{{.CMAKE_PRESET}}" --config Debug \ - --target nakama-sdk nakama-test - - # --- Stage native libraries for Gradle --- - echo "=== Staging native libraries ===" - - jni_dir="integrationtests/android/jniLibs/{{.ABI}}" - mkdir -p "$jni_dir" - cp "build/{{.CMAKE_PRESET}}/Debug/libnakama-sdk.so" "$jni_dir/" - cp "build/{{.CMAKE_PRESET}}/integrationtests/Debug/libnakama-test.so" "$jni_dir/" - - 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 - cp "$stl_lib" "$jni_dir/" - else - echo "Warning: libc++_shared.so not found at $stl_lib" - fi - - # --- Build APK --- - echo "=== Building APK ===" - cd integrationtests/android - {{if eq OS "windows"}}cmd.exe /c gradlew.bat{{else}}./gradlew{{end}} assembleCustomDebugType -Pabi="{{.ABI}}" - - # --- Resolve device serial --- - PACKAGE="com.heroiclabs.nakamatest" - ACTIVITY="${PACKAGE}/.MainActivity" - TIMEOUT=300 - LOG_TAG="nakama" - APK_PATH="build/outputs/apk/customDebugType/nakamatest-customDebugType.apk" - - parse_devices() { - devices=() - local output - output=$("$ADB" devices) - while IFS= read -r line; do - if [[ "$line" == *$'\t'device ]]; then - devices+=("${line%%$'\t'*}") - fi - done <<< "$output" - } - - serial="{{.DEVICE}}" - if [ -z "$serial" ]; then - parse_devices - - if [ ${#devices[@]} -eq 0 ]; then - echo "No connected devices/emulators found. Starting emulator..." - EMULATOR="$ANDROID_HOME/emulator/emulator" - if [ ! -x "$EMULATOR" ] && [ -x "${EMULATOR}.exe" ]; then - EMULATOR="${EMULATOR}.exe" - fi - avd=$("$EMULATOR" -list-avds) - avd="${avd%%$'\n'*}" - avd="${avd//$'\r'/}" - if [ -z "$avd" ]; then - echo "Error: No AVDs found. Create one in Android Studio first." - exit 1 - fi - echo "Starting AVD: $avd" - {{if eq OS "windows"}}powershell.exe -Command "Start-Process -FilePath '${EMULATOR}' -ArgumentList '-avd','${avd}' -WindowStyle Hidden"{{else}}"$EMULATOR" -avd "$avd" &>/dev/null &{{end}} - echo "Waiting for device to come online..." - "$ADB" wait-for-device - while [[ "$("$ADB" shell getprop sys.boot_completed 2>/dev/null)" != *"1"* ]]; do - _sleep 2 - done - echo "Emulator booted." - parse_devices - fi - - if [ ${#devices[@]} -gt 1 ]; then - echo "Error: Multiple devices connected. Specify DEVICE=:" - "$ADB" devices - exit 1 - fi - serial="${devices[0]}" - echo "Auto-detected device: $serial" - fi - - adb_cmd() { - "$ADB" -s "$serial" "$@" - } - - # --- Port forwarding --- - echo "Setting up port forwarding..." - for port in 7349 7350 7351; do - adb_cmd reverse tcp:$port tcp:$port - done - - # --- Install APK --- - if [ ! -f "$APK_PATH" ]; then - echo "Error: APK not found at $APK_PATH" - exit 1 - fi - - echo "Installing APK..." - adb_cmd uninstall "$PACKAGE" 2>/dev/null || true - adb_cmd install -r "$APK_PATH" - - # --- Clear logcat and launch --- - adb_cmd logcat -c - echo "Launching $ACTIVITY..." - adb_cmd shell am start -n "$ACTIVITY" - - # --- Monitor logcat for test results --- - echo "Waiting for test results (timeout: ${TIMEOUT}s)..." - echo "---" - - logfile="logcat-output.tmp" - > "$logfile" - "$ADB" -s "$serial" logcat -s "${LOG_TAG}:V" -v raw > "$logfile" 2>/dev/null & - logcat_pid=$! - trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT - - result="" - SECONDS=0 - last_line=0 - - while [ "$SECONDS" -lt "$TIMEOUT" ]; do - line_num=0 - while IFS= read -r line; do - line_num=$((line_num + 1)) - if [ "$line_num" -le "$last_line" ]; then - continue - fi - echo "$line" - if [[ "$line" == *"Tests failed: 0"* ]]; then - result="passed" - elif [[ "$line" == *"Tests failed:"* ]]; then - result="failed" - fi - done < "$logfile" - last_line=$line_num - [ -n "$result" ] && break - _sleep 1 - done - - kill $logcat_pid 2>/dev/null || true - - echo "---" - - if [ -z "$result" ]; then - echo "TIMEOUT: Tests did not complete within ${TIMEOUT}s." - exit 1 - elif [ "$result" = "passed" ]; then - echo "ALL TESTS PASSED" - exit 0 - else - echo "TESTS FAILED" - exit 1 - fi + - bash integrationtests/android/test_android.sh \ No newline at end of file From e897c263997c7bd8f977f2100ec4776abb6111c6 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 19 Mar 2026 18:32:24 +0400 Subject: [PATCH 069/103] trigger on this branch --- .github/workflows/test_android.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 80ee8468b..98dfa7860 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -1,6 +1,9 @@ name: Test Android -on: [workflow_call, workflow_dispatch, pull_request] - +# on: [workflow_call, workflow_dispatch, pull_request] +on: + push: + branches: + - android-sh jobs: test_android: timeout-minutes: 30 From e762b7134ba7e73a2bfad4ac9f9074528796381f Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 19 Mar 2026 19:14:39 +0400 Subject: [PATCH 070/103] increase timeout --- .github/workflows/test_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 98dfa7860..ba956c8f6 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -6,7 +6,7 @@ on: - android-sh jobs: test_android: - timeout-minutes: 30 + timeout-minutes: 60 runs-on: ubuntu-22.04 env: ABI: x86_64 From 248a31bf88e6eb4a984b255e682abac4f8bb3c52 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 19 Mar 2026 20:06:28 +0400 Subject: [PATCH 071/103] upd : gradle version to fix syntax --- integrationtests/android/build.gradle | 10 ++++++++-- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/integrationtests/android/build.gradle b/integrationtests/android/build.gradle index 9c886ed65..0121ad3ed 100644 --- a/integrationtests/android/build.gradle +++ b/integrationtests/android/build.gradle @@ -16,11 +16,11 @@ buildscript { dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' + classpath 'com.android.tools.build:gradle:8.11.0' } } plugins { - id('com.android.application') version '7.3.0' + id('com.android.application') version '8.11.0' } def abi = (project.findProperty("abi") ?: "arm64-v8a").toString() @@ -41,9 +41,15 @@ repositories { } android { + namespace 'com.heroiclabs.nakamatest' compileSdk 34 ndkVersion "27.2.12479018" + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + defaultConfig { applicationId "com.heroiclabs.nakamatest" minSdk 21 diff --git a/integrationtests/android/gradle/wrapper/gradle-wrapper.properties b/integrationtests/android/gradle/wrapper/gradle-wrapper.properties index bac04d6ef..57cb6703f 100644 --- a/integrationtests/android/gradle/wrapper/gradle-wrapper.properties +++ b/integrationtests/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists android.enablePrefab=true From 3af9a2adb69f9e95704c2b311c1e224d89faa8ce Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 00:36:13 +0400 Subject: [PATCH 072/103] use gradle debug --- integrationtests/android/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/integrationtests/android/build.gradle b/integrationtests/android/build.gradle index 0121ad3ed..56751d9fd 100644 --- a/integrationtests/android/build.gradle +++ b/integrationtests/android/build.gradle @@ -71,6 +71,7 @@ android { buildTypes { customDebugType { debuggable true + matchingFallbacks = ['debug', 'release'] } release { minifyEnabled false From 2ecad252a5671d1f429bd17f1c1462746892d1e8 Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 01:18:08 +0400 Subject: [PATCH 073/103] add : aapt2 repository --- android/nakama-sdk/build.gradle.kts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/android/nakama-sdk/build.gradle.kts b/android/nakama-sdk/build.gradle.kts index ed59be4fb..153657e95 100644 --- a/android/nakama-sdk/build.gradle.kts +++ b/android/nakama-sdk/build.gradle.kts @@ -4,6 +4,11 @@ plugins { id("com.android.library") } +repositories { + google() + mavenCentral() +} + // Subproject needs to be named 'nakama-sdk' // because that is how dependent CMake projects will find us assertSubprojectName("nakama-sdk") From 7ec1d892e17ba0aa7e19da7ac18270c55f7c849e Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 01:49:41 +0400 Subject: [PATCH 074/103] fix : add repos --- android/nakama-sdk/build.gradle.kts | 5 ----- integrationtests/android/build.gradle | 6 ------ integrationtests/android/settings.gradle | 10 +++++++++- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/android/nakama-sdk/build.gradle.kts b/android/nakama-sdk/build.gradle.kts index 153657e95..ed59be4fb 100644 --- a/android/nakama-sdk/build.gradle.kts +++ b/android/nakama-sdk/build.gradle.kts @@ -4,11 +4,6 @@ plugins { id("com.android.library") } -repositories { - google() - mavenCentral() -} - // Subproject needs to be named 'nakama-sdk' // because that is how dependent CMake projects will find us assertSubprojectName("nakama-sdk") diff --git a/integrationtests/android/build.gradle b/integrationtests/android/build.gradle index 56751d9fd..ebde5b493 100644 --- a/integrationtests/android/build.gradle +++ b/integrationtests/android/build.gradle @@ -34,12 +34,6 @@ dependencies { implementation project(':nakama-sdk') } -repositories { - google() - mavenCentral() - gradlePluginPortal() -} - android { namespace 'com.heroiclabs.nakamatest' compileSdk 34 diff --git a/integrationtests/android/settings.gradle b/integrationtests/android/settings.gradle index e7c8f362a..a3a5a6227 100644 --- a/integrationtests/android/settings.gradle +++ b/integrationtests/android/settings.gradle @@ -8,4 +8,12 @@ pluginManagement { rootProject.name = 'nakamatest' include ':nakama-sdk' -project(':nakama-sdk').projectDir = new File(settingsDir, '../../android/nakama-sdk') \ No newline at end of file +project(':nakama-sdk').projectDir = new File(settingsDir, '../../android/nakama-sdk') + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) + repositories { + google() + mavenCentral() + } +} \ No newline at end of file From 93acfe84484ca6658b4495f77daa0f172e22448a Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 02:28:43 +0400 Subject: [PATCH 075/103] fix : matching minsdk versions --- integrationtests/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrationtests/android/build.gradle b/integrationtests/android/build.gradle index ebde5b493..4ceb548fc 100644 --- a/integrationtests/android/build.gradle +++ b/integrationtests/android/build.gradle @@ -46,7 +46,7 @@ android { defaultConfig { applicationId "com.heroiclabs.nakamatest" - minSdk 21 + minSdk 28 targetSdk 34 versionCode 1 versionName '1.0' From 80d99f04a790b70542286a3bf2ad841665f4aec8 Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 03:14:31 +0400 Subject: [PATCH 076/103] fix : set adb --- .github/actions/setup-vcpkg-android/action.yml | 13 +++++++++++-- integrationtests/android/test_android.sh | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-vcpkg-android/action.yml b/.github/actions/setup-vcpkg-android/action.yml index f6d08293b..47e838655 100644 --- a/.github/actions/setup-vcpkg-android/action.yml +++ b/.github/actions/setup-vcpkg-android/action.yml @@ -8,9 +8,18 @@ inputs: runs: using: "composite" steps: - - name: Set VCPKG_ROOT + - name: Export GitHub Actions cache environment variables + uses: actions/github-script@v7 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Set VCPKG_ROOT and Binary Sources shell: bash - run: echo "VCPKG_ROOT=${{ github.workspace }}/${{ inputs.vcpkg-path }}" >> $GITHUB_ENV + run: | + echo "VCPKG_ROOT=${{ github.workspace }}/${{ inputs.vcpkg-path }}" >> $GITHUB_ENV + echo "VCPKG_BINARY_SOURCES=clear;x-gha,readwrite" >> $GITHUB_ENV - name: Bootstrap vcpkg shell: bash diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 9ca90559e..cfb276fac 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -45,6 +45,7 @@ cd ../../ # --- Resolve device serial --- +ADB="${ADB:-adb}" PACKAGE="com.heroiclabs.nakamatest" ACTIVITY="${PACKAGE}/.MainActivity" TIMEOUT=300 From 0433ebaeff3a64f9d636b7a5bb399774c170d965 Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 04:12:42 +0400 Subject: [PATCH 077/103] dbg: timeout --- .github/workflows/test_android.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index ba956c8f6..af8fe0c5a 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -6,7 +6,7 @@ on: - android-sh jobs: test_android: - timeout-minutes: 60 + timeout-minutes: 120 runs-on: ubuntu-22.04 env: ABI: x86_64 From cdb64e5c3c9318076b8642b26160da64fb8ff593 Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 14:14:48 +0400 Subject: [PATCH 078/103] dbg : add caching, time --- integrationtests/android/test_android.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index cfb276fac..35f350606 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -7,7 +7,7 @@ set -eo pipefail : "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME}" echo "=== Building C++ Test Library ===" -cmake --preset "$CMAKE_PRESET" \ +time cmake --preset "$CMAKE_PRESET" \ -DBUILD_TESTING=ON \ -DCMAKE_ANDROID_NDK="$ANDROID_NDK_HOME" \ -DCMAKE_ANDROID_ARCH_ABI="$ABI" \ @@ -35,12 +35,12 @@ fi echo "=== Building Official Android SDK (Release) ===" cd android -./gradlew assembleRelease --no-daemon +time ./gradlew assembleRelease -Pabi="$ABI" --no-daemon cd .. echo "=== Building Integration Tests ===" cd integrationtests/android -./gradlew assembleCustomDebugType --no-daemon +time ./gradlew assembleCustomDebugType -Pabi="$ABI" --no-daemon cd ../../ From 3378072f0f95af763c433e14582f86967ef850ed Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 14:17:46 +0400 Subject: [PATCH 079/103] fix : apk path --- integrationtests/android/test_android.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 35f350606..f83752fb4 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -50,7 +50,7 @@ PACKAGE="com.heroiclabs.nakamatest" ACTIVITY="${PACKAGE}/.MainActivity" TIMEOUT=300 LOG_TAG="nakama" - APK_PATH="integrationtests/android/build/outputs/apk/customDebugType/nakamatest-customDebugType.apk" + APK_PATH=$(ls integrationtests/android/build/outputs/apk/customDebugType/*.apk 2>/dev/null | head -n 1) parse_devices() { devices=() From 4be85f01cbb33e949cfadf4155b1e94972f9c18c Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 15:42:32 +0400 Subject: [PATCH 080/103] fix : signing issue --- integrationtests/android/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/integrationtests/android/build.gradle b/integrationtests/android/build.gradle index 4ceb548fc..a452e00a5 100644 --- a/integrationtests/android/build.gradle +++ b/integrationtests/android/build.gradle @@ -65,6 +65,7 @@ android { buildTypes { customDebugType { debuggable true + signingConfig signingConfigs.debug matchingFallbacks = ['debug', 'release'] } release { From d3c9b6b1f27c2e78e8780a2627b59caccc2ab95f Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 17:08:35 +0400 Subject: [PATCH 081/103] fix : bash syntax --- integrationtests/android/test_android.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index f83752fb4..7670af704 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -85,7 +85,7 @@ PACKAGE="com.heroiclabs.nakamatest" echo "Waiting for device to come online..." "$ADB" wait-for-device while [[ "$("$ADB" shell getprop sys.boot_completed 2>/dev/null)" != *"1"* ]]; do - _sleep 2 + sleep 2 done echo "Emulator booted." parse_devices @@ -155,7 +155,7 @@ PACKAGE="com.heroiclabs.nakamatest" done < "$logfile" last_line=$line_num [ -n "$result" ] && break - _sleep 1 + sleep 1 done kill $logcat_pid 2>/dev/null || true From 8a530979ee2342f93763ae5b0fcc7f31c92d3816 Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 18:57:36 +0400 Subject: [PATCH 082/103] fix : app now had sdk .so right in jniLib folder; add logs for android runtime --- integrationtests/android/test_android.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 7670af704..8b39dd16d 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -18,8 +18,9 @@ cmake --build "build/$CMAKE_PRESET" --config Debug --target nakama-test jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" -# ONLY stage the test library. The SDK is handled by Gradle. +# ONLY stage the test and SDK libraries. cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" +cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" case "$ABI" in arm64-v8a) triple="aarch64-linux-android";; @@ -131,7 +132,7 @@ PACKAGE="com.heroiclabs.nakamatest" logfile="logcat-output.tmp" > "$logfile" - "$ADB" -s "$serial" logcat -s "${LOG_TAG}:V" -v raw > "$logfile" 2>/dev/null & + "$ADB" -s "$serial" logcat "nakama:V" "AndroidRuntime:E" "ActivityManager:E" "*:S" -v raw > "$logfile" 2>/dev/null & logcat_pid=$! trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT From fe12a9582f522d0453c2030f10b267414c19e56d Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 20 Mar 2026 21:00:33 +0400 Subject: [PATCH 083/103] fix error type 3 issue with ANR --- android/nakama-sdk/build.gradle.kts | 3 ++- .../heroiclabs/nakamatest/MainActivity.java | 22 ++++++++++++++----- integrationtests/android/test_android.sh | 6 ++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/android/nakama-sdk/build.gradle.kts b/android/nakama-sdk/build.gradle.kts index ed59be4fb..4e806896c 100644 --- a/android/nakama-sdk/build.gradle.kts +++ b/android/nakama-sdk/build.gradle.kts @@ -66,6 +66,7 @@ android { "-DANDROID_STL=c++_shared", "-DINSIDE_GRADLE=ON", // this is picked up by our CMake to interpose VCPKG toolchain "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", + "-DCMAKE_TOOLCHAIN_FILE=${project.rootDir}/../submodules/vcpkg/scripts/buildsystems/vcpkg.cmake", ) targets("nakama-sdk") } @@ -94,7 +95,7 @@ android { // This is a prefab-only AAR, remove all jniLibs , which are just stripped version // of what we already include in prefab packaging { - jniLibs.excludes += ("**/*.so") + // jniLibs.excludes += ("**/*.so") } buildToolsVersion = "36.0.0" diff --git a/integrationtests/android/src/main/java/com/heroiclabs/nakamatest/MainActivity.java b/integrationtests/android/src/main/java/com/heroiclabs/nakamatest/MainActivity.java index 1ee7de863..87497ba46 100644 --- a/integrationtests/android/src/main/java/com/heroiclabs/nakamatest/MainActivity.java +++ b/integrationtests/android/src/main/java/com/heroiclabs/nakamatest/MainActivity.java @@ -7,10 +7,22 @@ public class MainActivity extends Activity { @Override protected void onCreate(final Bundle savedInstanceState) { - // load sdk first so that it may initialize before the test application - Log.i("libnakama-test MainActivity", "Loading libnakama..."); - System.loadLibrary("nakama-sdk"); - Log.i("libnakama-test MainActivity", "Loading libnakama-test..."); - System.loadLibrary("nakama-test"); + super.onCreate(savedInstanceState); + + Log.i("libnakama-test MainActivity", "Starting tests in background thread..."); + + new Thread(new Runnable() { + @Override + public void run() { + try { + Log.i("libnakama-test MainActivity", "Loading libnakama..."); + System.loadLibrary("nakama-sdk"); + Log.i("libnakama-test MainActivity", "Loading libnakama-test..."); + System.loadLibrary("nakama-test"); + } catch (Exception e) { + Log.e("libnakama-test MainActivity", "Failed to load libraries: " + e.getMessage()); + } + } + }).start(); } } \ No newline at end of file diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 8b39dd16d..c59d58388 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -123,8 +123,8 @@ PACKAGE="com.heroiclabs.nakamatest" # --- Clear logcat and launch --- adb_cmd logcat -c - echo "Launching $ACTIVITY..." - adb_cmd shell am start -n "$ACTIVITY" + echo "Launching $PACKAGE via monkey..." + adb_cmd shell monkey -p "$PACKAGE" -c android.intent.category.LAUNCHER 1 # --- Monitor logcat for test results --- echo "Waiting for test results (timeout: ${TIMEOUT}s)..." @@ -132,7 +132,7 @@ PACKAGE="com.heroiclabs.nakamatest" logfile="logcat-output.tmp" > "$logfile" - "$ADB" -s "$serial" logcat "nakama:V" "AndroidRuntime:E" "ActivityManager:E" "*:S" -v raw > "$logfile" 2>/dev/null & + "$ADB" -s "$serial" logcat "libnakama-test:V" "nakama:V" "AndroidRuntime:E" "ActivityManager:E" "*:S" -v raw > "$logfile" 2>/dev/null & logcat_pid=$! trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT From c44dcfd6ff566e89ce1c98b98ed8066ad1028586 Mon Sep 17 00:00:00 2001 From: twillian Date: Sat, 21 Mar 2026 16:02:12 +0400 Subject: [PATCH 084/103] fixx recursion error --- android/nakama-sdk/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/android/nakama-sdk/build.gradle.kts b/android/nakama-sdk/build.gradle.kts index 4e806896c..b7a3f862b 100644 --- a/android/nakama-sdk/build.gradle.kts +++ b/android/nakama-sdk/build.gradle.kts @@ -66,7 +66,6 @@ android { "-DANDROID_STL=c++_shared", "-DINSIDE_GRADLE=ON", // this is picked up by our CMake to interpose VCPKG toolchain "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", - "-DCMAKE_TOOLCHAIN_FILE=${project.rootDir}/../submodules/vcpkg/scripts/buildsystems/vcpkg.cmake", ) targets("nakama-sdk") } From f17e8906c154283161cf16b2b7aac209cbc493f7 Mon Sep 17 00:00:00 2001 From: twillian Date: Sat, 21 Mar 2026 17:38:42 +0400 Subject: [PATCH 085/103] dbg : try reduced volume for throughout tests --- integrationtests/src/test_throughput.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/integrationtests/src/test_throughput.cpp b/integrationtests/src/test_throughput.cpp index a7ffc6d91..b47a2547d 100644 --- a/integrationtests/src/test_throughput.cpp +++ b/integrationtests/src/test_throughput.cpp @@ -219,7 +219,11 @@ void test_throughput_rpc100MB() { string payload(payloadSize, 'w'); payload = "{\"d\":\"" + payload + "\"}"; +#if defined(__ANDROID__) + const size_t targetBytes = 20ULL * 1024 * 1024; +#else const size_t targetBytes = 100ULL * 1024 * 1024; +#endif const int messageCount = static_cast(targetBytes / payload.size()); const size_t totalBytesSent = payload.size() * messageCount; const size_t totalBytesRoundTrip = totalBytesSent * 2; From 13b27a8008f2a2dd546ab8362d1109aa2435995c Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 23 Mar 2026 12:08:16 +0400 Subject: [PATCH 086/103] dbg : increase timeout --- integrationtests/android/test_android.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index c59d58388..6ca2a23d5 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -49,7 +49,7 @@ cd ../../ ADB="${ADB:-adb}" PACKAGE="com.heroiclabs.nakamatest" ACTIVITY="${PACKAGE}/.MainActivity" - TIMEOUT=300 + TIMEOUT=600 LOG_TAG="nakama" APK_PATH=$(ls integrationtests/android/build/outputs/apk/customDebugType/*.apk 2>/dev/null | head -n 1) From 75fe2a2481076bdc4a6a6a715a41fc36ccc3b13d Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 23 Mar 2026 14:03:16 +0400 Subject: [PATCH 087/103] trigger in master --- .github/workflows/test_android.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index af8fe0c5a..4b48ea312 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -1,9 +1,5 @@ name: Test Android -# on: [workflow_call, workflow_dispatch, pull_request] -on: - push: - branches: - - android-sh +on: [workflow_call, workflow_dispatch, pull_request] jobs: test_android: timeout-minutes: 120 From ad9a97d1f05a7cc54df9b2cbbde9ad249f84a1e0 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 23 Mar 2026 15:42:16 +0400 Subject: [PATCH 088/103] upd : increase timeout, build only release --- .github/workflows/test_android.yml | 2 +- integrationtests/android/test_android.sh | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 4b48ea312..8286650f6 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -49,4 +49,4 @@ jobs: 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 + 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 BUILD_TYPE=MinSizeRel diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 6ca2a23d5..e0ab79a0b 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -7,20 +7,21 @@ set -eo pipefail : "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME}" echo "=== Building C++ Test Library ===" +BUILD_TYPE="${BUILD_TYPE:-MinSizeRel}" time cmake --preset "$CMAKE_PRESET" \ -DBUILD_TESTING=ON \ -DCMAKE_ANDROID_NDK="$ANDROID_NDK_HOME" \ -DCMAKE_ANDROID_ARCH_ABI="$ABI" \ -DCMAKE_MAKE_PROGRAM="$(command -v ninja)" -cmake --build "build/$CMAKE_PRESET" --config Debug --target nakama-test +cmake --build "build/$CMAKE_PRESET" --config "$BUILD_TYPE" --target nakama-test jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" # ONLY stage the test and SDK libraries. -cp "build/$CMAKE_PRESET/integrationtests/Debug/libnakama-test.so" "$jni_dir/" -cp "build/$CMAKE_PRESET/Debug/libnakama-sdk.so" "$jni_dir/" +cp "build/$CMAKE_PRESET/integrationtests/$BUILD_TYPE/libnakama-test.so" "$jni_dir/" +cp "build/$CMAKE_PRESET/$BUILD_TYPE/libnakama-sdk.so" "$jni_dir/" case "$ABI" in arm64-v8a) triple="aarch64-linux-android";; @@ -49,7 +50,7 @@ cd ../../ ADB="${ADB:-adb}" PACKAGE="com.heroiclabs.nakamatest" ACTIVITY="${PACKAGE}/.MainActivity" - TIMEOUT=600 + TIMEOUT=900 LOG_TAG="nakama" APK_PATH=$(ls integrationtests/android/build/outputs/apk/customDebugType/*.apk 2>/dev/null | head -n 1) From 9b408fafa86d4971da330bf8a6462c026f8e4a64 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 23 Mar 2026 17:14:25 +0400 Subject: [PATCH 089/103] add release artifacts upload --- .github/workflows/test_android.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 8286650f6..0fb47bc38 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -38,6 +38,17 @@ jobs: - name: Install Task run: npm install -g @go-task/cli + - name: Build Release AAR + run: ./gradlew :nakama-sdk:assembleRelease -Pabi=$ABI + working-directory: nakama-cpp/android + + - name: Upload Release AAR + uses: actions/upload-artifact@v4 + with: + name: nakama-sdk-android-aar-${{ env.ABI }} + path: nakama-cpp/android/nakama-sdk/build/outputs/aar/*-release.aar + if-no-files-found: error + - name: Run tests on emulator uses: reactivecircus/android-emulator-runner@e89f39f1abbbd05b1113a29cf4db69e7540cae5a with: From aec34f91b401659a2fb07335ec35b7799eafe740 Mon Sep 17 00:00:00 2001 From: upwelling-twll <92473270+upwelling-twll@users.noreply.github.com> Date: Thu, 26 Mar 2026 13:26:12 +0400 Subject: [PATCH 090/103] Apply suggestions from code review add platforms;android-34 and build-tools;36.0.0 to the sdkmanager package list since the Gradle builds use compileSdk=34 and (in android/nakama-sdk) buildToolsVersion=36.0.0, the workflow currently depends on whatever happens to be preinstalled on the runner and may fail when those packages are missing. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/actions/setup-android/action.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/actions/setup-android/action.yml b/.github/actions/setup-android/action.yml index 9d5210fb6..c8fa61909 100644 --- a/.github/actions/setup-android/action.yml +++ b/.github/actions/setup-android/action.yml @@ -11,6 +11,14 @@ inputs: cmake-version: description: 'Android CMake version' required: true + compile-sdk: + description: 'Android compileSdk version (used to install platforms;android-)' + required: false + default: '34' + build-tools-version: + description: 'Android buildToolsVersion (used to install build-tools;)' + required: false + default: '36.0.0' install-emulator: description: 'Whether to install emulator packages' required: false @@ -54,6 +62,8 @@ runs: SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" packages=( + "platforms;android-${{ inputs.compile-sdk }}" + "build-tools;${{ inputs.build-tools-version }}" "ndk;${{ inputs.ndk-version }}" "cmake;${{ inputs.cmake-version }}" ) From 319ccb6eee6c60f02a0c7c5e511df44ce42b49c3 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 26 Mar 2026 14:30:02 +0400 Subject: [PATCH 091/103] add : cache android sdk, gradle dependencies, cmake build (cpp libs, vcpkg packages) --- .github/workflows/test_android.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 0fb47bc38..8d4ee1a07 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -20,6 +20,22 @@ jobs: git submodule update --init --filter=blob:none -- submodules/vcpkg working-directory: nakama-cpp + - name: Cache Android SDK + uses: actions/cache@v4 + with: + path: ~/android-sdk + key: android-sdk-${{ hashFiles('.github/actions/setup-android/action.yml') }} + restore-keys: | + android-sdk- + + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: gradle-${{ hashFiles('android/**/*.gradle.kts', 'android/**/*.gradle') }} + restore-keys: | + gradle- + - uses: ./nakama-cpp/.github/actions/setup-android with: ndk-version: 27.2.12479018 @@ -31,6 +47,14 @@ jobs: with: vcpkg-path: nakama-cpp/submodules/vcpkg + - name: Cache CMake build + uses: actions/cache@v4 + with: + path: nakama-cpp/build + key: cmake-build-${{ env.CMAKE_PRESET }}-${{ hashFiles('CMakeLists.txt', 'vcpkg.json', '**/CMakePresets.json') }} + restore-keys: | + cmake-build-${{ env.CMAKE_PRESET }}- + - name: Start Nakama server run: docker compose -f integrationtests/server/docker-compose.yml up -d --build --wait working-directory: nakama-cpp From 390226cf35910ec529629ce7d5240db8f535ad92 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 26 Mar 2026 16:26:21 +0400 Subject: [PATCH 092/103] upd : use gradle-build lib from aar for testing --- integrationtests/android/test_android.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index e0ab79a0b..67a540d43 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -19,9 +19,21 @@ cmake --build "build/$CMAKE_PRESET" --config "$BUILD_TYPE" --target nakama-test jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" -# ONLY stage the test and SDK libraries. +# Stage the test runner from the CMake build. cp "build/$CMAKE_PRESET/integrationtests/$BUILD_TYPE/libnakama-test.so" "$jni_dir/" -cp "build/$CMAKE_PRESET/$BUILD_TYPE/libnakama-sdk.so" "$jni_dir/" + +# Stage the SDK .so from the Gradle AAR, NOT from the CMake build. +# The Gradle build passes flags that the direct cmake --preset path does not: +# -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON (16 KB page alignment, required on Android 15+) +# -DANDROID_STL=c++_shared +# -DINSIDE_GRADLE=ON (vcpkg toolchain interposition workaround) +# Using the AAR's .so ensures the tested binary matches what ships to users. +AAR_PATH="android/nakama-sdk/build/outputs/aar/nakama-sdk-release.aar" +if [ ! -f "$AAR_PATH" ]; then + echo "Error: AAR not found at $AAR_PATH. Run './gradlew :nakama-sdk:assembleRelease' first." + exit 1 +fi +unzip -jo "$AAR_PATH" "jni/$ABI/libnakama-sdk.so" -d "$jni_dir/" case "$ABI" in arm64-v8a) triple="aarch64-linux-android";; From fee886b3ad7fb86281820aa72047e55104617d5b Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 26 Mar 2026 18:11:46 +0400 Subject: [PATCH 093/103] upd : fix build and extract order --- integrationtests/android/test_android.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 67a540d43..1a3d41031 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -16,6 +16,12 @@ time cmake --preset "$CMAKE_PRESET" \ cmake --build "build/$CMAKE_PRESET" --config "$BUILD_TYPE" --target nakama-test +# Build the official SDK AAR first — it must exist before we extract its .so below. +echo "=== Building Official Android SDK (Release) ===" +cd android +time ./gradlew assembleRelease -Pabi="$ABI" --no-daemon +cd .. + jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" @@ -29,10 +35,6 @@ cp "build/$CMAKE_PRESET/integrationtests/$BUILD_TYPE/libnakama-test.so" "$jni_di # -DINSIDE_GRADLE=ON (vcpkg toolchain interposition workaround) # Using the AAR's .so ensures the tested binary matches what ships to users. AAR_PATH="android/nakama-sdk/build/outputs/aar/nakama-sdk-release.aar" -if [ ! -f "$AAR_PATH" ]; then - echo "Error: AAR not found at $AAR_PATH. Run './gradlew :nakama-sdk:assembleRelease' first." - exit 1 -fi unzip -jo "$AAR_PATH" "jni/$ABI/libnakama-sdk.so" -d "$jni_dir/" case "$ABI" in @@ -47,11 +49,6 @@ if [ -f "$stl_lib" ]; then cp "$stl_lib" "$jni_dir/" fi -echo "=== Building Official Android SDK (Release) ===" -cd android -time ./gradlew assembleRelease -Pabi="$ABI" --no-daemon -cd .. - echo "=== Building Integration Tests ===" cd integrationtests/android time ./gradlew assembleCustomDebugType -Pabi="$ABI" --no-daemon From 260ec4e617e98632a3f6e1275917df99273b6063 Mon Sep 17 00:00:00 2001 From: twillian Date: Thu, 26 Mar 2026 19:38:56 +0400 Subject: [PATCH 094/103] dbg : increase timeoit (emulator is slow) --- integrationtests/android/test_android.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 1a3d41031..8ff83b5ef 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -59,7 +59,7 @@ cd ../../ ADB="${ADB:-adb}" PACKAGE="com.heroiclabs.nakamatest" ACTIVITY="${PACKAGE}/.MainActivity" - TIMEOUT=900 + TIMEOUT=1800 LOG_TAG="nakama" APK_PATH=$(ls integrationtests/android/build/outputs/apk/customDebugType/*.apk 2>/dev/null | head -n 1) From 44f91a0c9dd0480ca658827f01693bffa46621d0 Mon Sep 17 00:00:00 2001 From: twillian Date: Fri, 27 Mar 2026 14:18:24 +0400 Subject: [PATCH 095/103] upd : reuse library built by action file to reduce time spent on android build --- integrationtests/android/test_android.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 8ff83b5ef..f9d2cb937 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -5,6 +5,7 @@ set -eo pipefail : "${CMAKE_PRESET:?Set CMAKE_PRESET}" : "${VCPKG_ROOT:?Set VCPKG_ROOT}" : "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME}" +AAR_PATH="${AAR_PATH:-android/nakama-sdk/build/outputs/aar/nakama-sdk-release.aar}" echo "=== Building C++ Test Library ===" BUILD_TYPE="${BUILD_TYPE:-MinSizeRel}" @@ -16,12 +17,6 @@ time cmake --preset "$CMAKE_PRESET" \ cmake --build "build/$CMAKE_PRESET" --config "$BUILD_TYPE" --target nakama-test -# Build the official SDK AAR first — it must exist before we extract its .so below. -echo "=== Building Official Android SDK (Release) ===" -cd android -time ./gradlew assembleRelease -Pabi="$ABI" --no-daemon -cd .. - jni_dir="integrationtests/android/jniLibs/$ABI" mkdir -p "$jni_dir" @@ -34,7 +29,10 @@ cp "build/$CMAKE_PRESET/integrationtests/$BUILD_TYPE/libnakama-test.so" "$jni_di # -DANDROID_STL=c++_shared # -DINSIDE_GRADLE=ON (vcpkg toolchain interposition workaround) # Using the AAR's .so ensures the tested binary matches what ships to users. -AAR_PATH="android/nakama-sdk/build/outputs/aar/nakama-sdk-release.aar" +if [ ! -f "$AAR_PATH" ]; then + echo "Error: AAR not found at $AAR_PATH. Please run './gradlew :nakama-sdk:assembleRelease' first, or run through CI." + exit 1 +fi unzip -jo "$AAR_PATH" "jni/$ABI/libnakama-sdk.so" -d "$jni_dir/" case "$ABI" in From a5e7ce60fdda5685258bd7b8192bffe1dc1c4d9b Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 30 Mar 2026 14:07:46 +0400 Subject: [PATCH 096/103] upd : trigger android test on comment 'test android' --- .github/workflows/test_android.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 8d4ee1a07..343b6408d 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -1,8 +1,17 @@ name: Test Android -on: [workflow_call, workflow_dispatch, pull_request] +on: + workflow_call: + workflow_dispatch: + issue_comment: + types: [created] + jobs: test_android: - timeout-minutes: 120 + if: | + github.event_name == 'workflow_call' || + github.event_name == 'workflow_dispatch' || + (github.event.issue.pull_request && contains(github.event.comment.body, '/test android')) + timeout-minutes: 100 runs-on: ubuntu-22.04 env: ABI: x86_64 From fa764f773af294b2415f3e6bbff576bb95a73a2c Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 30 Mar 2026 14:32:48 +0400 Subject: [PATCH 097/103] upd : rm extra indent --- integrationtests/android/test_android.sh | 250 +++++++++++------------ 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index f9d2cb937..8e4ddd01b 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -56,131 +56,131 @@ cd ../../ # --- Resolve device serial --- ADB="${ADB:-adb}" PACKAGE="com.heroiclabs.nakamatest" - ACTIVITY="${PACKAGE}/.MainActivity" - TIMEOUT=1800 - LOG_TAG="nakama" - APK_PATH=$(ls integrationtests/android/build/outputs/apk/customDebugType/*.apk 2>/dev/null | head -n 1) - - parse_devices() { - devices=() - local output - output=$("$ADB" devices) - while IFS= read -r line; do - if [[ "$line" == *$'\t'device ]]; then - devices+=("${line%%$'\t'*}") - fi - done <<< "$output" - } - - serial="${DEVICE}" - if [ -z "$serial" ]; then - parse_devices - - if [ ${#devices[@]} -eq 0 ]; then - echo "No connected devices/emulators found. Starting emulator..." - EMULATOR="$ANDROID_HOME/emulator/emulator" - if [ ! -x "$EMULATOR" ] && [ -x "${EMULATOR}.exe" ]; then - EMULATOR="${EMULATOR}.exe" - fi - avd=$("$EMULATOR" -list-avds) - avd="${avd%%$'\n'*}" - avd="${avd//$'\r'/}" - if [ -z "$avd" ]; then - echo "Error: No AVDs found. Create one in Android Studio first." - exit 1 - fi - echo "Starting AVD: $avd" - {{if eq OS "windows"}}powershell.exe -Command "Start-Process -FilePath '${EMULATOR}' -ArgumentList '-avd','${avd}' -WindowStyle Hidden"{{else}}"$EMULATOR" -avd "$avd" &>/dev/null &{{end}} - echo "Waiting for device to come online..." - "$ADB" wait-for-device - while [[ "$("$ADB" shell getprop sys.boot_completed 2>/dev/null)" != *"1"* ]]; do - sleep 2 - done - echo "Emulator booted." - parse_devices - fi - - if [ ${#devices[@]} -gt 1 ]; then - echo "Error: Multiple devices connected. Specify DEVICE=:" - "$ADB" devices - exit 1 - fi - serial="${devices[0]}" - echo "Auto-detected device: $serial" - fi - - adb_cmd() { - "$ADB" -s "$serial" "$@" - } - - # --- Port forwarding --- - echo "Setting up port forwarding..." - for port in 7349 7350 7351; do - adb_cmd reverse tcp:$port tcp:$port - done - - # --- Install APK --- - if [ ! -f "$APK_PATH" ]; then - echo "Error: APK not found at $APK_PATH" - exit 1 - fi - - echo "Installing APK..." - adb_cmd uninstall "$PACKAGE" 2>/dev/null || true - adb_cmd install -r "$APK_PATH" - - # --- Clear logcat and launch --- - adb_cmd logcat -c - echo "Launching $PACKAGE via monkey..." - adb_cmd shell monkey -p "$PACKAGE" -c android.intent.category.LAUNCHER 1 - - # --- Monitor logcat for test results --- - echo "Waiting for test results (timeout: ${TIMEOUT}s)..." - echo "---" - - logfile="logcat-output.tmp" - > "$logfile" - "$ADB" -s "$serial" logcat "libnakama-test:V" "nakama:V" "AndroidRuntime:E" "ActivityManager:E" "*:S" -v raw > "$logfile" 2>/dev/null & - logcat_pid=$! - trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT - - result="" - SECONDS=0 - last_line=0 - - while [ "$SECONDS" -lt "$TIMEOUT" ]; do - line_num=0 - while IFS= read -r line; do - line_num=$((line_num + 1)) - if [ "$line_num" -le "$last_line" ]; then - continue - fi - echo "$line" - if [[ "$line" == *"Tests failed: 0"* ]]; then - result="passed" - elif [[ "$line" == *"Tests failed:"* ]]; then - result="failed" - fi - done < "$logfile" - last_line=$line_num - [ -n "$result" ] && break - sleep 1 - done - - kill $logcat_pid 2>/dev/null || true - - echo "---" - - if [ -z "$result" ]; then - echo "TIMEOUT: Tests did not complete within ${TIMEOUT}s." - exit 1 - elif [ "$result" = "passed" ]; then - echo "ALL TESTS PASSED" - exit 0 - else - echo "TESTS FAILED" - exit 1 - fi +ACTIVITY="${PACKAGE}/.MainActivity" +TIMEOUT=1800 +LOG_TAG="nakama" +APK_PATH=$(ls integrationtests/android/build/outputs/apk/customDebugType/*.apk 2>/dev/null | head -n 1) + +parse_devices() { + devices=() + local output + output=$("$ADB" devices) + while IFS= read -r line; do + if [[ "$line" == *$'\t'device ]]; then + devices+=("${line%%$'\t'*}") + fi + done <<< "$output" +} + +serial="${DEVICE}" +if [ -z "$serial" ]; then + parse_devices + + if [ ${#devices[@]} -eq 0 ]; then + echo "No connected devices/emulators found. Starting emulator..." + EMULATOR="$ANDROID_HOME/emulator/emulator" + if [ ! -x "$EMULATOR" ] && [ -x "${EMULATOR}.exe" ]; then + EMULATOR="${EMULATOR}.exe" + fi + avd=$("$EMULATOR" -list-avds) + avd="${avd%%$'\n'*}" + avd="${avd//$'\r'/}" + if [ -z "$avd" ]; then + echo "Error: No AVDs found. Create one in Android Studio first." + exit 1 + fi + echo "Starting AVD: $avd" + {{if eq OS "windows"}}powershell.exe -Command "Start-Process -FilePath '${EMULATOR}' -ArgumentList '-avd','${avd}' -WindowStyle Hidden"{{else}}"$EMULATOR" -avd "$avd" &>/dev/null &{{end}} + echo "Waiting for device to come online..." + "$ADB" wait-for-device + while [[ "$("$ADB" shell getprop sys.boot_completed 2>/dev/null)" != *"1"* ]]; do + sleep 2 + done + echo "Emulator booted." + parse_devices + fi + + if [ ${#devices[@]} -gt 1 ]; then + echo "Error: Multiple devices connected. Specify DEVICE=:" + "$ADB" devices + exit 1 + fi + serial="${devices[0]}" + echo "Auto-detected device: $serial" +fi + +adb_cmd() { + "$ADB" -s "$serial" "$@" +} + +# --- Port forwarding --- +echo "Setting up port forwarding..." +for port in 7349 7350 7351; do + adb_cmd reverse tcp:$port tcp:$port +done + +# --- Install APK --- +if [ ! -f "$APK_PATH" ]; then + echo "Error: APK not found at $APK_PATH" + exit 1 +fi + +echo "Installing APK..." +adb_cmd uninstall "$PACKAGE" 2>/dev/null || true +adb_cmd install -r "$APK_PATH" + +# --- Clear logcat and launch --- +adb_cmd logcat -c +echo "Launching $PACKAGE via monkey..." +adb_cmd shell monkey -p "$PACKAGE" -c android.intent.category.LAUNCHER 1 + +# --- Monitor logcat for test results --- +echo "Waiting for test results (timeout: ${TIMEOUT}s)..." +echo "---" + +logfile="logcat-output.tmp" +> "$logfile" +"$ADB" -s "$serial" logcat "libnakama-test:V" "nakama:V" "AndroidRuntime:E" "ActivityManager:E" "*:S" -v raw > "$logfile" 2>/dev/null & +logcat_pid=$! +trap 'rm -f "$logfile"; kill $logcat_pid 2>/dev/null || true' EXIT + +result="" +SECONDS=0 +last_line=0 + +while [ "$SECONDS" -lt "$TIMEOUT" ]; do + line_num=0 + while IFS= read -r line; do + line_num=$((line_num + 1)) + if [ "$line_num" -le "$last_line" ]; then + continue + fi + echo "$line" + if [[ "$line" == *"Tests failed: 0"* ]]; then + result="passed" + elif [[ "$line" == *"Tests failed:"* ]]; then + result="failed" + fi + done < "$logfile" + last_line=$line_num + [ -n "$result" ] && break + sleep 1 +done + +kill $logcat_pid 2>/dev/null || true + +echo "---" + +if [ -z "$result" ]; then + echo "TIMEOUT: Tests did not complete within ${TIMEOUT}s." + exit 1 +elif [ "$result" = "passed" ]; then + echo "ALL TESTS PASSED" + exit 0 +else + echo "TESTS FAILED" + exit 1 +fi From 98eb91fdbdb9b8d1f373a853d48a17e0c0314e05 Mon Sep 17 00:00:00 2001 From: twillian Date: Mon, 30 Mar 2026 15:27:49 +0400 Subject: [PATCH 098/103] upd : trigger android test on tag too --- .github/workflows/test_android.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 343b6408d..5a4d3f8b2 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -4,12 +4,16 @@ on: workflow_dispatch: issue_comment: types: [created] + push: + tags: + - 'v*' jobs: test_android: if: | github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || + (github.event_name == 'push') || (github.event.issue.pull_request && contains(github.event.comment.body, '/test android')) timeout-minutes: 100 runs-on: ubuntu-22.04 From 3fe440c57714276104cdfe566d25740b489ed055 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 31 Mar 2026 12:36:22 +0400 Subject: [PATCH 099/103] upd : keep the lib in prefab --- android/nakama-sdk/build.gradle.kts | 2 +- integrationtests/android/test_android.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/nakama-sdk/build.gradle.kts b/android/nakama-sdk/build.gradle.kts index b7a3f862b..e5ecf2bb0 100644 --- a/android/nakama-sdk/build.gradle.kts +++ b/android/nakama-sdk/build.gradle.kts @@ -94,7 +94,7 @@ android { // This is a prefab-only AAR, remove all jniLibs , which are just stripped version // of what we already include in prefab packaging { - // jniLibs.excludes += ("**/*.so") + jniLibs.excludes += ("**/*.so") } buildToolsVersion = "36.0.0" diff --git a/integrationtests/android/test_android.sh b/integrationtests/android/test_android.sh index 8e4ddd01b..816489a30 100644 --- a/integrationtests/android/test_android.sh +++ b/integrationtests/android/test_android.sh @@ -33,7 +33,7 @@ if [ ! -f "$AAR_PATH" ]; then echo "Error: AAR not found at $AAR_PATH. Please run './gradlew :nakama-sdk:assembleRelease' first, or run through CI." exit 1 fi -unzip -jo "$AAR_PATH" "jni/$ABI/libnakama-sdk.so" -d "$jni_dir/" +unzip -jo "$AAR_PATH" "prefab/modules/nakama-sdk/libs/android.$ABI/libnakama-sdk.so" -d "$jni_dir/" case "$ABI" in arm64-v8a) triple="aarch64-linux-android";; From 46cba0b9298feb878350a060b6745e84912ef881 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 31 Mar 2026 12:46:14 +0400 Subject: [PATCH 100/103] trigger androi dtest --- .github/workflows/test_android.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 5a4d3f8b2..54f4a7391 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -2,6 +2,7 @@ name: Test Android on: workflow_call: workflow_dispatch: + pull_request: issue_comment: types: [created] push: @@ -13,6 +14,7 @@ jobs: if: | github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || + github.event_name == 'pull_request' || (github.event_name == 'push') || (github.event.issue.pull_request && contains(github.event.comment.body, '/test android')) timeout-minutes: 100 From 691d2b4693ffce228cabe6daec7914b1089b7c2a Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 31 Mar 2026 14:36:09 +0400 Subject: [PATCH 101/103] upd : trigger on comment --- .github/workflows/test_android.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 54f4a7391..5a4d3f8b2 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -2,7 +2,6 @@ name: Test Android on: workflow_call: workflow_dispatch: - pull_request: issue_comment: types: [created] push: @@ -14,7 +13,6 @@ jobs: if: | github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || - github.event_name == 'pull_request' || (github.event_name == 'push') || (github.event.issue.pull_request && contains(github.event.comment.body, '/test android')) timeout-minutes: 100 From 17046d9017e68ae2a441ff92d3ad5437befc58e6 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 31 Mar 2026 14:42:22 +0400 Subject: [PATCH 102/103] dbg : trigger on pr --- .github/workflows/test_android.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 5a4d3f8b2..54f4a7391 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -2,6 +2,7 @@ name: Test Android on: workflow_call: workflow_dispatch: + pull_request: issue_comment: types: [created] push: @@ -13,6 +14,7 @@ jobs: if: | github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || + github.event_name == 'pull_request' || (github.event_name == 'push') || (github.event.issue.pull_request && contains(github.event.comment.body, '/test android')) timeout-minutes: 100 From e7103835341643a4656f4a124fb8b74bb8dde359 Mon Sep 17 00:00:00 2001 From: twillian Date: Tue, 31 Mar 2026 16:32:35 +0400 Subject: [PATCH 103/103] rm test android on pr --- .github/workflows/test_android.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test_android.yml b/.github/workflows/test_android.yml index 54f4a7391..5a4d3f8b2 100644 --- a/.github/workflows/test_android.yml +++ b/.github/workflows/test_android.yml @@ -2,7 +2,6 @@ name: Test Android on: workflow_call: workflow_dispatch: - pull_request: issue_comment: types: [created] push: @@ -14,7 +13,6 @@ jobs: if: | github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' || - github.event_name == 'pull_request' || (github.event_name == 'push') || (github.event.issue.pull_request && contains(github.event.comment.body, '/test android')) timeout-minutes: 100