Test .NET MAUI Android App #3
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
# Don't forget to add these secrets in your GitHub repository: | |
# - APPCENTER_TOKEN_ANDROID: App Center API key that can access the App Center Android app definition. | |
# More information on the App Center API tokens can be found here: https://learn.microsoft.com/appcenter/api-docs/ | |
name: Test .NET MAUI Android App | |
on: | |
workflow_dispatch: | |
# Replace these variables to match your project | |
env: | |
BUILD_CONFIGURATION: Release | |
DOTNET_VERSION: 7.0.x | |
MAUI_CSPROJ_TO_BUILD: MauiUITestSample/MauiUITestSample.csproj | |
UITEST_CSPROJ_TO_BUILD: MyAppTests/MyAppTests.csproj | |
# Should match the values for the TargetFrameworks node in the .NET MAUI csproj file. Also make sure this matches DOTNET_VERSION. | |
TFM_PREFIX: net7.0 | |
# Find this in the ApplicationId node in the .NET MAUI csproj file | |
APP_ID: com.companyname.mauiuitestsample | |
# App Center configuration | |
TEST_DEVICES: ff8f571c | |
APP_DEFINITION: xtc-Xamarin-Forms/MauiTest | |
TEST_SERIES: master | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Install .NET MAUI Workload | |
run: dotnet workload install maui | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Publish .NET MAUI Android App | |
run: dotnet publish ${{ env.MAUI_CSPROJ_TO_BUILD }} -c ${{ env.BUILD_CONFIGURATION }} -f ${{ env.TFM_PREFIX }}-android -o ${{ github.workspace }}\\artifacts | |
- name: Build UITest Project | |
run: dotnet build ${{ env.UITEST_CSPROJ_TO_BUILD }} -c ${{ env.BUILD_CONFIGURATION }} | |
- name: Install App Center CLI | |
run: npm install --location=global appcenter-cli | |
- name: Upload App to Test Cloud | |
run: appcenter test run uitest --app "${{ env.APP_DEFINITION }}" --devices "${{ env.TEST_DEVICES }}" --app-path "${{ github.workspace }}\\artifacts\\${{ env.APP_ID }}-Signed.apk" --test-series "${{ env.TEST_SERIES }}" --build-dir "MyAppTests/bin/${{ env.BUILD_CONFIGURATION }}/net48/" --uitest-tools-dir "MyAppTests/bin/${{ env.BUILD_CONFIGURATION }}/net48/" --token "${{ secrets.APPCENTER_TOKEN_ANDROID }}" --async |