Skip to content

Commit 6c3329f

Browse files
Fix CI: Update pipelines for correct simulator builds
- Updated `.github/workflows/maven.yml`: - Replaced manual Android emulator script with `reactivecircus/android-emulator-runner@v2`. - Added explicit `xcodebuild` step for iOS to compile the generated Maven source into a `.app` bundle. - Configured Android tests to use API 31 and KVM permissions. - Set timeouts for all jobs. - Updated `scripts/ci/run-ios-simulator.sh`: - Added existence check for `APP_BUNDLE`. - Improved runtime detection and logging. - Deleted `scripts/ci/start-android-emulator.sh` as it is replaced by the GitHub Action.
1 parent c7be3f8 commit 6c3329f

File tree

2 files changed

+42
-179
lines changed

2 files changed

+42
-179
lines changed

.github/workflows/maven.yml

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,14 @@ jobs:
2626

2727
android:
2828
runs-on: ubuntu-22.04
29-
timeout-minutes: 20
29+
timeout-minutes: 30
3030
steps:
3131
- uses: actions/checkout@v4
3232
- name: Install Java 17
3333
uses: actions/setup-java@v4
3434
with:
3535
distribution: temurin
3636
java-version: '17'
37-
- name: Install Android SDK
38-
uses: android-actions/setup-android@v3
39-
with:
40-
packages: platform-tools emulator system-images;android-33;google_apis;x86_64
4137
- name: Set JAVA17_HOME
4238
run: echo "JAVA17_HOME=$JAVA_HOME" >> $GITHUB_ENV
4339
- name: Install Java 11
@@ -51,31 +47,34 @@ jobs:
5147
wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar
5248
- name: Install Libraries (JDK 11)
5349
run: mvn install -DskipTests
54-
- name: Enable KVM
50+
- name: Enable KVM for Android emulator
5551
run: |
56-
sudo apt-get update
57-
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
58-
sudo usermod -aG kvm $USER
59-
sudo udevadm control --reload-rules && sudo udevadm trigger
52+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
53+
sudo udevadm control --reload-rules
54+
sudo udevadm trigger --name-match=kvm
6055
- name: Build BTDemo (JDK 17)
6156
env:
6257
APP_DIR: BTDemo
6358
JAVA_HOME: ${{ env.JAVA17_HOME }}
6459
run: |
6560
./scripts/ci/build-thirdparty-app.sh android
66-
- name: Boot emulator and run smoke test
67-
env:
68-
ANDROID_SDK_ROOT: ${{ env.ANDROID_SDK_ROOT }}
69-
JAVA_HOME: ${{ env.JAVA17_HOME }}
70-
run: |
71-
./scripts/ci/start-android-emulator.sh
72-
adb install -r BTDemo/target/*-android-device.apk
73-
adb shell am start -n com.codename1.btle/.BTDemoStub
74-
adb logcat -d | tail -n 200
61+
- name: Run Android Emulator
62+
uses: reactivecircus/android-emulator-runner@v2
63+
with:
64+
api-level: 31
65+
arch: x86_64
66+
target: google_apis
67+
force-avd-creation: false
68+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
69+
disable-animations: true
70+
script: |
71+
adb install -r BTDemo/target/*-android-device.apk
72+
adb shell am start -n com.codename1.btle/.BTDemoStub
73+
adb logcat -d | tail -n 200
7574
7675
ios:
7776
runs-on: macos-15
78-
timeout-minutes: 20
77+
timeout-minutes: 30
7978
steps:
8079
- uses: actions/checkout@v4
8180
- name: Install Java 11
@@ -89,17 +88,35 @@ jobs:
8988
wget https://github.com/codenameone/CodenameOne/raw/refs/heads/master/maven/CodeNameOneBuildClient.jar -O ~/.codenameone/CodeNameOneBuildClient.jar
9089
- name: Install Libraries (JDK 11)
9190
run: mvn install -DskipTests
92-
- name: Build BTDemo Simulator Bundle
91+
- name: Build BTDemo Source (Maven)
9392
env:
9493
APP_DIR: BTDemo
95-
BUILD_TARGET: ios-sim
94+
BUILD_TARGET: ios-source
9695
run: |
9796
./scripts/ci/build-thirdparty-app.sh ios
98-
- name: Debug Output Artifacts
99-
run: ls -R BTDemo/target || true
97+
- name: Compile iOS App (Xcode)
98+
run: |
99+
# Find the generated Xcode project
100+
XCODE_PROJ=$(find BTDemo/target -name "*.xcodeproj" -type d | head -n 1)
101+
if [[ -z "$XCODE_PROJ" ]]; then
102+
echo "Error: Xcode project not found in BTDemo/target"
103+
ls -R BTDemo/target
104+
exit 1
105+
fi
106+
echo "Found Xcode project: $XCODE_PROJ"
107+
108+
# Build the app for the simulator
109+
xcodebuild -project "$XCODE_PROJ" \
110+
-scheme "BTDemo" \
111+
-configuration Debug \
112+
-sdk iphonesimulator \
113+
-destination "platform=iOS Simulator,name=iPhone 15" \
114+
CONFIGURATION_BUILD_DIR=build/ios-sim \
115+
clean build
116+
100117
- name: Boot simulator, install, and launch
101118
env:
102-
APP_BUNDLE: BTDemo/target/ios-sim/BTDemo.app
119+
APP_BUNDLE: build/ios-sim/BTDemo.app
103120
BUNDLE_ID: com.codename1.btle
104121
run: |
105122
./scripts/ci/run-ios-simulator.sh

scripts/ci/start-android-emulator.sh

Lines changed: 0 additions & 154 deletions
This file was deleted.

0 commit comments

Comments
 (0)