Skip to content

Commit d0e40ec

Browse files
authored
Merge pull request #399 from microsoft/alzollin/fixTests
Fixes tests.
2 parents 4196eda + f3e40ea commit d0e40ec

File tree

7 files changed

+26
-19
lines changed

7 files changed

+26
-19
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
dotnet-configuration: [ 'Release' ]
19-
dotnet-arch: ['x64' ] # TODO: enable when Microsoft.ML.OnnxRuntimeGenAI 0.4.0 ships to NuGet.org, 'arm64' ]
19+
dotnet-arch: ['x64' ] # TODO: enable arm64' ]
2020
name: Build MSIX - win-${{ matrix.dotnet-arch }}
21-
runs-on: windows-latest
21+
runs-on: windows-2025
2222
permissions:
2323
contents: read
2424
steps:
@@ -57,9 +57,9 @@ jobs:
5757
fail-fast: false
5858
matrix:
5959
dotnet-configuration: [ 'Release' ]
60-
dotnet-arch: ['x64' ] # TODO: enable when Microsoft.ML.OnnxRuntimeGenAI 0.4.0 ships to NuGet.org, 'arm64' ]
60+
dotnet-arch: ['x64' ] # TODO: enable arm64' ]
6161
name: Test - win-${{ matrix.dotnet-arch }}
62-
runs-on: windows-latest
62+
runs-on: windows-2025
6363
permissions:
6464
contents: read
6565
steps:
@@ -92,8 +92,8 @@ jobs:
9292
uses: ilammy/msvc-dev-cmd@v1
9393
- name: Build Tests
9494
run: dotnet build AIDevGallery.UnitTests -r win-${{ matrix.dotnet-arch }} -f net9.0-windows10.0.26100.0 /p:Configuration=${{ matrix.dotnet-configuration }} /p:Platform=${{ matrix.dotnet-arch }}
95-
# - name: Run Tests
96-
# run: vstest.console.exe .\AIDevGallery.UnitTests\bin\${{ matrix.dotnet-arch }}\${{ matrix.dotnet-configuration }}\net9.0-windows10.0.26100.0\win-${{ matrix.dotnet-arch }}\AIDevGallery.UnitTests.build.appxrecipe /TestAdapterPath:"$HOME\.nuget\mstest.testadapter\3.9.1\buildTransitive\net9.0" /framework:FrameworkUap10 /logger:"trx;LogFileName=${{ github.workspace }}\TestResults\VsTestResults.trx"
95+
- name: Run Tests
96+
run: vstest.console.exe .\AIDevGallery.UnitTests\bin\${{ matrix.dotnet-arch }}\${{ matrix.dotnet-configuration }}\net9.0-windows10.0.26100.0\win-${{ matrix.dotnet-arch }}\AIDevGallery.UnitTests.build.appxrecipe /TestAdapterPath:"$HOME\.nuget\mstest.testadapter\3.9.2\buildTransitive\net9.0" /framework:FrameworkUap10 /logger:"trx;LogFileName=${{ github.workspace }}\TestResults\VsTestResults.trx"
9797
- name: Publish Test Builds If Failed
9898
if: failure()
9999
uses: actions/upload-artifact@v4

AIDevGallery.UnitTests/AIDevGallery.UnitTests.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
<Nullable>enable</Nullable>
1414
<EnableMsixTooling>true</EnableMsixTooling>
1515
<NoWarn>CS1591</NoWarn>
16-
<!-- Workaround for tests in WinAppSDK1.8Exp2 -->
17-
<WindowsAppSdkDeploymentManagerInitialize>false</WindowsAppSdkDeploymentManagerInitialize>
16+
<MSTestAnalysisMode>Recommended</MSTestAnalysisMode>
17+
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
18+
</PropertyGroup>
1819

19-
<!-- Is this the right fix? -->
20-
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
20+
<PropertyGroup Condition="'$(IsWindowsAppSDKPreRelease)' == 'true' And '$(SelfContainedIfPreviewWASDK)' == 'true'">
21+
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
22+
<!-- Workaround for tests in WinAppSDK1.8Exp3 -->
23+
<WindowsAppSdkDeploymentManagerInitialize>false</WindowsAppSdkDeploymentManagerInitialize>
2124
</PropertyGroup>
2225

2326
<ItemGroup>

AIDevGallery.UnitTests/ProjectGeneratorUnitTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public override string ToString()
203203
}
204204

205205
[TestMethod]
206-
[DynamicData(nameof(BatchSource))]
206+
[DynamicData(nameof(BatchSource), UnfoldingStrategy = TestDataSourceUnfoldingStrategy.Fold)]
207207
public async Task GenerateForAllSamples(SampleGroup items)
208208
{
209209
await Parallel.ForEachAsync(
@@ -334,7 +334,7 @@ private async Task<bool> GenerateForSample(SampleUIData sampleUIData, Cancellati
334334
return process.ExitCode == 0;
335335
}
336336

337-
[ClassCleanup]
337+
[ClassCleanup(ClassCleanupBehavior.EndOfClass)]
338338
public static void Cleanup()
339339
{
340340
Directory.Delete(TmpPathProjectGenerator, true);

AIDevGallery.UnitTests/Properties/PublishProfiles/win-arm64.pubxml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
66
<PropertyGroup>
77
<PublishProtocol>FileSystem</PublishProtocol>
88
<Platform>ARM64</Platform>
9-
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-arm64</RuntimeIdentifier>
10-
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-arm64</RuntimeIdentifier>
9+
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
1110
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
1211
<SelfContained>true</SelfContained>
1312
<PublishSingleFile>False</PublishSingleFile>

AIDevGallery.UnitTests/Properties/PublishProfiles/win-x64.pubxml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
66
<PropertyGroup>
77
<PublishProtocol>FileSystem</PublishProtocol>
88
<Platform>x64</Platform>
9-
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
10-
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
9+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
1110
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
1211
<SelfContained>true</SelfContained>
1312
<PublishSingleFile>False</PublishSingleFile>

AIDevGallery/AIDevGallery.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
<WinMLDeployMSIXToOutput>true</WinMLDeployMSIXToOutput>
2828
</PropertyGroup>
2929

30+
<PropertyGroup Condition="'$(IsWindowsAppSDKPreRelease)' == 'true'">
31+
<!-- Workaround for tests in WinAppSDK1.8Exp3 -->
32+
<WindowsAppSdkDeploymentManagerInitialize>false</WindowsAppSdkDeploymentManagerInitialize>
33+
</PropertyGroup>
34+
35+
<PropertyGroup Condition="'$(IsWindowsAppSDKPreRelease)' == 'true' And '$(SelfContainedIfPreviewWASDK)' == 'true'">
36+
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
37+
</PropertyGroup>
38+
3039
<ItemGroup>
3140
<None Remove="**\*.xaml" />
3241
</ItemGroup>

Directory.Build.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,4 @@
2626
<!-- Turn on/off depending on weather the WinAppSDK is prerelease or not -->
2727
<IsWindowsAppSDKPreRelease>true</IsWindowsAppSDKPreRelease>
2828
</PropertyGroup>
29-
<PropertyGroup Condition="'$(IsWindowsAppSDKPreRelease)' == 'true' And '$(SelfContainedIfPreviewWASDK)' == 'true'">
30-
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
31-
</PropertyGroup>
3229
</Project>

0 commit comments

Comments
 (0)