Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a39b893
Update the CI to build and run device tests
kotlarmilos Feb 12, 2025
3022225
Add MAUI test runner app
kotlarmilos Feb 12, 2025
23fd0a4
Pin maccatalyst version
kotlarmilos Feb 12, 2025
2e1ca77
Use .NET 9 to run the the app with XCode 15.4
kotlarmilos Feb 13, 2025
5cffd2c
Remove net9.0-ios target
kotlarmilos Feb 13, 2025
19a9b6e
Fix workload install command
kotlarmilos Feb 13, 2025
d1dd21d
Test maui workload
kotlarmilos Feb 13, 2025
df86efe
Revert sdk version
kotlarmilos Feb 14, 2025
1fee60e
Revert sdk version
kotlarmilos Feb 14, 2025
56128ee
Revert sdk version
kotlarmilos Feb 14, 2025
6e86096
Revert sdk version
kotlarmilos Feb 14, 2025
a2bbd0d
Test the default MAUI version
kotlarmilos Feb 14, 2025
fc83fdf
Disable Directory.Build props
kotlarmilos Feb 14, 2025
a06afa4
Update target frameowkr
kotlarmilos Feb 14, 2025
1446e7f
Use net9.0 version
kotlarmilos Feb 14, 2025
aa83e02
Select Xcode 16.2
kotlarmilos Feb 14, 2025
18afe00
Use sudo in xcode-select
kotlarmilos Feb 14, 2025
7e8953d
Fix binlog path
kotlarmilos Feb 14, 2025
1030042
Remove binlog
kotlarmilos Feb 14, 2025
99ad0a7
Install XHarness
kotlarmilos Feb 14, 2025
3ff5a68
Fix xharness path
kotlarmilos Feb 14, 2025
30d764f
Fix xharness path
kotlarmilos Feb 14, 2025
8dfe24e
Fix xharness path
kotlarmilos Feb 15, 2025
9a08713
Fix xharness path
kotlarmilos Feb 15, 2025
5ffb536
Fix xharness path
kotlarmilos Feb 15, 2025
78661cc
Fix xharness path
kotlarmilos Feb 15, 2025
6f621dc
Display app logs
kotlarmilos Feb 15, 2025
f10daaf
Test app build
kotlarmilos Feb 15, 2025
b4eb5a0
Test app build
kotlarmilos Feb 15, 2025
cbd1d6a
Test app build
kotlarmilos Feb 15, 2025
7bfbad4
Test build app
kotlarmilos Feb 16, 2025
a2edc27
Test app build
kotlarmilos Feb 16, 2025
bade761
Revert changes
kotlarmilos Feb 16, 2025
ad6f05d
Revert changes
kotlarmilos Feb 16, 2025
d29a319
Test app build
kotlarmilos Feb 16, 2025
d65d665
Test app build
kotlarmilos Feb 16, 2025
52ab08a
Create new job
kotlarmilos Feb 17, 2025
a244547
Remove non-Apple mobile files
kotlarmilos Feb 17, 2025
c0247d7
Rename AppRunner to Swift.Bindings.Framework.Tests
kotlarmilos Feb 17, 2025
6290875
Move HikingApp to samples
kotlarmilos Feb 17, 2025
ff039fd
Add README.md
kotlarmilos Feb 17, 2025
5968cc2
Fix formatting
kotlarmilos Feb 17, 2025
edaa045
Add verbosity flag
kotlarmilos Feb 18, 2025
ff28586
Test macOS-arm64 pool
kotlarmilos Feb 18, 2025
3715e98
Fix formatting
kotlarmilos Feb 18, 2025
6cdffec
Fix arm64 jobs
kotlarmilos Feb 18, 2025
0d2fb39
Remove redundant macOS job
kotlarmilos Feb 19, 2025
b4c5d61
Fix ident
kotlarmilos Feb 19, 2025
b70d7cb
Fix ident
kotlarmilos Feb 19, 2025
fb31cbe
Fix ident
kotlarmilos Feb 19, 2025
651f549
Revert changes
kotlarmilos Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,4 @@ launchSettings.json
# Testing artifacts
testing/
src/samples/
GeneratedBindings/
GeneratedBindings/
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Condition="'$(UseMaui)' != 'true'" Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<PropertyGroup>
<Copyright>$(CopyrightNetFoundation)</Copyright>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@

<Import Condition="'$(IsTestProject)' == 'true'" Project="$(RepositoryEngineeringDir)testing\runsettings.targets" />

<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Condition="'$(UseMaui)' != 'true'" Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="test-device-runners" value="https://pkgs.dev.azure.com/mattleibow/OpenSource/_packaging/test-device-runners/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
Expand Down
6 changes: 3 additions & 3 deletions eng/pipelines/common/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ jobs:
-c $(_BuildConfig)
$(_testBuildArg)
/p:TargetPlatform=${{ parameters.archType }}
displayName: Build and Test
displayName: Build and test

- script: ./verify.sh
- script: ./dotnet.sh format --exclude artifacts --verify-no-changes --verbosity detailed
displayName: Verify code formatting

- ${{ if and(eq(parameters.bindings.isBindingsBuild, true), ne(parameters.osGroup, 'Windows_NT')) }}:
- script: ./generate.sh --configuration $(_BuildConfig) ${{ parameters.bindings.scriptArgs }}
displayName: Generate Bindings
displayName: Generate bindings

- ${{ if eq(parameters.isOfficialBuild, true) }}:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
Expand Down
79 changes: 79 additions & 0 deletions eng/pipelines/common/templates/test-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
parameters:
variables: {}
osGroup: ''
platform: ''
archType: ''
container: ''
pool: {}

jobs:

- template: /eng/common/templates/jobs/jobs.yml
parameters:
enableTelemetry: true
helixRepo: dotnet/runtimelab
pool: ${{ parameters.pool }}
enableMicrobuild: true
graphFileGeneration:
enabled: false
includeToolset: false

jobs:
- job: ${{ format('{0}_{1}_{2}', parameters.osGroup, parameters.platform, parameters.archType) }}
displayName: ${{ format('{0} {1} {2}', parameters.osGroup, parameters.platform, parameters.archType) }}
strategy:
matrix:
Release:
_BuildConfig: Release
Debug:
_BuildConfig: Debug

steps:
# Use .NET 9 as MAUI workloads are not available for the default SDK
- script: |
cat << 'EOF' > global.json
{
"sdk": {
"version": "9.0.102",
"allowPrerelease": true,
"rollForward": "major"
},
"tools": {
"dotnet": "9.0.102",
"runtimes": {
"dotnet": [
"$(MicrosoftNETCoreAppVersion)"
]
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24515.3"
}
}
EOF
./build.sh
./dotnet.sh workload install maui maccatalyst --version 9.0.103 --source https://api.nuget.org/v3/index.json
./dotnet.sh new tool-manifest && ./dotnet.sh tool install microsoft.dotnet.xharness.cli --version "9.0.0-prerelease*"
sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
displayName: Install dependencies

- script: |
./dotnet.sh build ./src/Swift.Bindings/tests/FrameworkTests/Swift.Bindings.Framework.Tests.csproj \
-f net9.0-${{ parameters.platform }} \
-c $(_BuildConfig) \
-r ${{ parameters.platform }}-${{ parameters.archType }} \
/p:UseMaui=true
displayName: Publish app

- script: |
./dotnet.sh xharness apple test \
--target ${{ parameters.platform }} \
--timeout="00:02:00" \
--launch-timeout=00:06:00 \
--app ./src/Swift.Bindings/tests/FrameworkTests/bin/$(_BuildConfig)/net9.0-${{ parameters.platform }}/${{ parameters.platform }}-${{ parameters.archType }}/Swift.Bindings.Framework.Tests.app \
--output-directory artifacts
displayName: Run device tests

- script: |
cat artifacts/Swift.Bindings.Framework.Tests.log
displayName: Display logs
11 changes: 4 additions & 7 deletions eng/pipelines/runtimelab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,18 @@ stages:
- template: /eng/pipelines/common/templates/build-job.yml
parameters:
osGroup: OSX
archType: arm64
archType: x64
runTests: true
pool:
vmImage: 'macOS-latest'
bindings:
isBindingsBuild: true
scriptArgs: '--platform MacOSX --arch arm64e-apple-macos --framework StoreKit'
scriptArgs: '--platform MacOSX --arch x86_64-apple-macos --framework StoreKit'

- template: /eng/pipelines/common/templates/build-job.yml
- template: /eng/pipelines/common/templates/test-job.yml
parameters:
osGroup: OSX
platform: maccatalyst
archType: x64
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why x64? Is this a HW availability limitation?

Copy link
Copy Markdown
Member Author

@kotlarmilos kotlarmilos Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the default image. There is a macOS-arm64 image and we need to figure out how to use it.

https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml

Copy link
Copy Markdown
Member Author

@kotlarmilos kotlarmilos Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hostArchitecture: Arm64 was missing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akoeplinger Do you know if we can run macOS-arm64 containers?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not if you run tests directly on the AzDO build machine, the arm64 macOS pool is only available in internal builds, not in public.

Copy link
Copy Markdown
Member Author

@kotlarmilos kotlarmilos Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the arm64 job redundant? Should we use Helix instead for arm64 jobs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which arm64 job? the one in this file only builds for arm64 which does work on x64.

if you can send to Helix then yeah you could send to an arm64 queue

Copy link
Copy Markdown
Member Author

@kotlarmilos kotlarmilos Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which arm64 job? the one in this file only builds for arm64 which does work on x64.

Yes, that was my question. So even it builds for arm64, it runs on x64.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

runTests: true
pool:
vmImage: 'macOS-latest'
bindings:
isBindingsBuild: true
scriptArgs: '--platform MacOSX --arch x86_64-apple-macos --framework StoreKit'
2 changes: 1 addition & 1 deletion generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function ExtractABI {
local framework=$1

echo "Generating ABI for framework '$framework', platform '$platform', architecture '$arch'"

local sdk_path=$(xcrun -sdk $(echo "$platform" | tr '[:upper:]' '[:lower:]') --show-sdk-path)
local swift_interface_path="$(xcode-select -p)/Platforms/${platform}.platform/Developer/SDKs/${platform}.sdk/System/Library/Frameworks/${framework}.framework/Versions/Current/Modules/${framework}.swiftmodule/${arch}.swiftinterface"

Expand Down
2 changes: 1 addition & 1 deletion src/Dynamo/src/Dynamo.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
2 changes: 1 addition & 1 deletion src/Dynamo/tests/Dynamo.Unit.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
28 changes: 28 additions & 0 deletions src/Swift.Bindings/tests/FrameworkTests/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using DeviceRunners.UITesting;
using DeviceRunners.VisualRunners;
using DeviceRunners.XHarness;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Hosting;

namespace BindingsGeneration.FrameworkTests;

public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.ConfigureUITesting()
.UseXHarnessTestRunner(conf => conf
.AddTestAssembly(typeof(MauiProgram).Assembly)
.AddXunit())
.UseVisualTestRunner(conf => conf
.AddConsoleResultChannel()
.AddTestAssembly(typeof(MauiProgram).Assembly)
.AddXunit());

builder.Logging.AddDebug();

return builder.Build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Foundation;

namespace BindingsGeneration.FrameworkTests;

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
<dict>
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
<key>com.apple.security.app-sandbox</key>
<true/>
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- The Mac App Store requires you specify if the app uses encryption. -->
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/itsappusesnonexemptencryption -->
<!-- <key>ITSAppUsesNonExemptEncryption</key> -->
<!-- Please indicate <true/> or <false/> here. -->

<!-- Specify the category for your app here. -->
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype -->
<!-- <key>LSApplicationCategoryType</key> -->
<!-- <string>public.app-category.YOUR-CATEGORY-HERE</string> -->
<key>UIDeviceFamily</key>
<array>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using ObjCRuntime;
using UIKit;

namespace BindingsGeneration.FrameworkTests;

public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Foundation;

namespace BindingsGeneration.FrameworkTests;

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
32 changes: 32 additions & 0 deletions src/Swift.Bindings/tests/FrameworkTests/Platforms/iOS/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
</plist>
15 changes: 15 additions & 0 deletions src/Swift.Bindings/tests/FrameworkTests/Platforms/iOS/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using ObjCRuntime;
using UIKit;

namespace BindingsGeneration.FrameworkTests;

public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the minimum required version of the Apple Privacy Manifest for .NET MAUI apps.
The contents below are needed because of APIs that are used in the .NET framework and .NET MAUI SDK.

You are responsible for adding extra entries as needed for your application.

More information: https://aka.ms/maui-privacy-manifest
-->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
</dict>
<!--
The entry below is only needed when you're using the Preferences API in your app.
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict> -->
</array>
</dict>
</plist>
Loading