@@ -95,18 +95,58 @@ jobs:
9595 - name : Download APK & extract it
9696 run : |
9797 pwd
98+
99+ # Check if devnet is accessible before choosing APK
100+ echo "Checking devnet accessibility for APK selection..."
101+ DEVNET_ACCESSIBLE=false
102+
103+ # Retry logic matching your TypeScript function
104+ for attempt in 1 2 3; do
105+ echo "Devnet check attempt $attempt/3..."
106+ if curl -s --connect-timeout 5 --max-time 10 http://sesh-net.local:1280 >/dev/null 2>&1; then
107+ echo "Devnet is accessible on attempt $attempt"
108+ DEVNET_ACCESSIBLE=true
109+ break
110+ else
111+ echo "Attempt $attempt failed"
112+ if [ $attempt -lt 3 ]; then
113+ echo "Waiting ${attempt}s before retry..."
114+ sleep $attempt
115+ fi
116+ fi
117+ done
118+
119+ if [ "$DEVNET_ACCESSIBLE" = "false" ]; then
120+ echo "Devnet is not accessible after 3 attempts"
121+ fi
122+
123+ # Download and extract APK
98124 wget -q -O session-android.apk.tar.xz ${{ github.event.inputs.APK_URL }}
99125 tar xf session-android.apk.tar.xz
100126 mv session-android-*universal extracted
101127
102- if ls extracted/*automaticQa.apk; then
103- mv extracted/*automaticQa.apk extracted/session-android.apk
104- echo "IS_AUTOMATIC_QA=true" >> $GITHUB_ENV
105- elif ls extracted/*qa.apk; then
128+ # Choose APK based on devnet accessibility
129+ if ls extracted/*automaticQa.apk 1>/dev/null 2>&1; then
130+ if [ "$DEVNET_ACCESSIBLE" = "true" ]; then
131+ echo "Using AQA build (devnet accessible)"
132+ mv extracted/*automaticQa.apk extracted/session-android.apk
133+ echo "IS_AUTOMATIC_QA=true" >> $GITHUB_ENV
134+ else
135+ echo "AQA build available but devnet not accessible - falling back to regular QA build"
136+ if ls extracted/*qa.apk 1>/dev/null 2>&1; then
137+ mv extracted/*qa.apk extracted/session-android.apk
138+ echo "IS_AUTOMATIC_QA=false" >> $GITHUB_ENV
139+ else
140+ echo "No regular QA build found as fallback"
141+ exit 1
142+ fi
143+ fi
144+ elif ls extracted/*qa.apk 1>/dev/null 2>&1; then
145+ echo "Using regular QA build"
106146 mv extracted/*qa.apk extracted/session-android.apk
107147 echo "IS_AUTOMATIC_QA=false" >> $GITHUB_ENV
108148 else
109- echo "Error: No .qa APK found (only .qa builds are supported) "
149+ echo "No suitable APK found"
110150 exit 1
111151 fi
112152
0 commit comments