Skip to content

Commit 3b14ec3

Browse files
committed
Test SauceLabs
Fix artifact download Shell Fix Fix Fix Fix Set config Fix syntax Sauce skip run Update appium Test test test apk name Test Test Test Test Test Test Test Test Test Test Test tets Test Test
1 parent 281af4a commit 3b14ec3

File tree

4 files changed

+149
-44
lines changed

4 files changed

+149
-44
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,13 @@ jobs:
200200
unreal-version: ${{ matrix.unreal }}
201201

202202
integration-test-android:
203-
needs: [test-android]
204203
name: Android UE ${{ matrix.unreal }}
205204
secrets: inherit
206205
strategy:
207206
fail-fast: false
208207
matrix:
209208
# Starting with UE 5.4-5.6 for faster iteration
210-
unreal: ['5.4', '5.5', '5.6']
209+
unreal: ['5.4']
211210
uses: ./.github/workflows/integration-test-android.yml
212211
with:
213212
unreal-version: ${{ matrix.unreal }}

.github/workflows/integration-test-android.yml

Lines changed: 103 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,20 @@ jobs:
1010
name: Integration Test
1111
runs-on: ubuntu-latest
1212

13+
env:
14+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
15+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
16+
GITHUB_TOKEN: ${{ github.token }}
17+
SAUCE_REGION: eu-central-1
18+
1319
steps:
1420
- uses: actions/checkout@v4
15-
with:
16-
submodules: recursive
1721

18-
- name: Download sample build
19-
uses: actions/download-artifact@v4
22+
- name: Download artifact from workflow run
23+
uses: dawidd6/action-download-artifact@v6
2024
with:
21-
name: UE ${{ inputs.unreal-version }} sample build (Android)
25+
run_id: 19533023161
26+
name: "UE ${{ inputs.unreal-version }} sample build (Android)"
2227
path: sample-build
2328

2429
- name: List downloaded files
@@ -27,17 +32,6 @@ jobs:
2732
ls -lah sample-build/
2833
echo "Using x64 APK for emulator testing"
2934
30-
- name: Enable KVM group perms
31-
run: |
32-
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
33-
sudo udevadm control --reload-rules
34-
sudo udevadm trigger --name-match=kvm
35-
36-
- name: Setup Android directories
37-
run: |
38-
mkdir -p $HOME/.android/avd
39-
touch $HOME/.android/repositories.cfg
40-
4135
- name: Install Pester
4236
shell: pwsh
4337
run: Install-Module -Name Pester -Force -SkipPublisherCheck
@@ -49,32 +43,99 @@ jobs:
4943
mkdir build
5044
cmake -B build -S .
5145
52-
- name: Run Android Integration Tests
53-
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b
54-
id: integration-test
55-
timeout-minutes: 45
56-
with:
57-
api-level: 34
58-
target: 'google_apis'
59-
arch: x86_64
60-
force-avd-creation: true
61-
disable-animations: true
62-
disable-spellchecker: true
63-
emulator-options: >
64-
-no-window
65-
-no-snapshot-save
66-
-gpu swiftshader_indirect
67-
-noaudio
68-
-no-boot-anim
69-
-camera-back none
70-
-camera-front none
71-
script: |
72-
adb wait-for-device
73-
cd integration-test && pwsh -Command "Invoke-Pester Integration.Tests.Android.ps1 -CI"
74-
env:
75-
SENTRY_UNREAL_TEST_DSN: ${{ secrets.SENTRY_UNREAL_TEST_DSN }}
76-
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_API_TOKEN }}
77-
SENTRY_UNREAL_TEST_APP_PATH: ${{ github.workspace }}/sample-build/SentryPlayground-x64.apk
46+
- name: Upload APK to SauceLabs Storage
47+
id: upload_apk
48+
run: |
49+
sudo apt-get install -y jq
50+
51+
APK=$(ls sample-build/*.apk | head -n1)
52+
echo "Uploading: $APK"
53+
54+
RESPONSE=$(curl -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
55+
-X POST "https://api.${SAUCE_REGION}.saucelabs.com/v1/storage/upload" \
56+
-F "payload=@${APK}" \
57+
-F "name=$(basename "$APK")")
58+
59+
echo "Upload Response: $RESPONSE"
60+
STORAGE_ID=$(echo "$RESPONSE" | jq -r '.item.id')
61+
62+
echo "storage_id=$STORAGE_ID" >> $GITHUB_OUTPUT
63+
64+
- name: Check available devices
65+
run: |
66+
echo "Querying available Android devices in EU-Central..."
67+
curl -sS -u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
68+
"https://api.eu-central-1.saucelabs.com/v1/rdc/devices?type=real_device&os=Android" \
69+
| jq '.'
70+
71+
- name: Start UE5 test on real device
72+
id: start_job
73+
run: |
74+
REQUEST=$(cat <<EOF
75+
{
76+
"capabilities": {
77+
"alwaysMatch": {
78+
"platformName": "Android",
79+
"appium:app": "storage:${{ steps.upload_apk.outputs.storage_id }}",
80+
"appium:deviceName": "Samsung_Galaxy_S23_FE_free",
81+
"appium:automationName": "UiAutomator2",
82+
"appium:appPackage": "io.sentry.unreal.sample",
83+
"appium:appActivity": "com.epicgames.unreal.GameActivity",
84+
"appium:optionalIntentArguments": "-e cmdline '-message-capture'",
85+
"sauce:options": {
86+
"name": "UE5 Integration Test",
87+
"appiumVersion": "latest"
88+
}
89+
}
90+
}
91+
}
92+
EOF
93+
)
94+
95+
echo "Sending Appium session request..."
96+
echo "$REQUEST"
97+
98+
RESPONSE=$(curl -sS -w "\nHTTP_CODE:%{http_code}" \
99+
-u "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
100+
-X POST "https://ondemand.eu-central-1.saucelabs.com/wd/hub/session" \
101+
-H "Content-Type: application/json" \
102+
-d "$REQUEST")
103+
104+
echo "Session Response: $RESPONSE"
105+
106+
SESSION_ID=$(echo "$RESPONSE" | grep -v "HTTP_CODE" | jq -r '.value.sessionId // .sessionId')
107+
echo "Extracted session_id: $SESSION_ID"
108+
echo "session_id=$SESSION_ID" >> $GITHUB_OUTPUT
109+
110+
- name: Poll job status
111+
run: |
112+
JOB_ID=${{ steps.start_job.outputs.job_id }}
113+
114+
for i in {1..60}; do
115+
STATUS=$(curl -su "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
116+
"https://api.${SAUCE_REGION}.saucelabs.com/v1/rdc/jobs/$JOB_ID" \
117+
| jq -r '.status')
118+
119+
echo "Status: $STATUS"
120+
121+
if [[ "$STATUS" == "complete" ]] || [[ "$STATUS" == "error" ]]; then
122+
break
123+
fi
124+
125+
sleep 10
126+
done
127+
128+
- name: Download logcat output
129+
run: |
130+
mkdir -p integration-test/output
131+
JOB_ID=${{ steps.start_job.outputs.job_id }}
132+
133+
curl -su "$SAUCE_USERNAME:$SAUCE_ACCESS_KEY" \
134+
"https://api.${SAUCE_REGION}.saucelabs.com/v1/rdc/jobs/$JOB_ID/logs/logcat" \
135+
-o integration-test/output/logcat.txt
136+
137+
echo "Last 50 log lines:"
138+
tail -50 integration-test/output/logcat.txt
78139
79140
- name: Upload integration test output
80141
if: ${{ always() && steps.integration-test.outcome == 'failure' }}

.sauce/sentry-android-e2e-test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: v1alpha
2+
kind: appium
3+
4+
sauce:
5+
region: eu-central-1
6+
concurrency: 1
7+
8+
apps:
9+
- id: ue5-app
10+
path: ./sample-build/SentryPlayground-arm64.apk
11+
12+
suites:
13+
- name: "UE5 Launch & Logcat Capture"
14+
app: ue5-app
15+
platformName: android
16+
17+
testMatch:
18+
- "integration-test/launch.js"
19+
20+
device:
21+
name: "Google Pixel 6"
22+
platformVersion: "12"
23+
options:
24+
deviceType: real
25+
26+
appium:
27+
capabilities:
28+
# Standard W3C capabilities
29+
"appium:deviceName": "Google Pixel 6"
30+
"appium:platformVersion": "12"
31+
"platformName": "Android"
32+
"appium:app": "storage:filename=SentryPlayground-arm64.apk"
33+
"appium:appPackage": "io.sentry.unreal.sample"
34+
"appium:appActivity": "com.epicgames.unreal.GameActivity"
35+
# Your extra intent data
36+
"appium:appWaitActivity": "*"
37+
"appium:automationName": "UiAutomator2"
38+
"appium:arguments": "-e cmdline '-message-capture'"
39+
# Optionally set the Appium version:
40+
"sauce:options":
41+
appiumVersion: "latest"

integration-test/launch.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = async function () {
2+
// Do nothing — just let the app run on the device
3+
await driver.pause(30000);
4+
};

0 commit comments

Comments
 (0)