Skip to content

Commit

Permalink
CI(mac_android): try to fix macOS Android CI
Browse files Browse the repository at this point in the history
test(): tune timeouts
  • Loading branch information
chicoxyzzy committed Dec 14, 2023
1 parent d1b427c commit 7f9da39
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ jobs:
run: |
brew install automake
- name: Android FTE
run: |
./bin/android-functions.sh --android-fte --yes-deps
env:
VERBOSE: 1
DEBUG: 1
CI: true
SSC_ANDROID_CI: true
# Clear variables because CI supplied installs are out of date
ANDROID_HOME:
JAVA_HOME:
ANDROID_SUPPORTED_ABIS: x86_64
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PAT }}

- name: Build Socket Runtime
run: |
VERBOSE=1 ./bin/install.sh
Expand Down Expand Up @@ -103,7 +117,7 @@ jobs:
ios_macos_tests:
name: iOS (on macOS) tests
runs-on: macOS-13
timeout-minutes: 20
timeout-minutes: 40
needs: mac_build

steps:
Expand Down Expand Up @@ -136,7 +150,7 @@ jobs:
android_mac_tests:
name: Android (on macOS) tests
runs-on: macos-13
timeout-minutes: 60
timeout-minutes: 30
needs: mac_build

steps:
Expand Down Expand Up @@ -221,6 +235,20 @@ jobs:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install -y gcc-12 g++-12 libpthread-stubs0-dev libwebkit2gtk-4.1-dev at-spi2-core
- name: Android FTE
run: |
./bin/android-functions.sh --android-fte --yes-deps
env:
VERBOSE: 1
DEBUG: 1
CI: true
SSC_ANDROID_CI: true
# Clear variables because CI supplied installs are out of date
ANDROID_HOME:
JAVA_HOME:
ANDROID_SUPPORTED_ABIS: x86_64
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PAT }}

- name: Build Socket Runtime
run: |
yes | sdkmanager --licenses > /dev/null
Expand Down Expand Up @@ -282,7 +310,7 @@ jobs:
android_linux_tests:
name: Android (on Linux) tests
runs-on: ubuntu-latest-m
timeout-minutes: 60
timeout-minutes: 30
needs: linux_build

steps:
Expand Down
10 changes: 5 additions & 5 deletions test/scripts/poll-adb-logcat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function watchdog_file_update() {
fi
}

function watchdog_file_exists() {
function watchdog_file_exists() {
if [ -f "$poll_adb_watchdog_file" ]; then
data="$(cat "$poll_adb_watchdog_file")"
if [ -z "$data" ]; then
Expand Down Expand Up @@ -79,7 +79,7 @@ echo "App start timeout: $timeout"
echo ""
while [ -z "$pid" ] && (( count < timeout )); do
count_output="$count_output$count..." # Ouput doesn't flush in CI with echo -n, rebuild line

[[ -n "$CI" ]] && echo "$count..."
[[ -z "$CI" ]] && echo -e "\e[1A\e[K$count_output" # Replace previous line, doesn't work in CI
pid="$($adb shell ps | grep "$id" | awk '{print $2}' 2>/dev/null)"
Expand Down Expand Up @@ -139,17 +139,17 @@ done < <($adb logcat --pid="$pid") & logcat_pid=$!
# Handle situation where logcat loop doesn't catch exit, because eg an unexpected error condition occured that isn't handled by the text processing above
# This section dumps the entire process log after it has gone away, note that we don't want the entire log on failed tests that were successfully reported
count=0
timeout=300
timeout=600
[[ -z "$CI" ]] && timeout=30
[[ -z "$CI" ]] && echo "Waiting 30s before aborting tests..."
[[ -n "$CI" ]] && echo "Waiting 5m before aborting tests..."
[[ -n "$CI" ]] && echo "Waiting 10m before aborting tests..."

# while [[ "$(watchdog_file_exists)" == "0" ]]; do
while (( count < timeout )) ; do
if [[ "$(watchdog_file_exists)" != "0" ]]; then
break
fi

(( count > 0 )) && (( count % 30 == 0 )) && echo "Timeout count: $count/$timeout"
sleep 1
(( count++ ))
Expand Down
2 changes: 1 addition & 1 deletion test/src/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ if (!['android', 'ios', 'win32'].includes(process.platform)) {
const doesRestart = await Promise.race([
new Promise(resolve => window.addEventListener('backend:ready', () => resolve(true), { once: true })),
// needs more time to restart
new Promise(resolve => setTimeout(() => resolve(false), 1024))
new Promise(resolve => setTimeout(() => resolve(false), 2048))
])
t.ok(doesRestart, 'emits a backend:ready event')
})
Expand Down

0 comments on commit 7f9da39

Please sign in to comment.