Skip to content

Commit 614ab37

Browse files
authored
Merge pull request #14 from PimySoft/fix-browserstack-workflow-issues
Fix browserstack workflow issues
2 parents d3f49f0 + 9a6deba commit 614ab37

2 files changed

Lines changed: 8 additions & 118 deletions

File tree

.github/workflows/ci-browserstack.yml

Lines changed: 5 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ on:
77
branches: [ main, develop ]
88
workflow_dispatch:
99

10-
env:
11-
NODE_VERSION: '20'
12-
JAVA_VERSION: '17'
13-
1410
jobs:
1511
test:
16-
name: Build & Test on BrowserStack
17-
runs-on: ubuntu-22.04
18-
timeout-minutes: 60
12+
name: Run E2E Tests on BrowserStack
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
1915

2016
steps:
2117
- name: 📥 Checkout code
@@ -24,116 +20,12 @@ jobs:
2420
- name: 📦 Setup Node.js
2521
uses: actions/setup-node@v4
2622
with:
27-
node-version: ${{ env.NODE_VERSION }}
23+
node-version: '20'
2824
cache: 'npm'
2925

30-
- name: ☕ Setup Java
31-
uses: actions/setup-java@v4
32-
with:
33-
distribution: 'temurin'
34-
java-version: ${{ env.JAVA_VERSION }}
35-
36-
- name: 📱 Setup Android SDK
37-
run: |
38-
export ANDROID_HOME=$HOME/android-sdk
39-
export ANDROID_SDK_ROOT=$HOME/android-sdk
40-
41-
mkdir -p $ANDROID_HOME
42-
cd $ANDROID_HOME
43-
44-
# Download and install command line tools
45-
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
46-
unzip -q commandlinetools-linux-11076708_latest.zip
47-
mkdir -p cmdline-tools/latest
48-
mv cmdline-tools/* latest/ 2>/dev/null || true
49-
mv latest cmdline-tools/ 2>/dev/null || true
50-
51-
# Set PATH for sdkmanager
52-
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
53-
54-
# Verify sdkmanager is accessible
55-
if ! command -v sdkmanager &> /dev/null; then
56-
echo "sdkmanager not found, trying direct path..."
57-
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --version || {
58-
echo "ERROR: sdkmanager still not found"
59-
ls -la $ANDROID_HOME/cmdline-tools/latest/bin/ || echo "Directory doesn't exist"
60-
exit 1
61-
}
62-
fi
63-
64-
# Accept licenses
65-
yes | sdkmanager --licenses > /dev/null 2>&1 || true
66-
67-
# Install required packages
68-
sdkmanager "platform-tools" "platforms;android-36" "build-tools;36.0.0" "ndk;27.1.12297006"
69-
70-
echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV
71-
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
72-
echo "$ANDROID_HOME/platform-tools" >> $GITHUB_PATH
73-
echo "$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_PATH
74-
7526
- name: 📥 Install dependencies
7627
run: npm ci
7728

78-
- name: 💾 Cache Gradle dependencies
79-
uses: actions/cache@v4
80-
with:
81-
path: |
82-
~/.gradle/caches
83-
~/.gradle/wrapper
84-
android/.gradle
85-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
86-
restore-keys: |
87-
${{ runner.os }}-gradle-
88-
89-
- name: 🔨 Build Android APK
90-
timeout-minutes: 40
91-
run: |
92-
cd android
93-
chmod +x gradlew
94-
95-
echo "=== Build Configuration ==="
96-
echo "ANDROID_HOME: $ANDROID_HOME"
97-
echo "ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT"
98-
echo "Building for x86_64 architecture only"
99-
100-
echo "=== Pre-build: Check NDK ==="
101-
if [ -d "$ANDROID_HOME/ndk/27.1.12297006" ]; then
102-
echo "NDK already installed"
103-
else
104-
echo "NDK will be installed during build (this may take 10-15 minutes)"
105-
fi
106-
107-
echo "=== Starting Gradle build ==="
108-
echo "This may take 30-40 minutes on first build due to NDK installation"
109-
echo "Progress will be shown below..."
110-
111-
# Run with info logging to see progress
112-
./gradlew assembleDebug \
113-
--no-daemon \
114-
--info \
115-
-PreactNativeArchitectures=x86_64 \
116-
--console=plain 2>&1 | tee build.log || {
117-
echo "=== Build failed ==="
118-
echo "Last 50 lines of build log:"
119-
tail -50 build.log
120-
exit 1
121-
}
122-
123-
echo "=== Build completed ==="
124-
if [ ! -f "app/build/outputs/apk/debug/app-debug.apk" ]; then
125-
echo "ERROR: APK not found after build!"
126-
ls -la app/build/outputs/apk/debug/ || echo "Output directory doesn't exist"
127-
exit 1
128-
fi
129-
echo "APK found:"
130-
ls -lh app/build/outputs/apk/debug/
131-
cd ..
132-
env:
133-
ANDROID_HOME: ${{ env.ANDROID_HOME }}
134-
ANDROID_SDK_ROOT: ${{ env.ANDROID_SDK_ROOT }}
135-
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.console=plain"
136-
13729
- name: 🧪 Run E2E Tests on BrowserStack
13830
run: npm run test:e2e:browserstack:all
13931
env:
@@ -143,8 +35,7 @@ jobs:
14335

14436
- name: 📊 Generate Allure Report
14537
if: always()
146-
run: |
147-
npx allure-commandline generate allure-results --clean -o allure-report || echo "Allure report generation skipped (no results)"
38+
run: npx allure-commandline generate allure-results --clean -o allure-report || echo "No results"
14839

14940
- name: 📤 Upload Test Results
15041
if: always()
@@ -157,4 +48,3 @@ jobs:
15748
screenshots/
15849
retention-days: 7
15950
if-no-files-found: ignore
160-

wdio.browserstack.conf.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ const deviceConfig = {
2626

2727
export const config: Options.Testrunner = {
2828
runner: 'local',
29-
port: 4723,
29+
hostname: 'hub.browserstack.com',
30+
port: 443,
3031
path: '/wd/hub',
32+
protocol: 'https',
3133

3234
specs: [
3335
'./e2e/specs/**/*.ts'
@@ -72,8 +74,6 @@ export const config: Options.Testrunner = {
7274

7375
bail: 0,
7476

75-
baseUrl: 'https://hub.browserstack.com/wd/hub',
76-
7777
waitforTimeout: 10000,
7878

7979
connectionRetryTimeout: 120000,

0 commit comments

Comments
 (0)