Skip to content

Commit 329c33b

Browse files
committed
Build apk for everything, Read unity version from project settings
1 parent 3baa22c commit 329c33b

File tree

3 files changed

+17
-75
lines changed

3 files changed

+17
-75
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ on:
77
pull_request:
88
workflow_dispatch: # e.g. to manually trigger on foreign PRs
99

10-
env:
11-
UNITY_VERSION: '6000.1.12f1'
12-
1310
jobs:
1411
cancel-previous-workflow:
1512
runs-on: ubuntu-latest
@@ -30,8 +27,6 @@ jobs:
3027
os: windows-latest
3128
- targetPlatform: Android
3229
os: ubuntu-latest
33-
# - targetPlatform: StandaloneLinux64
34-
# os: ubuntu-latest
3530

3631
steps:
3732
- name: Free disk space
@@ -50,6 +45,11 @@ jobs:
5045
fetch-depth: 0
5146
lfs: true
5247

48+
- name: Set Unity Version
49+
run: |
50+
UNITY_VERSION=$(grep 'm_EditorVersion:' ProjectSettings/ProjectVersion.txt | awk '{print $2}')
51+
echo "UNITY_VERSION=$UNITY_VERSION" >> $GITHUB_ENV
52+
5353
- name: Cache Unity Library
5454
uses: actions/cache@v4
5555
with:
@@ -86,7 +86,7 @@ jobs:
8686
with:
8787
name: Build-${{ matrix.targetPlatform }}
8888
path: build
89-
retention-days: 14
89+
retention-days: 90
9090

9191
run-demo:
9292
name: Run Demo

.github/workflows/run-demo.yml

Lines changed: 10 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
- completed
1010

1111
jobs:
12-
test-windows:
13-
name: Test Windows Build
12+
run-windows:
13+
name: Run Windows Build
1414
runs-on: windows-latest
1515

1616
steps:
@@ -54,68 +54,6 @@ jobs:
5454
Write-Error "No SentaurSurvivors executable found in build artifacts"
5555
exit 1
5656
}
57-
58-
test-android:
59-
name: Test Android Build
60-
runs-on: ubuntu-latest
61-
62-
steps:
63-
- name: Download Android Build
64-
uses: actions/download-artifact@v4
65-
with:
66-
name: Build-Android
67-
path: ./build
68-
github-token: ${{ secrets.GITHUB_TOKEN }}
69-
run-id: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}
70-
71-
- name: Set up JDK 17
72-
uses: actions/setup-java@v4
73-
with:
74-
java-version: '17'
75-
distribution: 'temurin'
76-
77-
- name: Enable KVM group perms
78-
run: |
79-
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
80-
sudo udevadm control --reload-rules
81-
sudo udevadm trigger --name-match=kvm
82-
83-
- name: Set up Android SDK
84-
uses: android-actions/setup-android@v3
85-
86-
- name: AVD cache
87-
uses: actions/cache@v4
88-
id: avd-cache
89-
with:
90-
path: |
91-
~/.android/avd/*
92-
~/.android/adb*
93-
key: avd-29
94-
95-
- name: Create AVD and generate snapshot for caching
96-
if: steps.avd-cache.outputs.cache-hit != 'true'
97-
uses: reactivecircus/android-emulator-runner@v2
98-
with:
99-
api-level: 29
100-
target: google_apis
101-
arch: x86_64
102-
profile: Nexus 6
103-
force-avd-creation: false
104-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
105-
disable-animations: false
106-
script: echo "Generated AVD snapshot for caching."
107-
108-
- name: Find APK file
109-
id: find-apk
110-
run: |
111-
APK_FILE=$(find ./build -name "*.apk" -type f | head -1)
112-
if [ -z "$APK_FILE" ]; then
113-
echo "Error: No APK file found in build artifacts"
114-
exit 1
115-
fi
116-
echo "Found APK: $APK_FILE"
117-
echo "apk_path=$APK_FILE" >> $GITHUB_OUTPUT
118-
11957
- name: Run Android Emulator
12058
uses: reactivecircus/android-emulator-runner@v2
12159
env:
@@ -132,12 +70,16 @@ jobs:
13270
adb install "${{ steps.find-apk.outputs.apk_path }}"
13371
13472
echo "Starting app..."
135-
# Get package name from APK
136-
PACKAGE_NAME=$(aapt dump badging "${{ steps.find-apk.outputs.apk_path }}" | grep package | awk '{print $2}' | sed "s/name='//" | sed "s/'.*//")
73+
# Get package name from installed packages (more reliable after install)
74+
PACKAGE_NAME=$(adb shell pm list packages | grep sentaur | head -1 | cut -d: -f2)
75+
if [ -z "$PACKAGE_NAME" ]; then
76+
# Fallback: try to find Unity package pattern
77+
PACKAGE_NAME=$(adb shell pm list packages | grep -i "unity\|sentry\|survivors" | head -1 | cut -d: -f2)
78+
fi
13779
echo "Package name: $PACKAGE_NAME"
13880
139-
# Get main activity
140-
MAIN_ACTIVITY=$(aapt dump badging "${{ steps.find-apk.outputs.apk_path }}" | grep "launchable-activity" | awk '{print $2}' | sed "s/name='//" | sed "s/'.*//")
81+
# For Unity apps, the main activity is typically the UnityPlayerActivity
82+
MAIN_ACTIVITY="com.unity3d.player.UnityPlayerActivity"
14183
echo "Main activity: $MAIN_ACTIVITY"
14284
14385
# Pass DSN as Intent extra for Android runtime configuration

ProjectSettings/ProjectSettings.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ PlayerSettings:
266266
useCustomGradlePropertiesTemplate: 0
267267
useCustomGradleSettingsTemplate: 0
268268
useCustomProguardFile: 0
269-
AndroidTargetArchitectures: 8
269+
AndroidTargetArchitectures: 11
270270
AndroidSplashScreenScale: 0
271271
androidSplashScreen: {fileID: 0}
272272
AndroidKeystoreName:

0 commit comments

Comments
 (0)