Try to get Android to run on CI #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: XHarness Android Test | |
on: | |
pull_request: | |
push: | |
branches: [ main, 'releases/**' ] | |
release: | |
types: [ published ] | |
jobs: | |
android: | |
name: Android | |
runs-on: ubuntu-22.04 | |
env: | |
TEST_TARGET_FRAMEWORK: net8.0-android | |
TEST_RUNTIME_IDENTIFIER: android-x64 | |
TEST_CONFIGURATION: Release | |
TEST_EMULATOR_IMAGE: system-images;android-34;google_apis;x86_64 | |
TEST_EMULATOR_DEVICE: pixel_5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Required Tools | |
uses: ./.github/workflows/setup-tools | |
- name: Install Android SDK Packages | |
run: | | |
set | |
dotnet android sdk install --package "platform-tools" | |
dotnet android sdk install --package "emulator" | |
dotnet android sdk install --package "${{ env.TEST_EMULATOR_IMAGE }}" | |
dotnet android sdk list --installed | |
dotnet android sdk info | |
ls -la /usr/local/lib/android/sdk | |
ls -la /usr/local/lib/android/sdk/platform-tools | |
- name: Create the Emulator | |
run: dotnet android avd create --name TestRunnerEmulator --sdk "${{ env.TEST_EMULATOR_IMAGE }}" --device "${{ env.TEST_EMULATOR_DEVICE }}" | |
- name: Boot the Emulator | |
run: dotnet android avd start --name TestRunnerEmulator | |
# run: dotnet android avd start --name TestRunnerEmulator --wait-boot | |
- name: WAIT WAIT WAIT | |
shell: pwsh | |
run: | | |
while ($true) { | |
echo "getting props..." | |
dotnet android device list | |
dotnet android device info --property sys.boot_completed | |
dotnet android device info --property dev.bootcomplete | |
dotnet android device info | |
/usr/local/lib/android/sdk/platform-tools/adb devices | |
/usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed | |
sleep 15 | |
} | |
# - name: Publish App | |
# run: | | |
# dotnet publish sample/SampleMauiApp/SampleMauiApp.csproj \ | |
# -f ${{ env.TEST_TARGET_FRAMEWORK }} \ | |
# -r ${{ env.TEST_RUNTIME_IDENTIFIER }} \ | |
# -c ${{ env.TEST_CONFIGURATION }} \ | |
# -p:TestingMode=XHarness \ | |
# /bl:./artifacts/logs/msbuild-publish.binlog | |
# - name: Run Tests | |
# run: | | |
# xharness android test \ | |
# --package-name com.companyname.samplemauiapp \ | |
# --instrumentation devicerunners.xharness.maui.XHarnessInstrumentation \ | |
# --app sample/SampleMauiApp/bin/${{ env.TEST_CONFIGURATION }}/${{ env.TEST_TARGET_FRAMEWORK }}/${{ env.TEST_RUNTIME_IDENTIFIER }}/publish/com.companyname.samplemauiapp-Signed.apk | |
# --output-directory artifacts | |
- name: Shutdown the Emulator | |
run: dotnet xharness android adb -- emu kill | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v1 | |
if: ${{ always() }} | |
with: | |
name: Test Results - Android | |
path: ./artifacts |