@@ -10,6 +10,10 @@ concurrency:
1010 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1111 cancel-in-progress : true
1212
13+ env :
14+ APPIUM_TEST_SERVER_PORT : ' 4723'
15+ APPIUM_TEST_SERVER_HOST : ' 127.0.0.1'
16+
1317jobs :
1418 ios_test :
1519 strategy :
2832 IOS_VERSION : ' 18.5'
2933 IPHONE_MODEL : ' iPhone 16 Plus'
3034 PREBUILT_WDA_PATH : ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app
31- APPIUM_TEST_SERVER_PORT : ' 4723'
32- APPIUM_TEST_SERVER_HOST : ' 127.0.0.1'
3335
3436 steps :
3537 - uses : actions/checkout@v4
@@ -54,41 +56,17 @@ jobs:
5456 wait_for_boot : true
5557 shutdown_after_job : false
5658
57- - name : Start Appium server
59+ - name : Install Appium and drivers
5860 run : |
5961 npm install -g appium
6062 appium driver install xcuitest
61- nohup appium server \
62- --port=$APPIUM_TEST_SERVER_PORT \
63- --address=$APPIUM_TEST_SERVER_HOST \
64- --relaxed-security \
65- --log-no-colors \
66- --log-timestamp \
67- --keep-alive-timeout 1200 \
68- 2>&1 > appium.log &
69-
70- TIMEOUT_SEC=25
71- INTERVAL_SEC=1
72-
73- start_time=$(date +%s)
74- while true; do
75- current_time=$(date +%s)
76- elapsed=$((current_time - start_time))
77-
78- if nc -z $APPIUM_TEST_SERVER_HOST $APPIUM_TEST_SERVER_PORT; then
79- echo "Appium server is running after $elapsed seconds"
80- cat appium.log
81- exit 0
82- fi
83-
84- if [[ "$elapsed" -ge "$TIMEOUT_SEC" ]]; then
85- echo "${elapsed} seconds timeout reached: Appium server is NOT running"
86- exit 1
87- fi
8863
89- echo "Waiting $elapsed seconds for Appium server to start..."
90- sleep "$INTERVAL_SEC"
91- done
64+ - name : Start Appium server
65+ uses : ./.github/actions/setup-appium-server
66+ with :
67+ port : ${{ env.APPIUM_TEST_SERVER_PORT }}
68+ host : ${{ env.APPIUM_TEST_SERVER_HOST }}
69+ server_args : ' --relaxed-security'
9270
9371 - name : Downloading prebuilt WDA
9472 run : |
9977 with :
10078 python-version : 3.12
10179
80+ - name : Cache uv modules
81+ uses : actions/cache@v4
82+ with :
83+ path : |
84+ ~/.cache/uv
85+ .venv
86+ key : ${{ runner.os }}-uv-shared-${{ hashFiles('**/uv.lock') }}
87+ restore-keys : |
88+ ${{ runner.os }}-uv-shared-
89+
10290 - name : Install uv
10391 run : make install-uv
10492
@@ -148,13 +136,19 @@ jobs:
148136 with :
149137 node-version : ' lts/*'
150138
151- # Start Appium
152- - run : npm install -g appium
153- - run : |
139+ - name : Install Appium and drivers
140+ run : |
141+ npm install -g appium
154142 appium driver install uiautomator2
155143 appium driver install espresso
156144 appium plugin install execute-driver
157- nohup appium --use-plugins=execute-driver --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium.log &
145+
146+ - name : Start Appium server
147+ uses : ./.github/actions/setup-appium-server
148+ with :
149+ port : ${{ env.APPIUM_TEST_SERVER_PORT }}
150+ host : ${{ env.APPIUM_TEST_SERVER_HOST }}
151+ server_args : ' --relaxed-security --use-plugins=execute-driver'
158152
159153 - name : Enable KVM group perms
160154 run : |
@@ -193,6 +187,11 @@ jobs:
193187 api-level : ${{ env.API_LEVEL }}
194188 arch : ${{ env.ARCH }}
195189 script : |
190+ # Cache uv modules
191+ mkdir -p ~/.cache/uv
192+ if [ -d ~/.cache/uv ]; then
193+ echo "uv cache directory exists"
194+ fi
196195 make install-uv
197196 uv run pytest ${{ matrix.test_targets.target}} --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
198197 target : google_apis
@@ -263,15 +262,32 @@ jobs:
263262 with :
264263 node-version : ' lts/*'
265264
266- - name : Install Appium
267- run : npm install --location=global appium
268-
269- - name : Install Android drivers and Run Appium
265+ - name : Install Appium and drivers
270266 if : matrix.e2e-tests == 'flutter-android'
271267 run : |
268+ npm install --location=global appium
272269 appium driver install uiautomator2
273270 appium driver install appium-flutter-integration-driver --source npm
274- nohup appium --allow-insecure=adb_shell --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium_flutter_android.log &
271+
272+ - name : Start Appium server for Android
273+ if : matrix.e2e-tests == 'flutter-android'
274+ uses : ./.github/actions/setup-appium-server
275+ with :
276+ port : ${{ env.APPIUM_TEST_SERVER_PORT }}
277+ host : ${{ env.APPIUM_TEST_SERVER_HOST }}
278+ server_args : ' --relaxed-security'
279+ log_file : ' appium_flutter_android.log'
280+
281+ - name : Cache uv modules for Flutter Android
282+ if : matrix.e2e-tests == 'flutter-android'
283+ uses : actions/cache@v4
284+ with :
285+ path : |
286+ ~/.cache/uv
287+ .venv
288+ key : ${{ runner.os }}-uv-shared-${{ hashFiles('**/uv.lock') }}
289+ restore-keys : |
290+ ${{ runner.os }}-uv-shared-
275291
276292 - name : Run Android tests
277293 if : matrix.e2e-tests == 'flutter-android'
@@ -304,18 +320,40 @@ jobs:
304320 # https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md
305321 model : ${{ env.IPHONE_MODEL }}
306322 os_version : ${{ env.IOS_VERSION }}
323+ wait_for_boot : true
324+ shutdown_after_job : false
307325
308326 - name : install dependencies
309327 if : matrix.e2e-tests == 'flutter-ios'
310328 run : brew install ffmpeg
311329
312- - name : Install IOS drivers and Run Appium
330+ - name : Install Appium and drivers
313331 if : matrix.e2e-tests == 'flutter-ios'
314332 run : |
333+ npm install --location=global appium
315334 appium driver install xcuitest
316335 appium driver install appium-flutter-integration-driver --source npm
317336 appium driver run xcuitest build-wda
318- nohup appium --allow-insecure=adb_shell --relaxed-security --log-timestamp --log-no-colors 2>&1 > appium_ios.log &
337+
338+ - name : Start Appium server for iOS
339+ if : matrix.e2e-tests == 'flutter-ios'
340+ uses : ./.github/actions/setup-appium-server
341+ with :
342+ port : ${{ env.APPIUM_TEST_SERVER_PORT }}
343+ host : ${{ env.APPIUM_TEST_SERVER_HOST }}
344+ server_args : ' --relaxed-security'
345+ log_file : ' appium_ios.log'
346+
347+ - name : Cache uv modules for Flutter iOS
348+ if : matrix.e2e-tests == 'flutter-ios'
349+ uses : actions/cache@v4
350+ with :
351+ path : |
352+ ~/.cache/uv
353+ .venv
354+ key : ${{ runner.os }}-uv-shared-${{ hashFiles('**/uv.lock') }}
355+ restore-keys : |
356+ ${{ runner.os }}-uv-shared-
319357
320358 - name : Run IOS tests
321359 if : matrix.e2e-tests == 'flutter-ios'
0 commit comments