Skip to content

Test .NET MAUI iOS App #6

Test .NET MAUI iOS App

Test .NET MAUI iOS App #6

Workflow file for this run

# Don't forget to add these secrets in your GitHub repository:
# - P12_FILE_BASE64: The P12 certificate file to sign the ipa file, encoded as Base64.
# - P12_PASSWORD: The password for the P12 certificate file to sign the ipa file.
# - APPSTORE_ISSUER_ID: Issuer ID associated to the Apple Developer API key. This can be found on https://appstoreconnect.apple.com/.
# - APPSTORE_KEY_ID: Key ID associated to the Apple Developer API key, this is associated to the private key below. This can be found on https://appstoreconnect.apple.com/.
# - APPSTORE_PRIVATE_KEY: Private key to the Apple Developer API Key. This can be downloaded on https://appstoreconnect.apple.com/.
# More information about the various Apple keys and files can be found here: https://learn.microsoft.com/dotnet/maui/ios/apple-account-management
# - APPCENTER_TOKEN_IOS: App Center API key that can access the App Center iOS 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 iOS 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: 1f1515d2
APP_DEFINITION: xtc-Xamarin-Forms/MauiTest-iOS
TEST_SERIES: master
jobs:
build:
runs-on: macos-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: Install iOS App P12 Certificate
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.P12_FILE_BASE64 }}
p12-password: ${{ secrets.P12_PASSWORD }}
- name: Install iOS App Provisioning Profile
uses: Apple-Actions/download-provisioning-profiles@v1
with:
bundle-id: ${{ env.APP_ID }}
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
- name: Restore dependencies
run: dotnet restore
- name: Publish .NET MAUI iOS App
run: dotnet publish ${{ env.MAUI_CSPROJ_TO_BUILD }} -c ${{ env.BUILD_CONFIGURATION }} -f ${{ env.TFM_PREFIX }}-ios -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/MauiUITestSample.ipa" --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_IOS }}" --async