Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup android ci #3287

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4027466
setup android ci
externl Dec 18, 2024
c04dc76
env fixes
externl Dec 18, 2024
9f2e4b4
fix
externl Dec 18, 2024
29d4d78
fix
externl Dec 18, 2024
178a18b
fix
externl Dec 18, 2024
36c56f4
fix
externl Dec 18, 2024
fb9d172
fix
externl Dec 18, 2024
4fb91a9
use ANDROID_HOME
externl Dec 18, 2024
095fcca
fixes
externl Dec 18, 2024
332995b
fixes
externl Dec 18, 2024
ca67f39
fixes
externl Dec 18, 2024
099bc34
fixes
externl Dec 18, 2024
a134a21
fixes
externl Dec 18, 2024
49c43ed
fixes
externl Dec 18, 2024
499e541
fixes
externl Dec 18, 2024
cafb18c
fixes
externl Dec 18, 2024
9286642
fixes
externl Dec 18, 2024
97f6a9f
fixes
externl Dec 18, 2024
f6877ee
test
externl Dec 18, 2024
4abe685
test
externl Dec 18, 2024
dd24032
test
externl Dec 18, 2024
cae4d93
fixes
externl Dec 18, 2024
f5eb319
disable android controller ssl
externl Dec 19, 2024
521b875
Merge remote-tracking branch 'origin/main' into android-ci
externl Dec 19, 2024
5c897d7
Add more to path
externl Dec 19, 2024
6fbcefd
Print output
externl Dec 20, 2024
793b2e5
debug
externl Dec 20, 2024
bc78e93
debug
externl Dec 20, 2024
ffb07aa
debug
externl Dec 20, 2024
09c4413
debug
externl Dec 20, 2024
4d747a1
debug
externl Dec 20, 2024
247f400
debug
externl Dec 20, 2024
1b2e339
debug
externl Dec 20, 2024
02e4c28
fixes
externl Dec 20, 2024
21bd8b8
fixes
externl Dec 20, 2024
b080e73
debug
externl Dec 20, 2024
b537af7
debug
externl Dec 20, 2024
e51cde4
cleanup
externl Dec 20, 2024
01e7a3e
fix
externl Dec 20, 2024
fbbf239
fix
externl Dec 20, 2024
7f0464c
enable accel
externl Dec 20, 2024
6fce190
Merge branch 'main' into android-ci
externl Dec 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ inputs:
- true
- false

build_android_controller:
description: "Build Android Controller"
type: choice
default: "false"
options:
- true
- false

runs:
using: "composite"
steps:
Expand All @@ -40,6 +48,15 @@ runs:
shell: bash
if: runner.os == 'macOS' || runner.os == 'Linux'

# Android
- name: Build Android
working-directory: ${{ inputs.working_directory }}
run: |
cd test/android/controller
./gradlew build
shell: bash
if: inputs.build_android_controller == 'true'

# Windows
- name: Build C++ and Python
run: |
Expand Down
45 changes: 45 additions & 0 deletions .github/actions/setup-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,51 @@ runs:
uses: ./.github/actions/setup-matlab
if: inputs.use_matlab == 'true'

#
# Android
# See https://developer.android.com/studio#command-tools for the latest version
#

# See https://github.com/marketplace/actions/android-emulator-runner
- name: Enable KVM group perms
shell: bash
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
if: matrix.config == 'android'

- name: Install Android SDK
shell: bash
run: |
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O /tmp/android-sdk.zip
mkdir -p /opt/android-sdk/cmdline-tools
unzip -q /tmp/android-sdk.zip -d /opt/android-sdk/cmdline-tools
rm /tmp/android-sdk.zip
mv /opt/android-sdk/cmdline-tools/cmdline-tools /opt/android-sdk/cmdline-tools/latest
export ANDROID_HOME=/opt/android-sdk/
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH
echo "$ANDROID_HOME/emulator" >> $GITHUB_PATH
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH

# For some reason avdmanager is placing the avd into $HOME/.config/.android/avd instead of $HOME/.android/avd
echo "ANDROID_AVD_HOME=$HOME/.config/.android" >> $GITHUB_ENV
if: matrix.config == 'android'

- name: Configure Android SDK
shell: bash
run: |
bash -c 'yes 2>/dev/null | sdkmanager --licenses'
sdkmanager "platform-tools" "build-tools;33.0.2" "platforms;android-33"
# sdkmanager "extras;intel;Hardware_Accelerated_Execution_Manager"
sdkmanager "system-images;android-33;google_apis;x86_64"
sdkmanager emulator
sdkmanager --update

if: matrix.config == 'android'

#
# Cache
#
Expand Down
130 changes: 63 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,53 @@ jobs:
fail-fast: false
matrix:
include:
# Release builds
- os: macos-15
config: "release"
- os: ubuntu-24.04
config: "release"
- os: windows-2022
config: "release"
build_flags: "/p:Platform=x64"
test_flags: "--platform=x64"
- os: windows-2022
config: "cpp-win32-release"
working_directory: "cpp"
build_flags: "/p:Platform=Win32"
msbuild_project: "msbuild/ice.proj"
test_flags: "--platform=Win32"

# Debug builds
- os: macos-15
config: "debug"
build_flags: "OPTIMIZE=no"
test_flags: "--swift-config=debug"
- os: ubuntu-24.04
config: "debug"
build_flags: "OPTIMIZE=no"
# TODO - figure out how to properly install debug Python
- os: windows-2022
config: "debug"
working_directory: "cpp"
build_flags: "/p:Platform=x64 /p:Configuration=Debug"
test_flags: "--platform=x64 --config=Debug"
msbuild_project: "msbuild/ice.proj"

# Swift iOS
- os: macos-15
config: "swift-ios"
working_directory: "swift"
build_flags: "PLATFORMS='macosx iphonesimulator'"
test_flags: "--platform=iphonesimulator --controller-app --rfilter=Ice/operations" # Remove rfilter once #3286 is fixed
build_cpp_and_python: true

# Static builds
- os: ubuntu-24.04
config: "static"
build_flags: "CONFIGS=static"
test_flags: "--config=static --filter=Ice/ --filter=IceDiscovery/"
working_directory: "cpp"

# # Release builds
# - os: macos-15
# config: "release"
# - os: ubuntu-24.04
# config: "release"
# - os: windows-2022
# config: "release"
# build_flags: "/p:Platform=x64"
# test_flags: "--platform=x64"
# - os: windows-2022
# config: "cpp-win32-release"
# working_directory: "cpp"
# build_flags: "/p:Platform=Win32"
# msbuild_project: "msbuild/ice.proj"
# test_flags: "--platform=Win32"

# # Debug builds
# - os: macos-15
# config: "debug"
# build_flags: "OPTIMIZE=no"
# test_flags: "--swift-config=debug"
# - os: ubuntu-24.04
# config: "debug"
# build_flags: "OPTIMIZE=no"
# # TODO - figure out how to properly install debug Python
# - os: windows-2022
# config: "debug"
# working_directory: "cpp"
# build_flags: "/p:Platform=x64 /p:Configuration=Debug"
# test_flags: "--platform=x64 --config=Debug"
# msbuild_project: "msbuild/ice.proj"

# # Swift iOS
# - os: macos-15
# config: "swift-ios"
# working_directory: "swift"
# build_flags: "PLATFORMS='macosx iphonesimulator'"
# test_flags: "--platform=iphonesimulator --controller-app --rfilter=Ice/operations" # Remove rfilter once #3286 is fixed
# build_cpp_and_python: true

# # Static builds
# - os: ubuntu-24.04
# config: "static"
# build_flags: "CONFIGS=static"
# test_flags: "--config=static --filter=Ice/ --filter=IceDiscovery/"
# working_directory: "cpp"
#
# # Xcode SDK builds
# # TODO - Should we also test the debug config here as well?
# - macos-15
Expand All @@ -75,28 +75,23 @@ jobs:
# build_flags: "CONFIGS=xcodesdk PLATFORMS=iphonesimulator"
# test_flags: "--config=xcodesdk --platform=iphonesimulator --controller-app"
# build_cpp_and_python: true

# MATLAB
#
# # Cross tests
# - os: ubuntu-24.04
# config: "cross"
# test_flags: "--all-cross"
# - os: macos-15
# config: "cross"
# # We want to test C++ and Swift only (in each direction)
# test_flags: "--all-cross --filter cpp --filter swift"

# Android
- os: ubuntu-24.04
config: "matlab"
working_directory: "matlab"
build_cpp_and_python: true
- os: windows-2022
config: "matlab"
working_directory: "matlab"
build_flags: "/p:Platform=x64"
msbuild_project: "msbuild/ice.proj"
test_flags: "--platform=x64"
config: "android"
working_directory: "java"
test_flags: "--android --controller-app"
build_cpp_and_python: true

# Cross tests
- os: ubuntu-24.04
config: "cross"
test_flags: "--all-cross"
- os: macos-15
config: "cross"
# We want to test C++ and Swift only (in each direction)
test_flags: "--all-cross --filter cpp --filter swift"
build_android_controller: true

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -123,6 +118,7 @@ jobs:
with:
working_directory: ${{ matrix.working_directory || '.' }}
build_cpp_and_python: ${{ matrix.build_cpp_and_python || false }}
build_android_controller: ${{ matrix.build_android_controller || false }}
build_flags: ${{ matrix.build_flags || '' }}
msbuild_project: ${{ matrix.msbuild_project || 'ice.proj' }}

Expand Down
34 changes: 19 additions & 15 deletions java/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@
This page describes how to build and install Ice for Java from source. If
you prefer, you can also download a [binary distribution].

* [Build Requirements](#build-requirements)
* [Operating Systems](#operating-systems)
* [Slice to Java Compiler](#slice-to-java-compiler)
* [JDK Version](#jdk-version)
* [Gradle](#gradle)
* [Bzip2 Compression](#bzip2-compression)
* [JGoodies](#jgoodies)
* [ProGuard](#proguard)
* [Java Application Bundler](#java-application-bundler)
* [Building Ice for Java](#building-ice-for-java)
* [Installing Ice for Java](#installing-ice-for-java)
* [Running the Java Tests](#running-the-java-tests)
* [Building the Ice for Android Tests](#building-the-ice-for-android-tests)
* [IceGrid GUI Tool](#icegrid-gui-tool)
- [Ice for Java build instructions](#ice-for-java-build-instructions)
- [Build Requirements](#build-requirements)
- [Operating Systems](#operating-systems)
- [Slice to Java Compiler](#slice-to-java-compiler)
- [JDK Version](#jdk-version)
- [Gradle](#gradle)
- [Bzip2 Compression](#bzip2-compression)
- [JGoodies](#jgoodies)
- [ProGuard](#proguard)
- [Java Application Bundler](#java-application-bundler)
- [Building Ice for Java](#building-ice-for-java)
- [Installing Ice for Java](#installing-ice-for-java)
- [Running the Java Tests](#running-the-java-tests)
- [Building the Ice for Android Tests](#building-the-ice-for-android-tests)
- [Android Build Requirements](#android-build-requirements)
- [Building the Android Test Controller](#building-the-android-test-controller)
- [Running the Android Test Suite](#running-the-android-test-suite)
- [IceGrid GUI Tool](#icegrid-gui-tool)

## Build Requirements

Expand Down Expand Up @@ -210,7 +214,7 @@ python allTests.py

If everything worked out, you should see lots of `ok` messages. In case of a
failure, the tests abort with `failed`.

****
## Building the Ice for Android Tests

The `test/android/controller` directory contains an Android Studio project for
Expand Down
2 changes: 1 addition & 1 deletion java/test/android/controller/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) ZeroC, Inc. All rights reserved.

# Version used in JAR files
iceVersion = 3.8.0-alpha0
iceVersion = 3.8.0-alpha.0

# Set iceHome to location of Ice installation if Ice was installed in a
# non-standard location. You must use forward slashes in the path, even on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,22 @@ public ControllerHelperI(TestSuiteBundle bundle, String[] args) {
}

public void communicatorInitialized(Communicator communicator) {
com.zeroc.Ice.Properties properties = communicator.getProperties();
if (properties
.getIceProperty("Ice.Plugin.IceSSL")
.equals("com.zeroc.IceSSL.PluginFactory")) {
com.zeroc.Ice.SSL.Plugin plugin =
(com.zeroc.Ice.SSL.Plugin)
communicator.getPluginManager().getPlugin("IceSSL");
String keystore = communicator.getProperties().getIceProperty("IceSSL.Keystore");
properties.setProperty("IceSSL.Keystore", "");
int resource = keystore.equals("client.bks") ? R.raw.client : R.raw.server;
java.io.InputStream certs = getResources().openRawResource(resource);
plugin.setKeystoreStream(certs);
plugin.setTruststoreStream(certs);
communicator.getPluginManager().initializePlugins();
}
// TODO: fix this to use native Java API
// com.zeroc.Ice.Properties properties = communicator.getProperties();
// if (properties
// .getIceProperty("Ice.Plugin.IceSSL")
// .equals("com.zeroc.IceSSL.PluginFactory")) {
// com.zeroc.Ice.SSL.Plugin plugin =
// (com.zeroc.Ice.SSL.Plugin)
// communicator.getPluginManager().getPlugin("IceSSL");
// String keystore = communicator.getProperties().getIceProperty("IceSSL.Keystore");
// properties.setProperty("IceSSL.Keystore", "");
// int resource = keystore.equals("client.bks") ? R.raw.client : R.raw.server;
// java.io.InputStream certs = getResources().openRawResource(resource);
// plugin.setKeystoreStream(certs);
// plugin.setTruststoreStream(certs);
// communicator.getPluginManager().initializePlugins();
// }
}

public void run() {
Expand Down
3 changes: 2 additions & 1 deletion scripts/Util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2731,6 +2731,7 @@ def startEmulator(self, avd):
#
print("starting the emulator... ")
out = run("emulator -list-avds")
print(out)
if avd not in out:
raise RuntimeError("couldn't find AVD `{}'".format(avd))

Expand All @@ -2749,7 +2750,7 @@ def startEmulator(self, avd):
)

self.device = "emulator-{}".format(port)
cmd = "emulator -avd {0} -port {1} -no-audio -partition-size 768 -no-snapshot -gpu auto -no-boot-anim -no-window".format(
cmd = "emulator -avd {0} -port {1} -no-audio -partition-size 768 -no-snapshot -gpu auto -accel on -no-boot-anim -no-window".format(
avd, port
)
self.emulator = subprocess.Popen(cmd, shell=True)
Expand Down
3 changes: 3 additions & 0 deletions swift/test-report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.1" encoding="UTF-8"?>
<testsuites tests="0" failures="9.5367431640625e-07" time="0.000000000">
</testsuites>
Empty file.
Loading